IModelConnection Class

A connection to an iModel database hosted on the backend.

Extends

Implements

Methods

Name Description
cartographicToSpatial(cartographic: Cartographic, result?: Primitives.Point3d): Promise<Point3d> Convert a Cartographic to a point in this iModel's Spatial coordinates using the Geographic location services for this IModelConnection or ecefLocation.  
cartographicToSpatialFromGcs(cartographic: Cartographic, result?: Primitives.Point3d): Promise<Point3d> Convert a Cartographic to a point in this iModel's Spatial coordinates using the Geographic location services for this IModelConnection.  
close(): Promise<void> Close this IModelConnection
In the case of ReadWrite connections ensure all changes are pushed to the iModelHub before making this call -
any un-pushed changes are lost after the close.
 
closeSnapshot(): Promise<void> Close this IModelConnection to a read-only iModel snapshot. Beta
findClassFor<T extends EntityState>(className: string, defaultClass: T extends EntityState | undefined): Promise<T extends EntityState | undefined> Find the first registered base class of the given EntityState className.  
getMassProperties(requestProps: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> Request element mass properties from the backend. Beta
getToolTipMessage(id: Id64String): Promise<string[]> Request a tooltip from the backend.  
loadFontMap(): Promise<FontMap> Load the FontMap for this IModelConnection.  
query(ecsql: string, bindings?: any[] | object, limitRows?: number, quota?: QueryQuota, priority?: QueryPriority): AsyncIterableIterator<any> Execute a query and stream its results
The result of the query is async iterator over the rows.
Beta
queryEntityIds(params: EntityQueryParams): Promise<Id64Set> Query for a set of element ids that satisfy the supplied query params  
queryRowCount(ecsql: string, bindings?: any[] | object): Promise<number> Compute number of rows that would be returned by the ECSQL.  
requestSnap(props: SnapRequestProps): Promise<SnapResponseProps> Request a snap from the backend.  
saveChanges(description?: string): Promise<void> Commit pending changes to this iModel  
spatialToCartographic(spatial: XYAndZ, result?: Cartographic): Promise<Cartographic> Convert a point in this iModel's Spatial coordinates to a Cartographic using the Geographic location services for this IModelConnection or ecefLocation.  
spatialToCartographicFromGcs(spatial: XYAndZ, result?: Cartographic): Promise<Cartographic> Convert a point in this iModel's Spatial coordinates to a Cartographic using the Geographic location services for this IModelConnection.  
updateProjectExtents(newExtents: AxisAlignedBox3d): Promise<void> Update the project extents of this iModel.  
createBlank(props: BlankConnectionProps): IModelConnection Static Create a new Blank IModelConnection. Beta
open(contextId: string, iModelId: string, openMode: OpenMode = OpenMode.Readonly, version: IModelVersion = IModelVersion.latest()): Promise<IModelConnection> Static Open an IModelConnection to an iModel.  
openSnapshot(fileName: string): Promise<IModelConnection> Static Open an IModelConnection to a read-only iModel snapshot (not managed by iModelHub) from a file name that is resolved by the backend. Beta

Inherited methods

Name Inherited from Description
cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Primitives.Point3d): Point3d IModel Convert a ($Cartographic$refLinkSource=imodeljs-frontend/D:/vsts_a/3/s/core/frontend/node_modules/@bentley/imodeljs-common/lib/IModel.d.ts@195) to a point in this iModel's Spatial coordinates using its ecefLocation.
ecefToSpatial(ecef: XYAndZ, result?: Primitives.Point3d): Point3d IModel Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its ecefLocation.
getEcefTransform(): Transform IModel Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its ecefLocation.
setEcefLocation(ecef: EcefLocationProps): void IModel Set the EcefLocation for this iModel.
spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic IModel Convert a point in this iModel's Spatial coordinates to a ($Cartographic$refLinkSource=imodeljs-frontend/D:/vsts_a/3/s/core/frontend/node_modules/@bentley/imodeljs-common/lib/IModel.d.ts@186) using its ecefLocation.
spatialToEcef(spatial: XYAndZ, result?: Primitives.Point3d): Point3d IModel Convert a point in this iModel's Spatial coordinates to an ECEF point using its ecefLocation.
getDefaultSubCategoryId(categoryId: Id64String): Id64String Static IModel Get the default subCategoryId for the supplied categoryId

Properties

Name Type Description
codeSpecs IModelConnection.CodeSpecs The CodeSpecs in this IModelConnection.  
connectionTimeout Static number The maximum time (in milliseconds) to wait before timing out the request to open a connection to a new iModel  
elements IModelConnection.Elements The ElementStates in this IModelConnection.  
fontMap undefined | FontMap The font map for this IModelConnection.  
isBlank boolean True if this is a Blank Connection. Beta
isClosed Accessor ReadOnly boolean Check if the IModelConnection is closed (i.e. Beta
isOpen Accessor ReadOnly boolean Check if the IModelConnection is open (i.e. Beta
isReadonly Accessor ReadOnly boolean Check the IModelConnection.openMode of this IModelConnection to see if it was opened read-only.  
models IModelConnection.Models The ModelStates in this IModelConnection.  
onClose Static BeEvent<(_imodel: IModelConnection) => void> Event called immediately before any IModelConnection is closed.  
onClose BeEvent<(_imodel: IModelConnection) => void> Event called immediately before this IModelConnection is closed. Beta
onOpen Static BeEvent<(_imodel: IModelConnection) => void> Event called immediately after any IModelConnection is opened.  
openMode OpenMode The OpenMode used for this IModelConnection.  
selectionSet SelectionSet The set of currently selected elements for this IModelConnection.  
transientIds TransientIdSequence Generator for unique Ids of transient graphics for this IModelConnection.  
views IModelConnection.Views The IModelConnection.ViewStates in this IModelConnection.  

Inherited properties

Name Type Inherited from Description
dictionaryId Static Id64String IModel The Id of the dictionary model.
ecefLocation EcefLocation | undefined IModel The EcefLocation of the iModel in Earth Centered Earth Fixed coordinates.
globalOrigin Point3d IModel An offset to be applied to all spatial coordinates.
iModelToken IModelToken IModel The token that can be used to find this iModel instance.
isGeoLocated boolean IModel True if this iModel has an EcefLocation.
name string IModel Name of the iModel
projectExtents AxisAlignedBox3d IModel The volume, in spatial coordinates, inside which the entire project is contained.
repositoryModelId Static Id64String IModel The Id of the repository model.
rootSubject RootSubjectProps IModel The name and description of the root subject of this iModel
rootSubjectId Static Id64String IModel The Id of the root subject element.

Defined in

Last Updated: 08 January, 2020