@itwin/core-common 5.5.0 → 5.6.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,13 +1,6 @@
1
1
  # Change Log - @itwin/core-common
2
2
 
3
- This log was last generated on Mon, 05 Jan 2026 17:05:53 GMT and should not be manually modified.
4
-
5
- ## 5.5.0
6
- Mon, 05 Jan 2026 17:05:53 GMT
7
-
8
- ### Updates
9
-
10
- - introduce enableTransactions flag on standaloneDb creation props
3
+ This log was last generated on Fri, 12 Dec 2025 20:14:10 GMT and should not be manually modified.
11
4
 
12
5
  ## 5.4.2
13
6
  Fri, 12 Dec 2025 14:40:14 GMT
@@ -175,7 +175,7 @@ export interface CreateStandaloneIModelProps {
175
175
  * internal value `{ "txns": true }` regardless of the string content provided. This behavior ensures backwards
176
176
  * compatibility while allowing users to enable transaction support.
177
177
  * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.
178
- * @deprecated in 5.5 - will not be removed until after 2027-01-05. Use [[enableTransactions]] instead.
178
+ * @deprecated in 5.5. Use [[enableTransactions]] instead.
179
179
  */
180
180
  readonly allowEdit?: string;
181
181
  /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.
@@ -1 +1 @@
1
- {"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../src/IModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsJ;AACtJ,wDAG8B;AAE9B,0DAA0E;AAC1E,oFAAyF;AAEzF,+CAA4C;AAmN5C;;;;GAIG;AACH,MAAa,YAAY;IACvB,wCAAwC;IACxB,MAAM,CAAU;IAChC,4CAA4C;IAC5B,WAAW,CAAqB;IAChD,wFAAwF;IACxE,kBAAkB,CAAgB;IAClD,8HAA8H;IAC9G,OAAO,CAAY;IACnC,8HAA8H;IAC9G,OAAO,CAAY;IACnC,mFAAmF;IAClE,UAAU,GAAc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AAC,CAAC;IAEtE;;OAEG;IACI,gBAAgB;QACrB,IAAI,SAAS,KAAK,IAAI,CAAC,aAAa;YAClC,MAAM,IAAI,yBAAW,CAAC,+BAAgB,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,OAAe,EAAE,MAAgB,IAAa,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAErI;;;;;;OAMG;IACI,aAAa,CAAC,IAAY,EAAE,MAAgB,IAAa,OAAO,IAAA,4BAAa,EAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAErJ;;;;;OAKG;IACI,6BAA6B,CAAC,OAAe,EAAE,MAAqB,IAAkB,OAAO,IAAA,4BAAa,EAAC,2BAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhL;;;;;;OAMG;IACI,6BAA6B,CAAC,YAA0B,EAAE,MAAgB,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;AA1SxJ,wBA2SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, BeEvent, expectDefined, GeoServiceStatus, GuidString, Id64, Id64String, IModelStatus, Mutable, OpenMode } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AxisIndex, AxisOrder, Constant, Geometry, Matrix3d, Point3d, Range3d, Range3dProps, Transform, TransformProps, Vector3d, XYAndZ, XYZProps,\r\n YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ChangesetIdWithIndex } from \"./ChangesetProps\";\r\nimport { Cartographic, CartographicProps } from \"./geometry/Cartographic\";\r\nimport { GeographicCRS, GeographicCRSProps } from \"./geometry/CoordinateReferenceSystem\";\r\nimport { AxisAlignedBox3d } from \"./geometry/Placement\";\r\nimport { IModelError } from \"./IModelError\";\r\nimport { ThumbnailProps } from \"./Thumbnail\";\r\n\r\n/** The properties to open a connection to an iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcOpenProps {\r\n /** The iTwin in which the iModel exists - must be defined for briefcases that are synchronized with iModelHub. */\r\n readonly iTwinId?: GuidString;\r\n /** Guid of the iModel. */\r\n readonly iModelId?: GuidString;\r\n\r\n /** Id of the last Changeset that was applied to the iModel - must be defined for briefcases that are synchronized with iModelHub.\r\n * @note Changeset Ids are string hash values based on the content and parent.\r\n */\r\n readonly changeset?: ChangesetIdWithIndex;\r\n}\r\n\r\n/** The properties that identify an opened iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcProps extends IModelRpcOpenProps {\r\n /** Unique key used for identifying the iModel between the frontend and the backend */\r\n readonly key: string;\r\n}\r\n\r\n/** Properties that position an iModel on the earth via [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * The origin is specified as an ECEF coordinate. The cartographicOrigin property contains the latitude, longitude and elevation above the WGS84 ellipsoid\r\n * of the origin property. This cartographicOrigin is offered as a convenient pre-calculated value representing the location of the ECEF origin.\r\n * The 3D coordinate system this class represents is positioned at specified origin and the axis positioned according to\r\n * the other properties.\r\n * If transform property is defined then it will not be computed from other properties.\r\n * If the xVector and yVector properties are defined (and transform is not defined) then they take precedence over the YawPitchRoll orientation property. The xVector and yVector\r\n * represent the direction and scale of the X and Y axes. The Z axis is always perpendicular (according to the right hand rule) to these X-Y axes.\r\n * The scaling in the Z direction is always unity. The scale of the X and Y axes is represented by the size of the vector length.\r\n * If the xVector and yVector are not present then the YawPitchRoll properties indicates the angles for all tree axes. Scaling in that case\r\n * is unity in all three directions.\r\n * Note that the present class is intended to represent geolocated 3D coordinate systems that are normally tangent to the WGS84 ellipsoid\r\n * possibly offset in altitude by the terrain elevation above the ellipsoid but other general 3D coordinate systems\r\n * can be defined.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface EcefLocationProps {\r\n /** The Origin of an iModel on the earth in ECEF coordinates */\r\n readonly origin: XYZProps;\r\n /** The [orientation](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion) of an iModel on the earth. */\r\n readonly orientation: YawPitchRollProps;\r\n /** Optional position on the earth used to establish the ECEF coordinates. */\r\n readonly cartographicOrigin?: CartographicProps;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly xVector?: XYZProps;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly yVector?: XYZProps;\r\n /** Optional potentially non-rigid transform defining the ECEF location.\r\n * @note If this property is supplied, the other properties are ignored.\r\n */\r\n readonly transform?: TransformProps;\r\n}\r\n\r\n/** Properties of the [Root Subject]($docs/bis/guide/references/glossary#subject-root).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RootSubjectProps {\r\n /** The name of the root subject. */\r\n readonly name: string;\r\n /** Description of the root subject (optional). */\r\n readonly description?: string;\r\n}\r\n\r\n/** Properties of an iModel that are always held in memory whenever one is opened, both on the frontend and on the backend .\r\n * @public\r\n */\r\nexport interface IModelProps {\r\n /** The name and description of the root subject of this iModel */\r\n readonly rootSubject: RootSubjectProps;\r\n /** The volume of the entire project, in spatial coordinates */\r\n readonly projectExtents?: Range3dProps;\r\n /** An offset to be applied to all spatial coordinates. This is normally used to transform spatial coordinates into the Cartesian coordinate system of a Geographic Coordinate System. */\r\n readonly globalOrigin?: XYZProps;\r\n /** The location of the iModel in Earth Centered Earth Fixed coordinates. iModel units are always meters */\r\n readonly ecefLocation?: EcefLocationProps;\r\n /** The Geographic Coordinate Reference System indicating the projection and datum used. */\r\n readonly geographicCoordinateSystem?: GeographicCRSProps;\r\n /** The name of the iModel. */\r\n readonly name?: string;\r\n}\r\n\r\n/** The properties returned by the backend when creating a new [[IModelConnection]] from the frontend, either with Rpc or with Ipc.\r\n * These properties describe the iModel held on the backend for thew newly formed connection and are used to construct a new\r\n * [[IModelConnection]] instance on the frontend to access it.\r\n * @public\r\n */\r\nexport type IModelConnectionProps = IModelProps & IModelRpcProps;\r\n\r\n/** The properties that can be supplied when creating a *new* iModel.\r\n * @public\r\n */\r\nexport interface CreateIModelProps extends IModelProps {\r\n /** The GUID of new iModel. If not present, a GUID will be generated. */\r\n readonly guid?: GuidString;\r\n /** Client name for new iModel */\r\n readonly client?: string;\r\n /** Thumbnail for new iModel\r\n * @alpha\r\n */\r\n readonly thumbnail?: ThumbnailProps;\r\n}\r\n\r\n/**\r\n * Sqlite options.\r\n * @public\r\n */\r\nexport interface OpenSqliteArgs {\r\n /**\r\n * Specify timeout after which SQLite stop retrying to acquire lock to database file and throw SQLITE_BUSY error.\r\n * Timeout is specified in milliseconds.\r\n * For more information https://www.sqlite.org/c3ref/busy_timeout.html.\r\n * */\r\n readonly busyTimeout?: number;\r\n}\r\n\r\n/**\r\n * A key used to identify an opened [IModelDb]($backend) between the frontend and backend for Rpc and Ipc communications.\r\n * Keys must be unique - that is there can never be two IModelDbs opened with the same key at any given time.\r\n * If no key is supplied in a call to open an IModelDb, one is generated and returned.\r\n * It is only necessary to supply a key if you have some reason to assign a specific value to identify an IModelDb.\r\n * If you don't supply the key, you must use the returned value for Rpc and Ipc communications.\r\n * @public\r\n */\r\nexport interface OpenDbKey {\r\n readonly key?: string;\r\n}\r\n\r\n/** @beta TODO documentation */\r\nexport interface CloudContainerUri {\r\n readonly uriParams: string;\r\n}\r\n\r\n/** Options to open a [SnapshotDb]($backend).\r\n * @public\r\n */\r\nexport interface SnapshotOpenOptions extends OpenDbKey {\r\n /**\r\n * The \"base\" name that can be used for creating temporary files related to this Db.\r\n * The string should be a name related to the current Db filename using some known pattern so that all files named \"baseName*\" can be deleted externally during cleanup.\r\n * It must be the name of a file (that may or may not exist) in a writable directory.\r\n * If not present, the baseName will default to the database's file name (including the path).\r\n * @internal\r\n */\r\n readonly tempFileBase?: string;\r\n}\r\n\r\n/** Options to open a [StandaloneDb]($backend) via [StandaloneDb.openFile]($backend) from the backend,\r\n * or [BriefcaseConnection.openStandalone]($frontend) from the frontend.\r\n * @public\r\n */\r\nexport type StandaloneOpenOptions = OpenDbKey;\r\n\r\n/** Options that can be supplied when creating snapshot iModels.\r\n * @public\r\n */\r\nexport interface CreateSnapshotIModelProps {\r\n /** If true, then create SQLite views for Model, Element, ElementAspect, and Relationship classes.\r\n * These database views can often be useful for interoperability workflows.\r\n */\r\n readonly createClassViews?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* snapshot iModel.\r\n * @see [SnapshotDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptySnapshotIModelProps = CreateIModelProps & CreateSnapshotIModelProps;\r\n\r\n/** Options that can be supplied when creating standalone iModels.\r\n * @public\r\n */\r\nexport interface CreateStandaloneIModelProps {\r\n /** If present, file will allow local editing, but cannot be used to create changesets.\r\n * @note This flag is a string for historical reasons. When specified, it will always be set to the required\r\n * internal value `{ \"txns\": true }` regardless of the string content provided. This behavior ensures backwards\r\n * compatibility while allowing users to enable transaction support.\r\n * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.\r\n * @deprecated in 5.5 - will not be removed until after 2027-01-05. Use [[enableTransactions]] instead.\r\n */\r\n readonly allowEdit?: string;\r\n /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.\r\n * This is the preferred way to enable editing. If both this and [[allowEdit]] are specified, either being truthy will enable transactions.\r\n */\r\n readonly enableTransactions?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* standalone iModel.\r\n * @see [StandaloneDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptyStandaloneIModelProps = CreateIModelProps & CreateStandaloneIModelProps;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FilePropertyProps {\r\n readonly namespace: string;\r\n readonly name: string;\r\n id?: number | string;\r\n subId?: number | string;\r\n}\r\n\r\n/** The position and orientation of an iModel on the earth in [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * @note This is an immutable type - all of its properties are frozen.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport class EcefLocation implements EcefLocationProps {\r\n /** The origin of the ECEF transform. */\r\n public readonly origin: Point3d;\r\n /** The orientation of the ECEF transform */\r\n public readonly orientation: YawPitchRollAngles;\r\n /** Optional position on the earth used to establish the ECEF origin and orientation. */\r\n public readonly cartographicOrigin?: Cartographic;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly xVector?: Vector3d;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly yVector?: Vector3d;\r\n /** The transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n private readonly _transform: Transform = Transform.createIdentity();\r\n\r\n /** Get the transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n public getTransform(): Transform { return this._transform; }\r\n\r\n /** Construct a new EcefLocation. Once constructed, it is frozen and cannot be modified. */\r\n constructor(props: EcefLocationProps) {\r\n this.origin = Point3d.fromJSON(props.origin).freeze();\r\n this.orientation = YawPitchRollAngles.fromJSON(props.orientation).freeze();\r\n if (props.cartographicOrigin)\r\n this.cartographicOrigin = Cartographic.fromRadians({ longitude: props.cartographicOrigin.longitude, latitude: props.cartographicOrigin.latitude, height: props.cartographicOrigin.height }).freeze();\r\n if (props.xVector && props.yVector) {\r\n this.xVector = Vector3d.fromJSON(props.xVector).freeze();\r\n this.yVector = Vector3d.fromJSON(props.yVector).freeze();\r\n }\r\n if (props.transform) {\r\n this._transform.setFromJSON(props.transform);\r\n this._transform.freeze();\r\n } else {\r\n let matrix;\r\n if (this.xVector && this.yVector) {\r\n const zVector = this.xVector.crossProduct(this.yVector);\r\n if (zVector.normalizeInPlace())\r\n matrix = Matrix3d.createColumns(this.xVector, this.yVector, zVector);\r\n }\r\n if (!matrix)\r\n matrix = this.orientation.toMatrix3d();\r\n\r\n this._transform = Transform.createOriginAndMatrix(this.origin, matrix);\r\n this._transform.freeze();\r\n }\r\n }\r\n\r\n /** Returns true if this EcefLocation is not located at the center of the Earth.\r\n * @alpha are locations very close to the center considered valid? What are the specific criteria?\r\n */\r\n public get isValid(): boolean {\r\n return !this.origin.isZero;\r\n }\r\n\r\n /** Construct ECEF Location from cartographic origin with optional known point and angle. */\r\n public static createFromCartographicOrigin(origin: Cartographic, point?: Point3d, angle?: Angle) {\r\n const ecefOrigin = origin.toEcef();\r\n const deltaRadians = 10 / Constant.earthRadiusWGS84.polar;\r\n const northCarto = Cartographic.fromRadians({ longitude: origin.longitude, latitude: origin.latitude + deltaRadians, height: origin.height });\r\n const eastCarto = Cartographic.fromRadians({ longitude: origin.longitude + deltaRadians, latitude: origin.latitude, height: origin.height });\r\n const ecefNorth = northCarto.toEcef();\r\n const ecefEast = eastCarto.toEcef();\r\n const xVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefEast).normalize());\r\n const yVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefNorth).normalize());\r\n const matrix = expectDefined(Matrix3d.createRigidFromColumns(xVector, yVector, AxisOrder.XYZ));\r\n if (angle !== undefined) {\r\n const north = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, angle);\r\n matrix.multiplyMatrixMatrix(north, matrix);\r\n }\r\n if (point !== undefined) {\r\n const delta = matrix.multiplyVector(Vector3d.create(-point.x, -point.y, -point.z));\r\n ecefOrigin.addInPlace(delta);\r\n }\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: expectDefined(YawPitchRollAngles.createFromMatrix3d(matrix)), cartographicOrigin: origin });\r\n }\r\n\r\n /** Construct ECEF Location from transform with optional position on the earth used to establish the ECEF origin and orientation. */\r\n public static createFromTransform(transform: Transform): EcefLocation {\r\n const ecefOrigin = transform.getOrigin();\r\n const angleFromInput = YawPitchRollAngles.createDegrees(0, 0, 0);\r\n const locationOrientationFromInputT = YawPitchRollAngles.createFromMatrix3d(transform.getMatrix(), angleFromInput);\r\n const transformProps = transform.toJSON();\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: locationOrientationFromInputT ?? angleFromInput, transform: transformProps });\r\n }\r\n\r\n /** Get the location center of the earth in the iModel coordinate system. */\r\n public get earthCenter(): Point3d {\r\n const matrix = this.orientation.toMatrix3d();\r\n return Point3d.createFrom(matrix.multiplyTransposeXYZ(-this.origin.x, -this.origin.y, -this.origin.z));\r\n }\r\n\r\n /** Return true if this location is equivalent to another location within a small tolerance. */\r\n public isAlmostEqual(other: EcefLocation): boolean {\r\n if (!this.origin.isAlmostEqual(other.origin) || !this.orientation.isAlmostEqual(other.orientation))\r\n return false;\r\n\r\n if ((this.xVector === undefined) !== (other.xVector === undefined) || (this.yVector === undefined) !== (other.yVector === undefined))\r\n return false;\r\n\r\n if (this.xVector !== undefined && other.xVector !== undefined && !this.xVector.isAlmostEqual(other.xVector))\r\n return false;\r\n\r\n if (this.yVector !== undefined && other.yVector !== undefined && !this.yVector.isAlmostEqual(other.yVector))\r\n return false;\r\n\r\n if (!this.getTransform().isAlmostEqual(other.getTransform()))\r\n return false;\r\n\r\n const thisCarto = this.cartographicOrigin;\r\n const otherCarto = other.cartographicOrigin;\r\n if (undefined === thisCarto || undefined === otherCarto)\r\n return undefined === thisCarto && undefined === otherCarto;\r\n\r\n return thisCarto.equalsEpsilon(otherCarto, Geometry.smallMetricDistance);\r\n }\r\n\r\n public toJSON(): EcefLocationProps {\r\n const props: Mutable<EcefLocationProps> = {\r\n origin: this.origin.toJSON(),\r\n orientation: this.orientation.toJSON(),\r\n transform: this.getTransform().toJSON(),\r\n };\r\n\r\n if (this.cartographicOrigin)\r\n props.cartographicOrigin = this.cartographicOrigin.toJSON();\r\n\r\n if (this.xVector)\r\n props.xVector = this.xVector.toJSON();\r\n\r\n if (this.yVector)\r\n props.yVector = this.yVector.toJSON();\r\n\r\n return props;\r\n }\r\n}\r\n\r\n/** Represents an iModel in JavaScript.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport abstract class IModel implements IModelProps {\r\n private _projectExtents?: AxisAlignedBox3d;\r\n private _name?: string;\r\n private _rootSubject?: RootSubjectProps;\r\n private _globalOrigin?: Point3d;\r\n private _ecefLocation?: EcefLocation;\r\n private _geographicCoordinateSystem?: GeographicCRS;\r\n private _iModelId?: GuidString;\r\n private _changeset: ChangesetIdWithIndex;\r\n\r\n /** The Id of the repository model. */\r\n public static readonly repositoryModelId: Id64String = \"0x1\";\r\n /** The Id of the root subject element. */\r\n public static readonly rootSubjectId: Id64String = \"0x1\";\r\n /** The Id of the dictionary model. */\r\n public static readonly dictionaryId: Id64String = \"0x10\";\r\n\r\n /** Event raised after [[name]] changes. */\r\n public readonly onNameChanged = new BeEvent<(previousName: string) => void>();\r\n /** Event raised after [[rootSubject]] changes. */\r\n public readonly onRootSubjectChanged = new BeEvent<(previousSubject: RootSubjectProps) => void>();\r\n /** Event raised after [[projectExtents]] changes. */\r\n public readonly onProjectExtentsChanged = new BeEvent<(previousExtents: AxisAlignedBox3d) => void>();\r\n /** Event raised after [[globalOrigin]] changes. */\r\n public readonly onGlobalOriginChanged = new BeEvent<(previousOrigin: Point3d) => void>();\r\n /** Event raised after [[ecefLocation]] changes. */\r\n public readonly onEcefLocationChanged = new BeEvent<(previousLocation: EcefLocation | undefined) => void>();\r\n /** Event raised after [[geographicCoordinateSystem]] changes. */\r\n public readonly onGeographicCoordinateSystemChanged = new BeEvent<(previousGCS: GeographicCRS | undefined) => void>();\r\n /** Event raised after [[changeset]] changes. */\r\n public readonly onChangesetChanged = new BeEvent<(previousChangeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Name of the iModel */\r\n public get name(): string {\r\n assert(this._name !== undefined);\r\n return this._name;\r\n }\r\n public set name(name: string) {\r\n if (name !== this._name) {\r\n const old = this._name;\r\n this._name = name;\r\n if (undefined !== old)\r\n this.onNameChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The name and description of the root subject of this iModel */\r\n public get rootSubject(): RootSubjectProps {\r\n assert(this._rootSubject !== undefined);\r\n return this._rootSubject;\r\n }\r\n public set rootSubject(subject: RootSubjectProps) {\r\n if (undefined === this._rootSubject || this._rootSubject.name !== subject.name || this._rootSubject.description !== subject.description) {\r\n const old = this._rootSubject;\r\n this._rootSubject = subject;\r\n if (old)\r\n this.onRootSubjectChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** Returns `true` if this is a snapshot iModel. */\r\n public abstract get isSnapshot(): boolean;\r\n /** Returns `true` if this is a briefcase copy of an iModel that is synchronized with iModelHub. */\r\n public abstract get isBriefcase(): boolean;\r\n\r\n public abstract get isOpen(): boolean;\r\n\r\n /**\r\n * The volume, in spatial coordinates, inside which the entire project is contained.\r\n * @note The object returned from this method is frozen. You *must* make a copy before you do anything that might attempt to modify it.\r\n */\r\n public get projectExtents() {\r\n assert(undefined !== this._projectExtents);\r\n return this._projectExtents;\r\n }\r\n public set projectExtents(extents: AxisAlignedBox3d) {\r\n // Don't allow any axis of the project extents to be less than 1 meter.\r\n const projectExtents = extents.clone();\r\n projectExtents.ensureMinLengths(1.0);\r\n if (!this._projectExtents || !this._projectExtents.isAlmostEqual(projectExtents)) {\r\n const old = this._projectExtents;\r\n projectExtents.freeze();\r\n this._projectExtents = projectExtents;\r\n if (old)\r\n this.onProjectExtentsChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** An offset to be applied to all spatial coordinates. */\r\n public get globalOrigin(): Point3d {\r\n assert(this._globalOrigin !== undefined);\r\n return this._globalOrigin;\r\n }\r\n public set globalOrigin(org: Point3d) {\r\n if (!this._globalOrigin || !this._globalOrigin.isAlmostEqual(org)) {\r\n const old = this._globalOrigin;\r\n org.freeze();\r\n this._globalOrigin = org;\r\n if (old)\r\n this.onGlobalOriginChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The [EcefLocation]($docs/learning/glossary#ecefLocation) of the iModel in Earth Centered Earth Fixed coordinates.\r\n * If the iModel property geographicCoordinateSystem is not defined then the ecefLocation provides a geolocation by defining a\r\n * 3D coordinate system relative to the Earth model WGS84. Refer to additional documentation for details. If the geographicCoordinateSystem\r\n * property is defined then the ecefLocation must be used with care. When the geographicCoordinateSystem is defined it indicates the\r\n * iModel cartesian space is the result of a cartographic projection. This implies a flattening of the Earth surface process that\r\n * results in scale, angular or area distortion. The ecefLocation is then an approximation calculated at the center of the project extent.\r\n * If the project is more than 2 kilometer in size, the ecefLocation may represent a poor approximation of the effective\r\n * cartographic projection used and a linear transformation should then be calculated at the exact origin of the data\r\n * it must position.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n */\r\n public get ecefLocation(): EcefLocation | undefined {\r\n return this._ecefLocation;\r\n }\r\n public set ecefLocation(ecefLocation: EcefLocation | undefined) {\r\n const old = this._ecefLocation;\r\n if (!old && !ecefLocation)\r\n return;\r\n else if (old && ecefLocation && old.isAlmostEqual(ecefLocation))\r\n return;\r\n\r\n this._ecefLocation = ecefLocation;\r\n this.onEcefLocationChanged.raiseEvent(old);\r\n }\r\n\r\n /** Set the [EcefLocation]($docs/learning/glossary#ecefLocation) for this iModel. */\r\n public setEcefLocation(ecef: EcefLocationProps): void {\r\n this.ecefLocation = new EcefLocation(ecef);\r\n }\r\n\r\n /** The geographic coordinate reference system of the iModel. */\r\n public get geographicCoordinateSystem(): GeographicCRS | undefined {\r\n return this._geographicCoordinateSystem;\r\n }\r\n public set geographicCoordinateSystem(geoCRS: GeographicCRS | undefined) {\r\n const old = this._geographicCoordinateSystem;\r\n if (!old && !geoCRS)\r\n return;\r\n else if (old && geoCRS && old.equals(geoCRS))\r\n return;\r\n\r\n this._geographicCoordinateSystem = geoCRS;\r\n this.onGeographicCoordinateSystemChanged.raiseEvent(old);\r\n }\r\n\r\n /** Sets the geographic coordinate reference system from GeographicCRSProps. */\r\n public setGeographicCoordinateSystem(geoCRS: GeographicCRSProps) {\r\n this.geographicCoordinateSystem = new GeographicCRS(geoCRS);\r\n }\r\n\r\n /** @internal */\r\n public getConnectionProps(): IModelConnectionProps {\r\n return {\r\n name: this.name,\r\n rootSubject: this.rootSubject,\r\n projectExtents: this.projectExtents.toJSON(),\r\n globalOrigin: this.globalOrigin.toJSON(),\r\n ecefLocation: this.ecefLocation,\r\n geographicCoordinateSystem: this.geographicCoordinateSystem?.toJSON(),\r\n ...this._getRpcProps(),\r\n };\r\n }\r\n\r\n /** Convert this iModel to a JSON representation. */\r\n public toJSON(): IModelConnectionProps {\r\n return this.getConnectionProps();\r\n }\r\n\r\n /** A key used to identify this iModel in RPC calls from frontend to backend.\r\n * @internal\r\n */\r\n protected _fileKey: string;\r\n /** Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications. */\r\n public get key(): string { return this._fileKey; }\r\n\r\n /** @internal */\r\n protected _iTwinId?: GuidString;\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public get iTwinId(): GuidString | undefined { return this._iTwinId; }\r\n\r\n /** The Guid that identifies this iModel. */\r\n public get iModelId(): GuidString | undefined { return this._iModelId; }\r\n\r\n /** @public */\r\n public get changeset(): ChangesetIdWithIndex {\r\n return { ...this._changeset };\r\n }\r\n public set changeset(changeset: ChangesetIdWithIndex) {\r\n const prev = this._changeset;\r\n if (prev.id !== changeset.id || prev.index !== changeset.index) {\r\n this._changeset = { id: changeset.id, index: changeset.index };\r\n this.onChangesetChanged.raiseEvent(prev);\r\n }\r\n }\r\n\r\n protected _openMode = OpenMode.Readonly;\r\n /** The [[OpenMode]] used for this IModel. */\r\n public get openMode(): OpenMode { return this._openMode; }\r\n\r\n /** Return a token for RPC operations.\r\n * @throws IModelError if the iModel is not open.\r\n */\r\n public getRpcProps(): IModelRpcProps {\r\n if (!this.isOpen)\r\n throw new IModelError(IModelStatus.BadRequest, \"IModel is not open for rpc\");\r\n\r\n return this._getRpcProps();\r\n }\r\n\r\n /** Returns the iModel's RPC properties.\r\n * @note It is an error to attempt to use these properties as a token for RPC operations if the iModel is not open.\r\n * @internal\r\n */\r\n protected _getRpcProps(): IModelRpcProps {\r\n return {\r\n key: this._fileKey,\r\n iTwinId: this.iTwinId,\r\n iModelId: this.iModelId,\r\n changeset: this.changeset,\r\n };\r\n }\r\n\r\n /** @internal */\r\n protected constructor(tokenProps?: IModelRpcProps) {\r\n this._changeset = tokenProps?.changeset ?? { id: \"\", index: 0 };\r\n this._fileKey = \"\";\r\n if (tokenProps) {\r\n this._fileKey = tokenProps.key;\r\n this._iTwinId = tokenProps.iTwinId;\r\n this._iModelId = tokenProps.iModelId;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected initialize(name: string, props: IModelProps) {\r\n this.name = name;\r\n this.rootSubject = props.rootSubject;\r\n this.projectExtents = Range3d.fromJSON(props.projectExtents);\r\n this.globalOrigin = Point3d.fromJSON(props.globalOrigin);\r\n\r\n const ecefLocation = props.ecefLocation ? new EcefLocation(props.ecefLocation) : undefined;\r\n this.ecefLocation = ecefLocation?.isValid ? ecefLocation : undefined;\r\n\r\n this.geographicCoordinateSystem = props.geographicCoordinateSystem ? new GeographicCRS(props.geographicCoordinateSystem) : undefined;\r\n }\r\n\r\n /** Get the default subCategoryId for the supplied categoryId */\r\n public static getDefaultSubCategoryId(categoryId: Id64String): Id64String {\r\n return Id64.isValid(categoryId) ? Id64.fromLocalAndBriefcaseIds(Id64.getLocalId(categoryId) + 1, Id64.getBriefcaseId(categoryId)) : Id64.invalid;\r\n }\r\n\r\n /** True if this iModel has an [EcefLocation]($docs/learning/glossary#ecefLocation). */\r\n public get isGeoLocated() { return undefined !== this._ecefLocation; }\r\n\r\n /** Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its [[IModel.ecefLocation]].\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public getEcefTransform(): Transform {\r\n if (undefined === this._ecefLocation)\r\n throw new IModelError(GeoServiceStatus.NoGeoLocation, \"iModel is not GeoLocated\");\r\n return this._ecefLocation.getTransform();\r\n }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to an ECEF point using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in ECEF coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d { return this.getEcefTransform().multiplyPoint3d(spatial, result); }\r\n\r\n /** Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its [[ecefLocation]].\r\n * @param ecef A point in ECEF coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d { return expectDefined(this.getEcefTransform().multiplyInversePoint3d(ecef, result)); }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Cartographic location\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic { return expectDefined(Cartographic.fromEcef(this.spatialToEcef(spatial), result)); }\r\n\r\n /** Convert a [[Cartographic]] to a point in this iModel's Spatial coordinates using its [[IModel.ecefLocation]].\r\n * @param cartographic A cartographic location\r\n * @param result If defined, use this for output\r\n * @returns A point in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d) { return this.ecefToSpatial(cartographic.toEcef(result), result); }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../src/IModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsJ;AACtJ,wDAG8B;AAE9B,0DAA0E;AAC1E,oFAAyF;AAEzF,+CAA4C;AAmN5C;;;;GAIG;AACH,MAAa,YAAY;IACvB,wCAAwC;IACxB,MAAM,CAAU;IAChC,4CAA4C;IAC5B,WAAW,CAAqB;IAChD,wFAAwF;IACxE,kBAAkB,CAAgB;IAClD,8HAA8H;IAC9G,OAAO,CAAY;IACnC,8HAA8H;IAC9G,OAAO,CAAY;IACnC,mFAAmF;IAClE,UAAU,GAAc,yBAAS,CAAC,cAAc,EAAE,CAAC;IAEpE,uFAAuF;IAChF,YAAY,KAAgB,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAE5D,2FAA2F;IAC3F,YAAY,KAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QACtD,IAAI,CAAC,WAAW,GAAG,kCAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3E,IAAI,KAAK,CAAC,kBAAkB;YAC1B,IAAI,CAAC,kBAAkB,GAAG,2BAAY,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,K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KG;IACI,6BAA6B,CAAC,OAAe,EAAE,MAAqB,IAAkB,OAAO,IAAA,4BAAa,EAAC,2BAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhL;;;;;;OAMG;IACI,6BAA6B,CAAC,YAA0B,EAAE,MAAgB,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;AA1SxJ,wBA2SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, BeEvent, expectDefined, GeoServiceStatus, GuidString, Id64, Id64String, IModelStatus, Mutable, OpenMode } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AxisIndex, AxisOrder, Constant, Geometry, Matrix3d, Point3d, Range3d, Range3dProps, Transform, TransformProps, Vector3d, XYAndZ, XYZProps,\r\n YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ChangesetIdWithIndex } from \"./ChangesetProps\";\r\nimport { Cartographic, CartographicProps } from \"./geometry/Cartographic\";\r\nimport { GeographicCRS, GeographicCRSProps } from \"./geometry/CoordinateReferenceSystem\";\r\nimport { AxisAlignedBox3d } from \"./geometry/Placement\";\r\nimport { IModelError } from \"./IModelError\";\r\nimport { ThumbnailProps } from \"./Thumbnail\";\r\n\r\n/** The properties to open a connection to an iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcOpenProps {\r\n /** The iTwin in which the iModel exists - must be defined for briefcases that are synchronized with iModelHub. */\r\n readonly iTwinId?: GuidString;\r\n /** Guid of the iModel. */\r\n readonly iModelId?: GuidString;\r\n\r\n /** Id of the last Changeset that was applied to the iModel - must be defined for briefcases that are synchronized with iModelHub.\r\n * @note Changeset Ids are string hash values based on the content and parent.\r\n */\r\n readonly changeset?: ChangesetIdWithIndex;\r\n}\r\n\r\n/** The properties that identify an opened iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcProps extends IModelRpcOpenProps {\r\n /** Unique key used for identifying the iModel between the frontend and the backend */\r\n readonly key: string;\r\n}\r\n\r\n/** Properties that position an iModel on the earth via [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * The origin is specified as an ECEF coordinate. The cartographicOrigin property contains the latitude, longitude and elevation above the WGS84 ellipsoid\r\n * of the origin property. This cartographicOrigin is offered as a convenient pre-calculated value representing the location of the ECEF origin.\r\n * The 3D coordinate system this class represents is positioned at specified origin and the axis positioned according to\r\n * the other properties.\r\n * If transform property is defined then it will not be computed from other properties.\r\n * If the xVector and yVector properties are defined (and transform is not defined) then they take precedence over the YawPitchRoll orientation property. The xVector and yVector\r\n * represent the direction and scale of the X and Y axes. The Z axis is always perpendicular (according to the right hand rule) to these X-Y axes.\r\n * The scaling in the Z direction is always unity. The scale of the X and Y axes is represented by the size of the vector length.\r\n * If the xVector and yVector are not present then the YawPitchRoll properties indicates the angles for all tree axes. Scaling in that case\r\n * is unity in all three directions.\r\n * Note that the present class is intended to represent geolocated 3D coordinate systems that are normally tangent to the WGS84 ellipsoid\r\n * possibly offset in altitude by the terrain elevation above the ellipsoid but other general 3D coordinate systems\r\n * can be defined.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface EcefLocationProps {\r\n /** The Origin of an iModel on the earth in ECEF coordinates */\r\n readonly origin: XYZProps;\r\n /** The [orientation](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion) of an iModel on the earth. */\r\n readonly orientation: YawPitchRollProps;\r\n /** Optional position on the earth used to establish the ECEF coordinates. */\r\n readonly cartographicOrigin?: CartographicProps;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly xVector?: XYZProps;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly yVector?: XYZProps;\r\n /** Optional potentially non-rigid transform defining the ECEF location.\r\n * @note If this property is supplied, the other properties are ignored.\r\n */\r\n readonly transform?: TransformProps;\r\n}\r\n\r\n/** Properties of the [Root Subject]($docs/bis/guide/references/glossary#subject-root).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RootSubjectProps {\r\n /** The name of the root subject. */\r\n readonly name: string;\r\n /** Description of the root subject (optional). */\r\n readonly description?: string;\r\n}\r\n\r\n/** Properties of an iModel that are always held in memory whenever one is opened, both on the frontend and on the backend .\r\n * @public\r\n */\r\nexport interface IModelProps {\r\n /** The name and description of the root subject of this iModel */\r\n readonly rootSubject: RootSubjectProps;\r\n /** The volume of the entire project, in spatial coordinates */\r\n readonly projectExtents?: Range3dProps;\r\n /** An offset to be applied to all spatial coordinates. This is normally used to transform spatial coordinates into the Cartesian coordinate system of a Geographic Coordinate System. */\r\n readonly globalOrigin?: XYZProps;\r\n /** The location of the iModel in Earth Centered Earth Fixed coordinates. iModel units are always meters */\r\n readonly ecefLocation?: EcefLocationProps;\r\n /** The Geographic Coordinate Reference System indicating the projection and datum used. */\r\n readonly geographicCoordinateSystem?: GeographicCRSProps;\r\n /** The name of the iModel. */\r\n readonly name?: string;\r\n}\r\n\r\n/** The properties returned by the backend when creating a new [[IModelConnection]] from the frontend, either with Rpc or with Ipc.\r\n * These properties describe the iModel held on the backend for thew newly formed connection and are used to construct a new\r\n * [[IModelConnection]] instance on the frontend to access it.\r\n * @public\r\n */\r\nexport type IModelConnectionProps = IModelProps & IModelRpcProps;\r\n\r\n/** The properties that can be supplied when creating a *new* iModel.\r\n * @public\r\n */\r\nexport interface CreateIModelProps extends IModelProps {\r\n /** The GUID of new iModel. If not present, a GUID will be generated. */\r\n readonly guid?: GuidString;\r\n /** Client name for new iModel */\r\n readonly client?: string;\r\n /** Thumbnail for new iModel\r\n * @alpha\r\n */\r\n readonly thumbnail?: ThumbnailProps;\r\n}\r\n\r\n/**\r\n * Sqlite options.\r\n * @public\r\n */\r\nexport interface OpenSqliteArgs {\r\n /**\r\n * Specify timeout after which SQLite stop retrying to acquire lock to database file and throw SQLITE_BUSY error.\r\n * Timeout is specified in milliseconds.\r\n * For more information https://www.sqlite.org/c3ref/busy_timeout.html.\r\n * */\r\n readonly busyTimeout?: number;\r\n}\r\n\r\n/**\r\n * A key used to identify an opened [IModelDb]($backend) between the frontend and backend for Rpc and Ipc communications.\r\n * Keys must be unique - that is there can never be two IModelDbs opened with the same key at any given time.\r\n * If no key is supplied in a call to open an IModelDb, one is generated and returned.\r\n * It is only necessary to supply a key if you have some reason to assign a specific value to identify an IModelDb.\r\n * If you don't supply the key, you must use the returned value for Rpc and Ipc communications.\r\n * @public\r\n */\r\nexport interface OpenDbKey {\r\n readonly key?: string;\r\n}\r\n\r\n/** @beta TODO documentation */\r\nexport interface CloudContainerUri {\r\n readonly uriParams: string;\r\n}\r\n\r\n/** Options to open a [SnapshotDb]($backend).\r\n * @public\r\n */\r\nexport interface SnapshotOpenOptions extends OpenDbKey {\r\n /**\r\n * The \"base\" name that can be used for creating temporary files related to this Db.\r\n * The string should be a name related to the current Db filename using some known pattern so that all files named \"baseName*\" can be deleted externally during cleanup.\r\n * It must be the name of a file (that may or may not exist) in a writable directory.\r\n * If not present, the baseName will default to the database's file name (including the path).\r\n * @internal\r\n */\r\n readonly tempFileBase?: string;\r\n}\r\n\r\n/** Options to open a [StandaloneDb]($backend) via [StandaloneDb.openFile]($backend) from the backend,\r\n * or [BriefcaseConnection.openStandalone]($frontend) from the frontend.\r\n * @public\r\n */\r\nexport type StandaloneOpenOptions = OpenDbKey;\r\n\r\n/** Options that can be supplied when creating snapshot iModels.\r\n * @public\r\n */\r\nexport interface CreateSnapshotIModelProps {\r\n /** If true, then create SQLite views for Model, Element, ElementAspect, and Relationship classes.\r\n * These database views can often be useful for interoperability workflows.\r\n */\r\n readonly createClassViews?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* snapshot iModel.\r\n * @see [SnapshotDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptySnapshotIModelProps = CreateIModelProps & CreateSnapshotIModelProps;\r\n\r\n/** Options that can be supplied when creating standalone iModels.\r\n * @public\r\n */\r\nexport interface CreateStandaloneIModelProps {\r\n /** If present, file will allow local editing, but cannot be used to create changesets.\r\n * @note This flag is a string for historical reasons. When specified, it will always be set to the required\r\n * internal value `{ \"txns\": true }` regardless of the string content provided. This behavior ensures backwards\r\n * compatibility while allowing users to enable transaction support.\r\n * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.\r\n * @deprecated in 5.5. Use [[enableTransactions]] instead.\r\n */\r\n readonly allowEdit?: string;\r\n /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.\r\n * This is the preferred way to enable editing. If both this and [[allowEdit]] are specified, either being truthy will enable transactions.\r\n */\r\n readonly enableTransactions?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* standalone iModel.\r\n * @see [StandaloneDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptyStandaloneIModelProps = CreateIModelProps & CreateStandaloneIModelProps;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FilePropertyProps {\r\n readonly namespace: string;\r\n readonly name: string;\r\n id?: number | string;\r\n subId?: number | string;\r\n}\r\n\r\n/** The position and orientation of an iModel on the earth in [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * @note This is an immutable type - all of its properties are frozen.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport class EcefLocation implements EcefLocationProps {\r\n /** The origin of the ECEF transform. */\r\n public readonly origin: Point3d;\r\n /** The orientation of the ECEF transform */\r\n public readonly orientation: YawPitchRollAngles;\r\n /** Optional position on the earth used to establish the ECEF origin and orientation. */\r\n public readonly cartographicOrigin?: Cartographic;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly xVector?: Vector3d;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly yVector?: Vector3d;\r\n /** The transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n private readonly _transform: Transform = Transform.createIdentity();\r\n\r\n /** Get the transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n public getTransform(): Transform { return this._transform; }\r\n\r\n /** Construct a new EcefLocation. Once constructed, it is frozen and cannot be modified. */\r\n constructor(props: EcefLocationProps) {\r\n this.origin = Point3d.fromJSON(props.origin).freeze();\r\n this.orientation = YawPitchRollAngles.fromJSON(props.orientation).freeze();\r\n if (props.cartographicOrigin)\r\n this.cartographicOrigin = Cartographic.fromRadians({ longitude: props.cartographicOrigin.longitude, latitude: props.cartographicOrigin.latitude, height: props.cartographicOrigin.height }).freeze();\r\n if (props.xVector && props.yVector) {\r\n this.xVector = Vector3d.fromJSON(props.xVector).freeze();\r\n this.yVector = Vector3d.fromJSON(props.yVector).freeze();\r\n }\r\n if (props.transform) {\r\n this._transform.setFromJSON(props.transform);\r\n this._transform.freeze();\r\n } else {\r\n let matrix;\r\n if (this.xVector && this.yVector) {\r\n const zVector = this.xVector.crossProduct(this.yVector);\r\n if (zVector.normalizeInPlace())\r\n matrix = Matrix3d.createColumns(this.xVector, this.yVector, zVector);\r\n }\r\n if (!matrix)\r\n matrix = this.orientation.toMatrix3d();\r\n\r\n this._transform = Transform.createOriginAndMatrix(this.origin, matrix);\r\n this._transform.freeze();\r\n }\r\n }\r\n\r\n /** Returns true if this EcefLocation is not located at the center of the Earth.\r\n * @alpha are locations very close to the center considered valid? What are the specific criteria?\r\n */\r\n public get isValid(): boolean {\r\n return !this.origin.isZero;\r\n }\r\n\r\n /** Construct ECEF Location from cartographic origin with optional known point and angle. */\r\n public static createFromCartographicOrigin(origin: Cartographic, point?: Point3d, angle?: Angle) {\r\n const ecefOrigin = origin.toEcef();\r\n const deltaRadians = 10 / Constant.earthRadiusWGS84.polar;\r\n const northCarto = Cartographic.fromRadians({ longitude: origin.longitude, latitude: origin.latitude + deltaRadians, height: origin.height });\r\n const eastCarto = Cartographic.fromRadians({ longitude: origin.longitude + deltaRadians, latitude: origin.latitude, height: origin.height });\r\n const ecefNorth = northCarto.toEcef();\r\n const ecefEast = eastCarto.toEcef();\r\n const xVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefEast).normalize());\r\n const yVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefNorth).normalize());\r\n const matrix = expectDefined(Matrix3d.createRigidFromColumns(xVector, yVector, AxisOrder.XYZ));\r\n if (angle !== undefined) {\r\n const north = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, angle);\r\n matrix.multiplyMatrixMatrix(north, matrix);\r\n }\r\n if (point !== undefined) {\r\n const delta = matrix.multiplyVector(Vector3d.create(-point.x, -point.y, -point.z));\r\n ecefOrigin.addInPlace(delta);\r\n }\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: expectDefined(YawPitchRollAngles.createFromMatrix3d(matrix)), cartographicOrigin: origin });\r\n }\r\n\r\n /** Construct ECEF Location from transform with optional position on the earth used to establish the ECEF origin and orientation. */\r\n public static createFromTransform(transform: Transform): EcefLocation {\r\n const ecefOrigin = transform.getOrigin();\r\n const angleFromInput = YawPitchRollAngles.createDegrees(0, 0, 0);\r\n const locationOrientationFromInputT = YawPitchRollAngles.createFromMatrix3d(transform.getMatrix(), angleFromInput);\r\n const transformProps = transform.toJSON();\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: locationOrientationFromInputT ?? angleFromInput, transform: transformProps });\r\n }\r\n\r\n /** Get the location center of the earth in the iModel coordinate system. */\r\n public get earthCenter(): Point3d {\r\n const matrix = this.orientation.toMatrix3d();\r\n return Point3d.createFrom(matrix.multiplyTransposeXYZ(-this.origin.x, -this.origin.y, -this.origin.z));\r\n }\r\n\r\n /** Return true if this location is equivalent to another location within a small tolerance. */\r\n public isAlmostEqual(other: EcefLocation): boolean {\r\n if (!this.origin.isAlmostEqual(other.origin) || !this.orientation.isAlmostEqual(other.orientation))\r\n return false;\r\n\r\n if ((this.xVector === undefined) !== (other.xVector === undefined) || (this.yVector === undefined) !== (other.yVector === undefined))\r\n return false;\r\n\r\n if (this.xVector !== undefined && other.xVector !== undefined && !this.xVector.isAlmostEqual(other.xVector))\r\n return false;\r\n\r\n if (this.yVector !== undefined && other.yVector !== undefined && !this.yVector.isAlmostEqual(other.yVector))\r\n return false;\r\n\r\n if (!this.getTransform().isAlmostEqual(other.getTransform()))\r\n return false;\r\n\r\n const thisCarto = this.cartographicOrigin;\r\n const otherCarto = other.cartographicOrigin;\r\n if (undefined === thisCarto || undefined === otherCarto)\r\n return undefined === thisCarto && undefined === otherCarto;\r\n\r\n return thisCarto.equalsEpsilon(otherCarto, Geometry.smallMetricDistance);\r\n }\r\n\r\n public toJSON(): EcefLocationProps {\r\n const props: Mutable<EcefLocationProps> = {\r\n origin: this.origin.toJSON(),\r\n orientation: this.orientation.toJSON(),\r\n transform: this.getTransform().toJSON(),\r\n };\r\n\r\n if (this.cartographicOrigin)\r\n props.cartographicOrigin = this.cartographicOrigin.toJSON();\r\n\r\n if (this.xVector)\r\n props.xVector = this.xVector.toJSON();\r\n\r\n if (this.yVector)\r\n props.yVector = this.yVector.toJSON();\r\n\r\n return props;\r\n }\r\n}\r\n\r\n/** Represents an iModel in JavaScript.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport abstract class IModel implements IModelProps {\r\n private _projectExtents?: AxisAlignedBox3d;\r\n private _name?: string;\r\n private _rootSubject?: RootSubjectProps;\r\n private _globalOrigin?: Point3d;\r\n private _ecefLocation?: EcefLocation;\r\n private _geographicCoordinateSystem?: GeographicCRS;\r\n private _iModelId?: GuidString;\r\n private _changeset: ChangesetIdWithIndex;\r\n\r\n /** The Id of the repository model. */\r\n public static readonly repositoryModelId: Id64String = \"0x1\";\r\n /** The Id of the root subject element. */\r\n public static readonly rootSubjectId: Id64String = \"0x1\";\r\n /** The Id of the dictionary model. */\r\n public static readonly dictionaryId: Id64String = \"0x10\";\r\n\r\n /** Event raised after [[name]] changes. */\r\n public readonly onNameChanged = new BeEvent<(previousName: string) => void>();\r\n /** Event raised after [[rootSubject]] changes. */\r\n public readonly onRootSubjectChanged = new BeEvent<(previousSubject: RootSubjectProps) => void>();\r\n /** Event raised after [[projectExtents]] changes. */\r\n public readonly onProjectExtentsChanged = new BeEvent<(previousExtents: AxisAlignedBox3d) => void>();\r\n /** Event raised after [[globalOrigin]] changes. */\r\n public readonly onGlobalOriginChanged = new BeEvent<(previousOrigin: Point3d) => void>();\r\n /** Event raised after [[ecefLocation]] changes. */\r\n public readonly onEcefLocationChanged = new BeEvent<(previousLocation: EcefLocation | undefined) => void>();\r\n /** Event raised after [[geographicCoordinateSystem]] changes. */\r\n public readonly onGeographicCoordinateSystemChanged = new BeEvent<(previousGCS: GeographicCRS | undefined) => void>();\r\n /** Event raised after [[changeset]] changes. */\r\n public readonly onChangesetChanged = new BeEvent<(previousChangeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Name of the iModel */\r\n public get name(): string {\r\n assert(this._name !== undefined);\r\n return this._name;\r\n }\r\n public set name(name: string) {\r\n if (name !== this._name) {\r\n const old = this._name;\r\n this._name = name;\r\n if (undefined !== old)\r\n this.onNameChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The name and description of the root subject of this iModel */\r\n public get rootSubject(): RootSubjectProps {\r\n assert(this._rootSubject !== undefined);\r\n return this._rootSubject;\r\n }\r\n public set rootSubject(subject: RootSubjectProps) {\r\n if (undefined === this._rootSubject || this._rootSubject.name !== subject.name || this._rootSubject.description !== subject.description) {\r\n const old = this._rootSubject;\r\n this._rootSubject = subject;\r\n if (old)\r\n this.onRootSubjectChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** Returns `true` if this is a snapshot iModel. */\r\n public abstract get isSnapshot(): boolean;\r\n /** Returns `true` if this is a briefcase copy of an iModel that is synchronized with iModelHub. */\r\n public abstract get isBriefcase(): boolean;\r\n\r\n public abstract get isOpen(): boolean;\r\n\r\n /**\r\n * The volume, in spatial coordinates, inside which the entire project is contained.\r\n * @note The object returned from this method is frozen. You *must* make a copy before you do anything that might attempt to modify it.\r\n */\r\n public get projectExtents() {\r\n assert(undefined !== this._projectExtents);\r\n return this._projectExtents;\r\n }\r\n public set projectExtents(extents: AxisAlignedBox3d) {\r\n // Don't allow any axis of the project extents to be less than 1 meter.\r\n const projectExtents = extents.clone();\r\n projectExtents.ensureMinLengths(1.0);\r\n if (!this._projectExtents || !this._projectExtents.isAlmostEqual(projectExtents)) {\r\n const old = this._projectExtents;\r\n projectExtents.freeze();\r\n this._projectExtents = projectExtents;\r\n if (old)\r\n this.onProjectExtentsChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** An offset to be applied to all spatial coordinates. */\r\n public get globalOrigin(): Point3d {\r\n assert(this._globalOrigin !== undefined);\r\n return this._globalOrigin;\r\n }\r\n public set globalOrigin(org: Point3d) {\r\n if (!this._globalOrigin || !this._globalOrigin.isAlmostEqual(org)) {\r\n const old = this._globalOrigin;\r\n org.freeze();\r\n this._globalOrigin = org;\r\n if (old)\r\n this.onGlobalOriginChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The [EcefLocation]($docs/learning/glossary#ecefLocation) of the iModel in Earth Centered Earth Fixed coordinates.\r\n * If the iModel property geographicCoordinateSystem is not defined then the ecefLocation provides a geolocation by defining a\r\n * 3D coordinate system relative to the Earth model WGS84. Refer to additional documentation for details. If the geographicCoordinateSystem\r\n * property is defined then the ecefLocation must be used with care. When the geographicCoordinateSystem is defined it indicates the\r\n * iModel cartesian space is the result of a cartographic projection. This implies a flattening of the Earth surface process that\r\n * results in scale, angular or area distortion. The ecefLocation is then an approximation calculated at the center of the project extent.\r\n * If the project is more than 2 kilometer in size, the ecefLocation may represent a poor approximation of the effective\r\n * cartographic projection used and a linear transformation should then be calculated at the exact origin of the data\r\n * it must position.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n */\r\n public get ecefLocation(): EcefLocation | undefined {\r\n return this._ecefLocation;\r\n }\r\n public set ecefLocation(ecefLocation: EcefLocation | undefined) {\r\n const old = this._ecefLocation;\r\n if (!old && !ecefLocation)\r\n return;\r\n else if (old && ecefLocation && old.isAlmostEqual(ecefLocation))\r\n return;\r\n\r\n this._ecefLocation = ecefLocation;\r\n this.onEcefLocationChanged.raiseEvent(old);\r\n }\r\n\r\n /** Set the [EcefLocation]($docs/learning/glossary#ecefLocation) for this iModel. */\r\n public setEcefLocation(ecef: EcefLocationProps): void {\r\n this.ecefLocation = new EcefLocation(ecef);\r\n }\r\n\r\n /** The geographic coordinate reference system of the iModel. */\r\n public get geographicCoordinateSystem(): GeographicCRS | undefined {\r\n return this._geographicCoordinateSystem;\r\n }\r\n public set geographicCoordinateSystem(geoCRS: GeographicCRS | undefined) {\r\n const old = this._geographicCoordinateSystem;\r\n if (!old && !geoCRS)\r\n return;\r\n else if (old && geoCRS && old.equals(geoCRS))\r\n return;\r\n\r\n this._geographicCoordinateSystem = geoCRS;\r\n this.onGeographicCoordinateSystemChanged.raiseEvent(old);\r\n }\r\n\r\n /** Sets the geographic coordinate reference system from GeographicCRSProps. */\r\n public setGeographicCoordinateSystem(geoCRS: GeographicCRSProps) {\r\n this.geographicCoordinateSystem = new GeographicCRS(geoCRS);\r\n }\r\n\r\n /** @internal */\r\n public getConnectionProps(): IModelConnectionProps {\r\n return {\r\n name: this.name,\r\n rootSubject: this.rootSubject,\r\n projectExtents: this.projectExtents.toJSON(),\r\n globalOrigin: this.globalOrigin.toJSON(),\r\n ecefLocation: this.ecefLocation,\r\n geographicCoordinateSystem: this.geographicCoordinateSystem?.toJSON(),\r\n ...this._getRpcProps(),\r\n };\r\n }\r\n\r\n /** Convert this iModel to a JSON representation. */\r\n public toJSON(): IModelConnectionProps {\r\n return this.getConnectionProps();\r\n }\r\n\r\n /** A key used to identify this iModel in RPC calls from frontend to backend.\r\n * @internal\r\n */\r\n protected _fileKey: string;\r\n /** Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications. */\r\n public get key(): string { return this._fileKey; }\r\n\r\n /** @internal */\r\n protected _iTwinId?: GuidString;\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public get iTwinId(): GuidString | undefined { return this._iTwinId; }\r\n\r\n /** The Guid that identifies this iModel. */\r\n public get iModelId(): GuidString | undefined { return this._iModelId; }\r\n\r\n /** @public */\r\n public get changeset(): ChangesetIdWithIndex {\r\n return { ...this._changeset };\r\n }\r\n public set changeset(changeset: ChangesetIdWithIndex) {\r\n const prev = this._changeset;\r\n if (prev.id !== changeset.id || prev.index !== changeset.index) {\r\n this._changeset = { id: changeset.id, index: changeset.index };\r\n this.onChangesetChanged.raiseEvent(prev);\r\n }\r\n }\r\n\r\n protected _openMode = OpenMode.Readonly;\r\n /** The [[OpenMode]] used for this IModel. */\r\n public get openMode(): OpenMode { return this._openMode; }\r\n\r\n /** Return a token for RPC operations.\r\n * @throws IModelError if the iModel is not open.\r\n */\r\n public getRpcProps(): IModelRpcProps {\r\n if (!this.isOpen)\r\n throw new IModelError(IModelStatus.BadRequest, \"IModel is not open for rpc\");\r\n\r\n return this._getRpcProps();\r\n }\r\n\r\n /** Returns the iModel's RPC properties.\r\n * @note It is an error to attempt to use these properties as a token for RPC operations if the iModel is not open.\r\n * @internal\r\n */\r\n protected _getRpcProps(): IModelRpcProps {\r\n return {\r\n key: this._fileKey,\r\n iTwinId: this.iTwinId,\r\n iModelId: this.iModelId,\r\n changeset: this.changeset,\r\n };\r\n }\r\n\r\n /** @internal */\r\n protected constructor(tokenProps?: IModelRpcProps) {\r\n this._changeset = tokenProps?.changeset ?? { id: \"\", index: 0 };\r\n this._fileKey = \"\";\r\n if (tokenProps) {\r\n this._fileKey = tokenProps.key;\r\n this._iTwinId = tokenProps.iTwinId;\r\n this._iModelId = tokenProps.iModelId;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected initialize(name: string, props: IModelProps) {\r\n this.name = name;\r\n this.rootSubject = props.rootSubject;\r\n this.projectExtents = Range3d.fromJSON(props.projectExtents);\r\n this.globalOrigin = Point3d.fromJSON(props.globalOrigin);\r\n\r\n const ecefLocation = props.ecefLocation ? new EcefLocation(props.ecefLocation) : undefined;\r\n this.ecefLocation = ecefLocation?.isValid ? ecefLocation : undefined;\r\n\r\n this.geographicCoordinateSystem = props.geographicCoordinateSystem ? new GeographicCRS(props.geographicCoordinateSystem) : undefined;\r\n }\r\n\r\n /** Get the default subCategoryId for the supplied categoryId */\r\n public static getDefaultSubCategoryId(categoryId: Id64String): Id64String {\r\n return Id64.isValid(categoryId) ? Id64.fromLocalAndBriefcaseIds(Id64.getLocalId(categoryId) + 1, Id64.getBriefcaseId(categoryId)) : Id64.invalid;\r\n }\r\n\r\n /** True if this iModel has an [EcefLocation]($docs/learning/glossary#ecefLocation). */\r\n public get isGeoLocated() { return undefined !== this._ecefLocation; }\r\n\r\n /** Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its [[IModel.ecefLocation]].\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public getEcefTransform(): Transform {\r\n if (undefined === this._ecefLocation)\r\n throw new IModelError(GeoServiceStatus.NoGeoLocation, \"iModel is not GeoLocated\");\r\n return this._ecefLocation.getTransform();\r\n }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to an ECEF point using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in ECEF coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d { return this.getEcefTransform().multiplyPoint3d(spatial, result); }\r\n\r\n /** Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its [[ecefLocation]].\r\n * @param ecef A point in ECEF coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d { return expectDefined(this.getEcefTransform().multiplyInversePoint3d(ecef, result)); }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Cartographic location\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic { return expectDefined(Cartographic.fromEcef(this.spatialToEcef(spatial), result)); }\r\n\r\n /** Convert a [[Cartographic]] to a point in this iModel's Spatial coordinates using its [[IModel.ecefLocation]].\r\n * @param cartographic A cartographic location\r\n * @param result If defined, use this for output\r\n * @returns A point in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d) { return this.ecefToSpatial(cartographic.toEcef(result), result); }\r\n}\r\n"]}
@@ -175,7 +175,7 @@ export interface CreateStandaloneIModelProps {
175
175
  * internal value `{ "txns": true }` regardless of the string content provided. This behavior ensures backwards
176
176
  * compatibility while allowing users to enable transaction support.
177
177
  * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.
178
- * @deprecated in 5.5 - will not be removed until after 2027-01-05. Use [[enableTransactions]] instead.
178
+ * @deprecated in 5.5. Use [[enableTransactions]] instead.
179
179
  */
180
180
  readonly allowEdit?: string;
181
181
  /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.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CAAC,CAAC;IAErJ;;;;;OAKG;IACI,6BAA6B,CAAC,OAAe,EAAE,MAAqB,IAAkB,OAAO,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhL;;;;;;OAMG;IACI,6BAA6B,CAAC,YAA0B,EAAE,MAAgB,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, BeEvent, expectDefined, GeoServiceStatus, GuidString, Id64, Id64String, IModelStatus, Mutable, OpenMode } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AxisIndex, AxisOrder, Constant, Geometry, Matrix3d, Point3d, Range3d, Range3dProps, Transform, TransformProps, Vector3d, XYAndZ, XYZProps,\r\n YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ChangesetIdWithIndex } from \"./ChangesetProps\";\r\nimport { Cartographic, CartographicProps } from \"./geometry/Cartographic\";\r\nimport { GeographicCRS, GeographicCRSProps } from \"./geometry/CoordinateReferenceSystem\";\r\nimport { AxisAlignedBox3d } from \"./geometry/Placement\";\r\nimport { IModelError } from \"./IModelError\";\r\nimport { ThumbnailProps } from \"./Thumbnail\";\r\n\r\n/** The properties to open a connection to an iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcOpenProps {\r\n /** The iTwin in which the iModel exists - must be defined for briefcases that are synchronized with iModelHub. */\r\n readonly iTwinId?: GuidString;\r\n /** Guid of the iModel. */\r\n readonly iModelId?: GuidString;\r\n\r\n /** Id of the last Changeset that was applied to the iModel - must be defined for briefcases that are synchronized with iModelHub.\r\n * @note Changeset Ids are string hash values based on the content and parent.\r\n */\r\n readonly changeset?: ChangesetIdWithIndex;\r\n}\r\n\r\n/** The properties that identify an opened iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcProps extends IModelRpcOpenProps {\r\n /** Unique key used for identifying the iModel between the frontend and the backend */\r\n readonly key: string;\r\n}\r\n\r\n/** Properties that position an iModel on the earth via [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * The origin is specified as an ECEF coordinate. The cartographicOrigin property contains the latitude, longitude and elevation above the WGS84 ellipsoid\r\n * of the origin property. This cartographicOrigin is offered as a convenient pre-calculated value representing the location of the ECEF origin.\r\n * The 3D coordinate system this class represents is positioned at specified origin and the axis positioned according to\r\n * the other properties.\r\n * If transform property is defined then it will not be computed from other properties.\r\n * If the xVector and yVector properties are defined (and transform is not defined) then they take precedence over the YawPitchRoll orientation property. The xVector and yVector\r\n * represent the direction and scale of the X and Y axes. The Z axis is always perpendicular (according to the right hand rule) to these X-Y axes.\r\n * The scaling in the Z direction is always unity. The scale of the X and Y axes is represented by the size of the vector length.\r\n * If the xVector and yVector are not present then the YawPitchRoll properties indicates the angles for all tree axes. Scaling in that case\r\n * is unity in all three directions.\r\n * Note that the present class is intended to represent geolocated 3D coordinate systems that are normally tangent to the WGS84 ellipsoid\r\n * possibly offset in altitude by the terrain elevation above the ellipsoid but other general 3D coordinate systems\r\n * can be defined.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface EcefLocationProps {\r\n /** The Origin of an iModel on the earth in ECEF coordinates */\r\n readonly origin: XYZProps;\r\n /** The [orientation](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion) of an iModel on the earth. */\r\n readonly orientation: YawPitchRollProps;\r\n /** Optional position on the earth used to establish the ECEF coordinates. */\r\n readonly cartographicOrigin?: CartographicProps;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly xVector?: XYZProps;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly yVector?: XYZProps;\r\n /** Optional potentially non-rigid transform defining the ECEF location.\r\n * @note If this property is supplied, the other properties are ignored.\r\n */\r\n readonly transform?: TransformProps;\r\n}\r\n\r\n/** Properties of the [Root Subject]($docs/bis/guide/references/glossary#subject-root).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RootSubjectProps {\r\n /** The name of the root subject. */\r\n readonly name: string;\r\n /** Description of the root subject (optional). */\r\n readonly description?: string;\r\n}\r\n\r\n/** Properties of an iModel that are always held in memory whenever one is opened, both on the frontend and on the backend .\r\n * @public\r\n */\r\nexport interface IModelProps {\r\n /** The name and description of the root subject of this iModel */\r\n readonly rootSubject: RootSubjectProps;\r\n /** The volume of the entire project, in spatial coordinates */\r\n readonly projectExtents?: Range3dProps;\r\n /** An offset to be applied to all spatial coordinates. This is normally used to transform spatial coordinates into the Cartesian coordinate system of a Geographic Coordinate System. */\r\n readonly globalOrigin?: XYZProps;\r\n /** The location of the iModel in Earth Centered Earth Fixed coordinates. iModel units are always meters */\r\n readonly ecefLocation?: EcefLocationProps;\r\n /** The Geographic Coordinate Reference System indicating the projection and datum used. */\r\n readonly geographicCoordinateSystem?: GeographicCRSProps;\r\n /** The name of the iModel. */\r\n readonly name?: string;\r\n}\r\n\r\n/** The properties returned by the backend when creating a new [[IModelConnection]] from the frontend, either with Rpc or with Ipc.\r\n * These properties describe the iModel held on the backend for thew newly formed connection and are used to construct a new\r\n * [[IModelConnection]] instance on the frontend to access it.\r\n * @public\r\n */\r\nexport type IModelConnectionProps = IModelProps & IModelRpcProps;\r\n\r\n/** The properties that can be supplied when creating a *new* iModel.\r\n * @public\r\n */\r\nexport interface CreateIModelProps extends IModelProps {\r\n /** The GUID of new iModel. If not present, a GUID will be generated. */\r\n readonly guid?: GuidString;\r\n /** Client name for new iModel */\r\n readonly client?: string;\r\n /** Thumbnail for new iModel\r\n * @alpha\r\n */\r\n readonly thumbnail?: ThumbnailProps;\r\n}\r\n\r\n/**\r\n * Sqlite options.\r\n * @public\r\n */\r\nexport interface OpenSqliteArgs {\r\n /**\r\n * Specify timeout after which SQLite stop retrying to acquire lock to database file and throw SQLITE_BUSY error.\r\n * Timeout is specified in milliseconds.\r\n * For more information https://www.sqlite.org/c3ref/busy_timeout.html.\r\n * */\r\n readonly busyTimeout?: number;\r\n}\r\n\r\n/**\r\n * A key used to identify an opened [IModelDb]($backend) between the frontend and backend for Rpc and Ipc communications.\r\n * Keys must be unique - that is there can never be two IModelDbs opened with the same key at any given time.\r\n * If no key is supplied in a call to open an IModelDb, one is generated and returned.\r\n * It is only necessary to supply a key if you have some reason to assign a specific value to identify an IModelDb.\r\n * If you don't supply the key, you must use the returned value for Rpc and Ipc communications.\r\n * @public\r\n */\r\nexport interface OpenDbKey {\r\n readonly key?: string;\r\n}\r\n\r\n/** @beta TODO documentation */\r\nexport interface CloudContainerUri {\r\n readonly uriParams: string;\r\n}\r\n\r\n/** Options to open a [SnapshotDb]($backend).\r\n * @public\r\n */\r\nexport interface SnapshotOpenOptions extends OpenDbKey {\r\n /**\r\n * The \"base\" name that can be used for creating temporary files related to this Db.\r\n * The string should be a name related to the current Db filename using some known pattern so that all files named \"baseName*\" can be deleted externally during cleanup.\r\n * It must be the name of a file (that may or may not exist) in a writable directory.\r\n * If not present, the baseName will default to the database's file name (including the path).\r\n * @internal\r\n */\r\n readonly tempFileBase?: string;\r\n}\r\n\r\n/** Options to open a [StandaloneDb]($backend) via [StandaloneDb.openFile]($backend) from the backend,\r\n * or [BriefcaseConnection.openStandalone]($frontend) from the frontend.\r\n * @public\r\n */\r\nexport type StandaloneOpenOptions = OpenDbKey;\r\n\r\n/** Options that can be supplied when creating snapshot iModels.\r\n * @public\r\n */\r\nexport interface CreateSnapshotIModelProps {\r\n /** If true, then create SQLite views for Model, Element, ElementAspect, and Relationship classes.\r\n * These database views can often be useful for interoperability workflows.\r\n */\r\n readonly createClassViews?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* snapshot iModel.\r\n * @see [SnapshotDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptySnapshotIModelProps = CreateIModelProps & CreateSnapshotIModelProps;\r\n\r\n/** Options that can be supplied when creating standalone iModels.\r\n * @public\r\n */\r\nexport interface CreateStandaloneIModelProps {\r\n /** If present, file will allow local editing, but cannot be used to create changesets.\r\n * @note This flag is a string for historical reasons. When specified, it will always be set to the required\r\n * internal value `{ \"txns\": true }` regardless of the string content provided. This behavior ensures backwards\r\n * compatibility while allowing users to enable transaction support.\r\n * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.\r\n * @deprecated in 5.5 - will not be removed until after 2027-01-05. Use [[enableTransactions]] instead.\r\n */\r\n readonly allowEdit?: string;\r\n /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.\r\n * This is the preferred way to enable editing. If both this and [[allowEdit]] are specified, either being truthy will enable transactions.\r\n */\r\n readonly enableTransactions?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* standalone iModel.\r\n * @see [StandaloneDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptyStandaloneIModelProps = CreateIModelProps & CreateStandaloneIModelProps;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FilePropertyProps {\r\n readonly namespace: string;\r\n readonly name: string;\r\n id?: number | string;\r\n subId?: number | string;\r\n}\r\n\r\n/** The position and orientation of an iModel on the earth in [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * @note This is an immutable type - all of its properties are frozen.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport class EcefLocation implements EcefLocationProps {\r\n /** The origin of the ECEF transform. */\r\n public readonly origin: Point3d;\r\n /** The orientation of the ECEF transform */\r\n public readonly orientation: YawPitchRollAngles;\r\n /** Optional position on the earth used to establish the ECEF origin and orientation. */\r\n public readonly cartographicOrigin?: Cartographic;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly xVector?: Vector3d;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly yVector?: Vector3d;\r\n /** The transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n private readonly _transform: Transform = Transform.createIdentity();\r\n\r\n /** Get the transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n public getTransform(): Transform { return this._transform; }\r\n\r\n /** Construct a new EcefLocation. Once constructed, it is frozen and cannot be modified. */\r\n constructor(props: EcefLocationProps) {\r\n this.origin = Point3d.fromJSON(props.origin).freeze();\r\n this.orientation = YawPitchRollAngles.fromJSON(props.orientation).freeze();\r\n if (props.cartographicOrigin)\r\n this.cartographicOrigin = Cartographic.fromRadians({ longitude: props.cartographicOrigin.longitude, latitude: props.cartographicOrigin.latitude, height: props.cartographicOrigin.height }).freeze();\r\n if (props.xVector && props.yVector) {\r\n this.xVector = Vector3d.fromJSON(props.xVector).freeze();\r\n this.yVector = Vector3d.fromJSON(props.yVector).freeze();\r\n }\r\n if (props.transform) {\r\n this._transform.setFromJSON(props.transform);\r\n this._transform.freeze();\r\n } else {\r\n let matrix;\r\n if (this.xVector && this.yVector) {\r\n const zVector = this.xVector.crossProduct(this.yVector);\r\n if (zVector.normalizeInPlace())\r\n matrix = Matrix3d.createColumns(this.xVector, this.yVector, zVector);\r\n }\r\n if (!matrix)\r\n matrix = this.orientation.toMatrix3d();\r\n\r\n this._transform = Transform.createOriginAndMatrix(this.origin, matrix);\r\n this._transform.freeze();\r\n }\r\n }\r\n\r\n /** Returns true if this EcefLocation is not located at the center of the Earth.\r\n * @alpha are locations very close to the center considered valid? What are the specific criteria?\r\n */\r\n public get isValid(): boolean {\r\n return !this.origin.isZero;\r\n }\r\n\r\n /** Construct ECEF Location from cartographic origin with optional known point and angle. */\r\n public static createFromCartographicOrigin(origin: Cartographic, point?: Point3d, angle?: Angle) {\r\n const ecefOrigin = origin.toEcef();\r\n const deltaRadians = 10 / Constant.earthRadiusWGS84.polar;\r\n const northCarto = Cartographic.fromRadians({ longitude: origin.longitude, latitude: origin.latitude + deltaRadians, height: origin.height });\r\n const eastCarto = Cartographic.fromRadians({ longitude: origin.longitude + deltaRadians, latitude: origin.latitude, height: origin.height });\r\n const ecefNorth = northCarto.toEcef();\r\n const ecefEast = eastCarto.toEcef();\r\n const xVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefEast).normalize());\r\n const yVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefNorth).normalize());\r\n const matrix = expectDefined(Matrix3d.createRigidFromColumns(xVector, yVector, AxisOrder.XYZ));\r\n if (angle !== undefined) {\r\n const north = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, angle);\r\n matrix.multiplyMatrixMatrix(north, matrix);\r\n }\r\n if (point !== undefined) {\r\n const delta = matrix.multiplyVector(Vector3d.create(-point.x, -point.y, -point.z));\r\n ecefOrigin.addInPlace(delta);\r\n }\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: expectDefined(YawPitchRollAngles.createFromMatrix3d(matrix)), cartographicOrigin: origin });\r\n }\r\n\r\n /** Construct ECEF Location from transform with optional position on the earth used to establish the ECEF origin and orientation. */\r\n public static createFromTransform(transform: Transform): EcefLocation {\r\n const ecefOrigin = transform.getOrigin();\r\n const angleFromInput = YawPitchRollAngles.createDegrees(0, 0, 0);\r\n const locationOrientationFromInputT = YawPitchRollAngles.createFromMatrix3d(transform.getMatrix(), angleFromInput);\r\n const transformProps = transform.toJSON();\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: locationOrientationFromInputT ?? angleFromInput, transform: transformProps });\r\n }\r\n\r\n /** Get the location center of the earth in the iModel coordinate system. */\r\n public get earthCenter(): Point3d {\r\n const matrix = this.orientation.toMatrix3d();\r\n return Point3d.createFrom(matrix.multiplyTransposeXYZ(-this.origin.x, -this.origin.y, -this.origin.z));\r\n }\r\n\r\n /** Return true if this location is equivalent to another location within a small tolerance. */\r\n public isAlmostEqual(other: EcefLocation): boolean {\r\n if (!this.origin.isAlmostEqual(other.origin) || !this.orientation.isAlmostEqual(other.orientation))\r\n return false;\r\n\r\n if ((this.xVector === undefined) !== (other.xVector === undefined) || (this.yVector === undefined) !== (other.yVector === undefined))\r\n return false;\r\n\r\n if (this.xVector !== undefined && other.xVector !== undefined && !this.xVector.isAlmostEqual(other.xVector))\r\n return false;\r\n\r\n if (this.yVector !== undefined && other.yVector !== undefined && !this.yVector.isAlmostEqual(other.yVector))\r\n return false;\r\n\r\n if (!this.getTransform().isAlmostEqual(other.getTransform()))\r\n return false;\r\n\r\n const thisCarto = this.cartographicOrigin;\r\n const otherCarto = other.cartographicOrigin;\r\n if (undefined === thisCarto || undefined === otherCarto)\r\n return undefined === thisCarto && undefined === otherCarto;\r\n\r\n return thisCarto.equalsEpsilon(otherCarto, Geometry.smallMetricDistance);\r\n }\r\n\r\n public toJSON(): EcefLocationProps {\r\n const props: Mutable<EcefLocationProps> = {\r\n origin: this.origin.toJSON(),\r\n orientation: this.orientation.toJSON(),\r\n transform: this.getTransform().toJSON(),\r\n };\r\n\r\n if (this.cartographicOrigin)\r\n props.cartographicOrigin = this.cartographicOrigin.toJSON();\r\n\r\n if (this.xVector)\r\n props.xVector = this.xVector.toJSON();\r\n\r\n if (this.yVector)\r\n props.yVector = this.yVector.toJSON();\r\n\r\n return props;\r\n }\r\n}\r\n\r\n/** Represents an iModel in JavaScript.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport abstract class IModel implements IModelProps {\r\n private _projectExtents?: AxisAlignedBox3d;\r\n private _name?: string;\r\n private _rootSubject?: RootSubjectProps;\r\n private _globalOrigin?: Point3d;\r\n private _ecefLocation?: EcefLocation;\r\n private _geographicCoordinateSystem?: GeographicCRS;\r\n private _iModelId?: GuidString;\r\n private _changeset: ChangesetIdWithIndex;\r\n\r\n /** The Id of the repository model. */\r\n public static readonly repositoryModelId: Id64String = \"0x1\";\r\n /** The Id of the root subject element. */\r\n public static readonly rootSubjectId: Id64String = \"0x1\";\r\n /** The Id of the dictionary model. */\r\n public static readonly dictionaryId: Id64String = \"0x10\";\r\n\r\n /** Event raised after [[name]] changes. */\r\n public readonly onNameChanged = new BeEvent<(previousName: string) => void>();\r\n /** Event raised after [[rootSubject]] changes. */\r\n public readonly onRootSubjectChanged = new BeEvent<(previousSubject: RootSubjectProps) => void>();\r\n /** Event raised after [[projectExtents]] changes. */\r\n public readonly onProjectExtentsChanged = new BeEvent<(previousExtents: AxisAlignedBox3d) => void>();\r\n /** Event raised after [[globalOrigin]] changes. */\r\n public readonly onGlobalOriginChanged = new BeEvent<(previousOrigin: Point3d) => void>();\r\n /** Event raised after [[ecefLocation]] changes. */\r\n public readonly onEcefLocationChanged = new BeEvent<(previousLocation: EcefLocation | undefined) => void>();\r\n /** Event raised after [[geographicCoordinateSystem]] changes. */\r\n public readonly onGeographicCoordinateSystemChanged = new BeEvent<(previousGCS: GeographicCRS | undefined) => void>();\r\n /** Event raised after [[changeset]] changes. */\r\n public readonly onChangesetChanged = new BeEvent<(previousChangeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Name of the iModel */\r\n public get name(): string {\r\n assert(this._name !== undefined);\r\n return this._name;\r\n }\r\n public set name(name: string) {\r\n if (name !== this._name) {\r\n const old = this._name;\r\n this._name = name;\r\n if (undefined !== old)\r\n this.onNameChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The name and description of the root subject of this iModel */\r\n public get rootSubject(): RootSubjectProps {\r\n assert(this._rootSubject !== undefined);\r\n return this._rootSubject;\r\n }\r\n public set rootSubject(subject: RootSubjectProps) {\r\n if (undefined === this._rootSubject || this._rootSubject.name !== subject.name || this._rootSubject.description !== subject.description) {\r\n const old = this._rootSubject;\r\n this._rootSubject = subject;\r\n if (old)\r\n this.onRootSubjectChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** Returns `true` if this is a snapshot iModel. */\r\n public abstract get isSnapshot(): boolean;\r\n /** Returns `true` if this is a briefcase copy of an iModel that is synchronized with iModelHub. */\r\n public abstract get isBriefcase(): boolean;\r\n\r\n public abstract get isOpen(): boolean;\r\n\r\n /**\r\n * The volume, in spatial coordinates, inside which the entire project is contained.\r\n * @note The object returned from this method is frozen. You *must* make a copy before you do anything that might attempt to modify it.\r\n */\r\n public get projectExtents() {\r\n assert(undefined !== this._projectExtents);\r\n return this._projectExtents;\r\n }\r\n public set projectExtents(extents: AxisAlignedBox3d) {\r\n // Don't allow any axis of the project extents to be less than 1 meter.\r\n const projectExtents = extents.clone();\r\n projectExtents.ensureMinLengths(1.0);\r\n if (!this._projectExtents || !this._projectExtents.isAlmostEqual(projectExtents)) {\r\n const old = this._projectExtents;\r\n projectExtents.freeze();\r\n this._projectExtents = projectExtents;\r\n if (old)\r\n this.onProjectExtentsChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** An offset to be applied to all spatial coordinates. */\r\n public get globalOrigin(): Point3d {\r\n assert(this._globalOrigin !== undefined);\r\n return this._globalOrigin;\r\n }\r\n public set globalOrigin(org: Point3d) {\r\n if (!this._globalOrigin || !this._globalOrigin.isAlmostEqual(org)) {\r\n const old = this._globalOrigin;\r\n org.freeze();\r\n this._globalOrigin = org;\r\n if (old)\r\n this.onGlobalOriginChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The [EcefLocation]($docs/learning/glossary#ecefLocation) of the iModel in Earth Centered Earth Fixed coordinates.\r\n * If the iModel property geographicCoordinateSystem is not defined then the ecefLocation provides a geolocation by defining a\r\n * 3D coordinate system relative to the Earth model WGS84. Refer to additional documentation for details. If the geographicCoordinateSystem\r\n * property is defined then the ecefLocation must be used with care. When the geographicCoordinateSystem is defined it indicates the\r\n * iModel cartesian space is the result of a cartographic projection. This implies a flattening of the Earth surface process that\r\n * results in scale, angular or area distortion. The ecefLocation is then an approximation calculated at the center of the project extent.\r\n * If the project is more than 2 kilometer in size, the ecefLocation may represent a poor approximation of the effective\r\n * cartographic projection used and a linear transformation should then be calculated at the exact origin of the data\r\n * it must position.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n */\r\n public get ecefLocation(): EcefLocation | undefined {\r\n return this._ecefLocation;\r\n }\r\n public set ecefLocation(ecefLocation: EcefLocation | undefined) {\r\n const old = this._ecefLocation;\r\n if (!old && !ecefLocation)\r\n return;\r\n else if (old && ecefLocation && old.isAlmostEqual(ecefLocation))\r\n return;\r\n\r\n this._ecefLocation = ecefLocation;\r\n this.onEcefLocationChanged.raiseEvent(old);\r\n }\r\n\r\n /** Set the [EcefLocation]($docs/learning/glossary#ecefLocation) for this iModel. */\r\n public setEcefLocation(ecef: EcefLocationProps): void {\r\n this.ecefLocation = new EcefLocation(ecef);\r\n }\r\n\r\n /** The geographic coordinate reference system of the iModel. */\r\n public get geographicCoordinateSystem(): GeographicCRS | undefined {\r\n return this._geographicCoordinateSystem;\r\n }\r\n public set geographicCoordinateSystem(geoCRS: GeographicCRS | undefined) {\r\n const old = this._geographicCoordinateSystem;\r\n if (!old && !geoCRS)\r\n return;\r\n else if (old && geoCRS && old.equals(geoCRS))\r\n return;\r\n\r\n this._geographicCoordinateSystem = geoCRS;\r\n this.onGeographicCoordinateSystemChanged.raiseEvent(old);\r\n }\r\n\r\n /** Sets the geographic coordinate reference system from GeographicCRSProps. */\r\n public setGeographicCoordinateSystem(geoCRS: GeographicCRSProps) {\r\n this.geographicCoordinateSystem = new GeographicCRS(geoCRS);\r\n }\r\n\r\n /** @internal */\r\n public getConnectionProps(): IModelConnectionProps {\r\n return {\r\n name: this.name,\r\n rootSubject: this.rootSubject,\r\n projectExtents: this.projectExtents.toJSON(),\r\n globalOrigin: this.globalOrigin.toJSON(),\r\n ecefLocation: this.ecefLocation,\r\n geographicCoordinateSystem: this.geographicCoordinateSystem?.toJSON(),\r\n ...this._getRpcProps(),\r\n };\r\n }\r\n\r\n /** Convert this iModel to a JSON representation. */\r\n public toJSON(): IModelConnectionProps {\r\n return this.getConnectionProps();\r\n }\r\n\r\n /** A key used to identify this iModel in RPC calls from frontend to backend.\r\n * @internal\r\n */\r\n protected _fileKey: string;\r\n /** Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications. */\r\n public get key(): string { return this._fileKey; }\r\n\r\n /** @internal */\r\n protected _iTwinId?: GuidString;\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public get iTwinId(): GuidString | undefined { return this._iTwinId; }\r\n\r\n /** The Guid that identifies this iModel. */\r\n public get iModelId(): GuidString | undefined { return this._iModelId; }\r\n\r\n /** @public */\r\n public get changeset(): ChangesetIdWithIndex {\r\n return { ...this._changeset };\r\n }\r\n public set changeset(changeset: ChangesetIdWithIndex) {\r\n const prev = this._changeset;\r\n if (prev.id !== changeset.id || prev.index !== changeset.index) {\r\n this._changeset = { id: changeset.id, index: changeset.index };\r\n this.onChangesetChanged.raiseEvent(prev);\r\n }\r\n }\r\n\r\n protected _openMode = OpenMode.Readonly;\r\n /** The [[OpenMode]] used for this IModel. */\r\n public get openMode(): OpenMode { return this._openMode; }\r\n\r\n /** Return a token for RPC operations.\r\n * @throws IModelError if the iModel is not open.\r\n */\r\n public getRpcProps(): IModelRpcProps {\r\n if (!this.isOpen)\r\n throw new IModelError(IModelStatus.BadRequest, \"IModel is not open for rpc\");\r\n\r\n return this._getRpcProps();\r\n }\r\n\r\n /** Returns the iModel's RPC properties.\r\n * @note It is an error to attempt to use these properties as a token for RPC operations if the iModel is not open.\r\n * @internal\r\n */\r\n protected _getRpcProps(): IModelRpcProps {\r\n return {\r\n key: this._fileKey,\r\n iTwinId: this.iTwinId,\r\n iModelId: this.iModelId,\r\n changeset: this.changeset,\r\n };\r\n }\r\n\r\n /** @internal */\r\n protected constructor(tokenProps?: IModelRpcProps) {\r\n this._changeset = tokenProps?.changeset ?? { id: \"\", index: 0 };\r\n this._fileKey = \"\";\r\n if (tokenProps) {\r\n this._fileKey = tokenProps.key;\r\n this._iTwinId = tokenProps.iTwinId;\r\n this._iModelId = tokenProps.iModelId;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected initialize(name: string, props: IModelProps) {\r\n this.name = name;\r\n this.rootSubject = props.rootSubject;\r\n this.projectExtents = Range3d.fromJSON(props.projectExtents);\r\n this.globalOrigin = Point3d.fromJSON(props.globalOrigin);\r\n\r\n const ecefLocation = props.ecefLocation ? new EcefLocation(props.ecefLocation) : undefined;\r\n this.ecefLocation = ecefLocation?.isValid ? ecefLocation : undefined;\r\n\r\n this.geographicCoordinateSystem = props.geographicCoordinateSystem ? new GeographicCRS(props.geographicCoordinateSystem) : undefined;\r\n }\r\n\r\n /** Get the default subCategoryId for the supplied categoryId */\r\n public static getDefaultSubCategoryId(categoryId: Id64String): Id64String {\r\n return Id64.isValid(categoryId) ? Id64.fromLocalAndBriefcaseIds(Id64.getLocalId(categoryId) + 1, Id64.getBriefcaseId(categoryId)) : Id64.invalid;\r\n }\r\n\r\n /** True if this iModel has an [EcefLocation]($docs/learning/glossary#ecefLocation). */\r\n public get isGeoLocated() { return undefined !== this._ecefLocation; }\r\n\r\n /** Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its [[IModel.ecefLocation]].\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public getEcefTransform(): Transform {\r\n if (undefined === this._ecefLocation)\r\n throw new IModelError(GeoServiceStatus.NoGeoLocation, \"iModel is not GeoLocated\");\r\n return this._ecefLocation.getTransform();\r\n }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to an ECEF point using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in ECEF coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d { return this.getEcefTransform().multiplyPoint3d(spatial, result); }\r\n\r\n /** Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its [[ecefLocation]].\r\n * @param ecef A point in ECEF coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d { return expectDefined(this.getEcefTransform().multiplyInversePoint3d(ecef, result)); }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Cartographic location\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic { return expectDefined(Cartographic.fromEcef(this.spatialToEcef(spatial), result)); }\r\n\r\n /** Convert a [[Cartographic]] to a point in this iModel's Spatial coordinates using its [[IModel.ecefLocation]].\r\n * @param cartographic A cartographic location\r\n * @param result If defined, use this for output\r\n * @returns A point in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d) { return this.ecefToSpatial(cartographic.toEcef(result), result); }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../src/IModel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAc,IAAI,EAAc,YAAY,EAAW,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtJ,OAAO,EACE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAA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AC,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, BeEvent, expectDefined, GeoServiceStatus, GuidString, Id64, Id64String, IModelStatus, Mutable, OpenMode } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AxisIndex, AxisOrder, Constant, Geometry, Matrix3d, Point3d, Range3d, Range3dProps, Transform, TransformProps, Vector3d, XYAndZ, XYZProps,\r\n YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ChangesetIdWithIndex } from \"./ChangesetProps\";\r\nimport { Cartographic, CartographicProps } from \"./geometry/Cartographic\";\r\nimport { GeographicCRS, GeographicCRSProps } from \"./geometry/CoordinateReferenceSystem\";\r\nimport { AxisAlignedBox3d } from \"./geometry/Placement\";\r\nimport { IModelError } from \"./IModelError\";\r\nimport { ThumbnailProps } from \"./Thumbnail\";\r\n\r\n/** The properties to open a connection to an iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcOpenProps {\r\n /** The iTwin in which the iModel exists - must be defined for briefcases that are synchronized with iModelHub. */\r\n readonly iTwinId?: GuidString;\r\n /** Guid of the iModel. */\r\n readonly iModelId?: GuidString;\r\n\r\n /** Id of the last Changeset that was applied to the iModel - must be defined for briefcases that are synchronized with iModelHub.\r\n * @note Changeset Ids are string hash values based on the content and parent.\r\n */\r\n readonly changeset?: ChangesetIdWithIndex;\r\n}\r\n\r\n/** The properties that identify an opened iModel for RPC operations.\r\n * @public\r\n */\r\nexport interface IModelRpcProps extends IModelRpcOpenProps {\r\n /** Unique key used for identifying the iModel between the frontend and the backend */\r\n readonly key: string;\r\n}\r\n\r\n/** Properties that position an iModel on the earth via [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * The origin is specified as an ECEF coordinate. The cartographicOrigin property contains the latitude, longitude and elevation above the WGS84 ellipsoid\r\n * of the origin property. This cartographicOrigin is offered as a convenient pre-calculated value representing the location of the ECEF origin.\r\n * The 3D coordinate system this class represents is positioned at specified origin and the axis positioned according to\r\n * the other properties.\r\n * If transform property is defined then it will not be computed from other properties.\r\n * If the xVector and yVector properties are defined (and transform is not defined) then they take precedence over the YawPitchRoll orientation property. The xVector and yVector\r\n * represent the direction and scale of the X and Y axes. The Z axis is always perpendicular (according to the right hand rule) to these X-Y axes.\r\n * The scaling in the Z direction is always unity. The scale of the X and Y axes is represented by the size of the vector length.\r\n * If the xVector and yVector are not present then the YawPitchRoll properties indicates the angles for all tree axes. Scaling in that case\r\n * is unity in all three directions.\r\n * Note that the present class is intended to represent geolocated 3D coordinate systems that are normally tangent to the WGS84 ellipsoid\r\n * possibly offset in altitude by the terrain elevation above the ellipsoid but other general 3D coordinate systems\r\n * can be defined.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface EcefLocationProps {\r\n /** The Origin of an iModel on the earth in ECEF coordinates */\r\n readonly origin: XYZProps;\r\n /** The [orientation](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion) of an iModel on the earth. */\r\n readonly orientation: YawPitchRollProps;\r\n /** Optional position on the earth used to establish the ECEF coordinates. */\r\n readonly cartographicOrigin?: CartographicProps;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly xVector?: XYZProps;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n readonly yVector?: XYZProps;\r\n /** Optional potentially non-rigid transform defining the ECEF location.\r\n * @note If this property is supplied, the other properties are ignored.\r\n */\r\n readonly transform?: TransformProps;\r\n}\r\n\r\n/** Properties of the [Root Subject]($docs/bis/guide/references/glossary#subject-root).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RootSubjectProps {\r\n /** The name of the root subject. */\r\n readonly name: string;\r\n /** Description of the root subject (optional). */\r\n readonly description?: string;\r\n}\r\n\r\n/** Properties of an iModel that are always held in memory whenever one is opened, both on the frontend and on the backend .\r\n * @public\r\n */\r\nexport interface IModelProps {\r\n /** The name and description of the root subject of this iModel */\r\n readonly rootSubject: RootSubjectProps;\r\n /** The volume of the entire project, in spatial coordinates */\r\n readonly projectExtents?: Range3dProps;\r\n /** An offset to be applied to all spatial coordinates. This is normally used to transform spatial coordinates into the Cartesian coordinate system of a Geographic Coordinate System. */\r\n readonly globalOrigin?: XYZProps;\r\n /** The location of the iModel in Earth Centered Earth Fixed coordinates. iModel units are always meters */\r\n readonly ecefLocation?: EcefLocationProps;\r\n /** The Geographic Coordinate Reference System indicating the projection and datum used. */\r\n readonly geographicCoordinateSystem?: GeographicCRSProps;\r\n /** The name of the iModel. */\r\n readonly name?: string;\r\n}\r\n\r\n/** The properties returned by the backend when creating a new [[IModelConnection]] from the frontend, either with Rpc or with Ipc.\r\n * These properties describe the iModel held on the backend for thew newly formed connection and are used to construct a new\r\n * [[IModelConnection]] instance on the frontend to access it.\r\n * @public\r\n */\r\nexport type IModelConnectionProps = IModelProps & IModelRpcProps;\r\n\r\n/** The properties that can be supplied when creating a *new* iModel.\r\n * @public\r\n */\r\nexport interface CreateIModelProps extends IModelProps {\r\n /** The GUID of new iModel. If not present, a GUID will be generated. */\r\n readonly guid?: GuidString;\r\n /** Client name for new iModel */\r\n readonly client?: string;\r\n /** Thumbnail for new iModel\r\n * @alpha\r\n */\r\n readonly thumbnail?: ThumbnailProps;\r\n}\r\n\r\n/**\r\n * Sqlite options.\r\n * @public\r\n */\r\nexport interface OpenSqliteArgs {\r\n /**\r\n * Specify timeout after which SQLite stop retrying to acquire lock to database file and throw SQLITE_BUSY error.\r\n * Timeout is specified in milliseconds.\r\n * For more information https://www.sqlite.org/c3ref/busy_timeout.html.\r\n * */\r\n readonly busyTimeout?: number;\r\n}\r\n\r\n/**\r\n * A key used to identify an opened [IModelDb]($backend) between the frontend and backend for Rpc and Ipc communications.\r\n * Keys must be unique - that is there can never be two IModelDbs opened with the same key at any given time.\r\n * If no key is supplied in a call to open an IModelDb, one is generated and returned.\r\n * It is only necessary to supply a key if you have some reason to assign a specific value to identify an IModelDb.\r\n * If you don't supply the key, you must use the returned value for Rpc and Ipc communications.\r\n * @public\r\n */\r\nexport interface OpenDbKey {\r\n readonly key?: string;\r\n}\r\n\r\n/** @beta TODO documentation */\r\nexport interface CloudContainerUri {\r\n readonly uriParams: string;\r\n}\r\n\r\n/** Options to open a [SnapshotDb]($backend).\r\n * @public\r\n */\r\nexport interface SnapshotOpenOptions extends OpenDbKey {\r\n /**\r\n * The \"base\" name that can be used for creating temporary files related to this Db.\r\n * The string should be a name related to the current Db filename using some known pattern so that all files named \"baseName*\" can be deleted externally during cleanup.\r\n * It must be the name of a file (that may or may not exist) in a writable directory.\r\n * If not present, the baseName will default to the database's file name (including the path).\r\n * @internal\r\n */\r\n readonly tempFileBase?: string;\r\n}\r\n\r\n/** Options to open a [StandaloneDb]($backend) via [StandaloneDb.openFile]($backend) from the backend,\r\n * or [BriefcaseConnection.openStandalone]($frontend) from the frontend.\r\n * @public\r\n */\r\nexport type StandaloneOpenOptions = OpenDbKey;\r\n\r\n/** Options that can be supplied when creating snapshot iModels.\r\n * @public\r\n */\r\nexport interface CreateSnapshotIModelProps {\r\n /** If true, then create SQLite views for Model, Element, ElementAspect, and Relationship classes.\r\n * These database views can often be useful for interoperability workflows.\r\n */\r\n readonly createClassViews?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* snapshot iModel.\r\n * @see [SnapshotDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptySnapshotIModelProps = CreateIModelProps & CreateSnapshotIModelProps;\r\n\r\n/** Options that can be supplied when creating standalone iModels.\r\n * @public\r\n */\r\nexport interface CreateStandaloneIModelProps {\r\n /** If present, file will allow local editing, but cannot be used to create changesets.\r\n * @note This flag is a string for historical reasons. When specified, it will always be set to the required\r\n * internal value `{ \"txns\": true }` regardless of the string content provided. This behavior ensures backwards\r\n * compatibility while allowing users to enable transaction support.\r\n * @note Consider using [[enableTransactions]] instead, which provides a cleaner boolean interface.\r\n * @deprecated in 5.5. Use [[enableTransactions]] instead.\r\n */\r\n readonly allowEdit?: string;\r\n /** If true, enables transactions in the standalone iModel, allowing local editing. The iModel cannot be used to create changesets.\r\n * This is the preferred way to enable editing. If both this and [[allowEdit]] are specified, either being truthy will enable transactions.\r\n */\r\n readonly enableTransactions?: boolean;\r\n}\r\n\r\n/** The options that can be specified when creating an *empty* standalone iModel.\r\n * @see [StandaloneDb.createEmpty]($backend)\r\n * @public\r\n */\r\nexport type CreateEmptyStandaloneIModelProps = CreateIModelProps & CreateStandaloneIModelProps;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport interface FilePropertyProps {\r\n readonly namespace: string;\r\n readonly name: string;\r\n id?: number | string;\r\n subId?: number | string;\r\n}\r\n\r\n/** The position and orientation of an iModel on the earth in [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates\r\n * @note This is an immutable type - all of its properties are frozen.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport class EcefLocation implements EcefLocationProps {\r\n /** The origin of the ECEF transform. */\r\n public readonly origin: Point3d;\r\n /** The orientation of the ECEF transform */\r\n public readonly orientation: YawPitchRollAngles;\r\n /** Optional position on the earth used to establish the ECEF origin and orientation. */\r\n public readonly cartographicOrigin?: Cartographic;\r\n /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly xVector?: Vector3d;\r\n /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */\r\n public readonly yVector?: Vector3d;\r\n /** The transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n private readonly _transform: Transform = Transform.createIdentity();\r\n\r\n /** Get the transform from iModel Spatial coordinates to ECEF from this EcefLocation */\r\n public getTransform(): Transform { return this._transform; }\r\n\r\n /** Construct a new EcefLocation. Once constructed, it is frozen and cannot be modified. */\r\n constructor(props: EcefLocationProps) {\r\n this.origin = Point3d.fromJSON(props.origin).freeze();\r\n this.orientation = YawPitchRollAngles.fromJSON(props.orientation).freeze();\r\n if (props.cartographicOrigin)\r\n this.cartographicOrigin = Cartographic.fromRadians({ longitude: props.cartographicOrigin.longitude, latitude: props.cartographicOrigin.latitude, height: props.cartographicOrigin.height }).freeze();\r\n if (props.xVector && props.yVector) {\r\n this.xVector = Vector3d.fromJSON(props.xVector).freeze();\r\n this.yVector = Vector3d.fromJSON(props.yVector).freeze();\r\n }\r\n if (props.transform) {\r\n this._transform.setFromJSON(props.transform);\r\n this._transform.freeze();\r\n } else {\r\n let matrix;\r\n if (this.xVector && this.yVector) {\r\n const zVector = this.xVector.crossProduct(this.yVector);\r\n if (zVector.normalizeInPlace())\r\n matrix = Matrix3d.createColumns(this.xVector, this.yVector, zVector);\r\n }\r\n if (!matrix)\r\n matrix = this.orientation.toMatrix3d();\r\n\r\n this._transform = Transform.createOriginAndMatrix(this.origin, matrix);\r\n this._transform.freeze();\r\n }\r\n }\r\n\r\n /** Returns true if this EcefLocation is not located at the center of the Earth.\r\n * @alpha are locations very close to the center considered valid? What are the specific criteria?\r\n */\r\n public get isValid(): boolean {\r\n return !this.origin.isZero;\r\n }\r\n\r\n /** Construct ECEF Location from cartographic origin with optional known point and angle. */\r\n public static createFromCartographicOrigin(origin: Cartographic, point?: Point3d, angle?: Angle) {\r\n const ecefOrigin = origin.toEcef();\r\n const deltaRadians = 10 / Constant.earthRadiusWGS84.polar;\r\n const northCarto = Cartographic.fromRadians({ longitude: origin.longitude, latitude: origin.latitude + deltaRadians, height: origin.height });\r\n const eastCarto = Cartographic.fromRadians({ longitude: origin.longitude + deltaRadians, latitude: origin.latitude, height: origin.height });\r\n const ecefNorth = northCarto.toEcef();\r\n const ecefEast = eastCarto.toEcef();\r\n const xVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefEast).normalize());\r\n const yVector = expectDefined(Vector3d.createStartEnd(ecefOrigin, ecefNorth).normalize());\r\n const matrix = expectDefined(Matrix3d.createRigidFromColumns(xVector, yVector, AxisOrder.XYZ));\r\n if (angle !== undefined) {\r\n const north = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, angle);\r\n matrix.multiplyMatrixMatrix(north, matrix);\r\n }\r\n if (point !== undefined) {\r\n const delta = matrix.multiplyVector(Vector3d.create(-point.x, -point.y, -point.z));\r\n ecefOrigin.addInPlace(delta);\r\n }\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: expectDefined(YawPitchRollAngles.createFromMatrix3d(matrix)), cartographicOrigin: origin });\r\n }\r\n\r\n /** Construct ECEF Location from transform with optional position on the earth used to establish the ECEF origin and orientation. */\r\n public static createFromTransform(transform: Transform): EcefLocation {\r\n const ecefOrigin = transform.getOrigin();\r\n const angleFromInput = YawPitchRollAngles.createDegrees(0, 0, 0);\r\n const locationOrientationFromInputT = YawPitchRollAngles.createFromMatrix3d(transform.getMatrix(), angleFromInput);\r\n const transformProps = transform.toJSON();\r\n\r\n return new EcefLocation({ origin: ecefOrigin, orientation: locationOrientationFromInputT ?? angleFromInput, transform: transformProps });\r\n }\r\n\r\n /** Get the location center of the earth in the iModel coordinate system. */\r\n public get earthCenter(): Point3d {\r\n const matrix = this.orientation.toMatrix3d();\r\n return Point3d.createFrom(matrix.multiplyTransposeXYZ(-this.origin.x, -this.origin.y, -this.origin.z));\r\n }\r\n\r\n /** Return true if this location is equivalent to another location within a small tolerance. */\r\n public isAlmostEqual(other: EcefLocation): boolean {\r\n if (!this.origin.isAlmostEqual(other.origin) || !this.orientation.isAlmostEqual(other.orientation))\r\n return false;\r\n\r\n if ((this.xVector === undefined) !== (other.xVector === undefined) || (this.yVector === undefined) !== (other.yVector === undefined))\r\n return false;\r\n\r\n if (this.xVector !== undefined && other.xVector !== undefined && !this.xVector.isAlmostEqual(other.xVector))\r\n return false;\r\n\r\n if (this.yVector !== undefined && other.yVector !== undefined && !this.yVector.isAlmostEqual(other.yVector))\r\n return false;\r\n\r\n if (!this.getTransform().isAlmostEqual(other.getTransform()))\r\n return false;\r\n\r\n const thisCarto = this.cartographicOrigin;\r\n const otherCarto = other.cartographicOrigin;\r\n if (undefined === thisCarto || undefined === otherCarto)\r\n return undefined === thisCarto && undefined === otherCarto;\r\n\r\n return thisCarto.equalsEpsilon(otherCarto, Geometry.smallMetricDistance);\r\n }\r\n\r\n public toJSON(): EcefLocationProps {\r\n const props: Mutable<EcefLocationProps> = {\r\n origin: this.origin.toJSON(),\r\n orientation: this.orientation.toJSON(),\r\n transform: this.getTransform().toJSON(),\r\n };\r\n\r\n if (this.cartographicOrigin)\r\n props.cartographicOrigin = this.cartographicOrigin.toJSON();\r\n\r\n if (this.xVector)\r\n props.xVector = this.xVector.toJSON();\r\n\r\n if (this.yVector)\r\n props.yVector = this.yVector.toJSON();\r\n\r\n return props;\r\n }\r\n}\r\n\r\n/** Represents an iModel in JavaScript.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n * @public\r\n */\r\nexport abstract class IModel implements IModelProps {\r\n private _projectExtents?: AxisAlignedBox3d;\r\n private _name?: string;\r\n private _rootSubject?: RootSubjectProps;\r\n private _globalOrigin?: Point3d;\r\n private _ecefLocation?: EcefLocation;\r\n private _geographicCoordinateSystem?: GeographicCRS;\r\n private _iModelId?: GuidString;\r\n private _changeset: ChangesetIdWithIndex;\r\n\r\n /** The Id of the repository model. */\r\n public static readonly repositoryModelId: Id64String = \"0x1\";\r\n /** The Id of the root subject element. */\r\n public static readonly rootSubjectId: Id64String = \"0x1\";\r\n /** The Id of the dictionary model. */\r\n public static readonly dictionaryId: Id64String = \"0x10\";\r\n\r\n /** Event raised after [[name]] changes. */\r\n public readonly onNameChanged = new BeEvent<(previousName: string) => void>();\r\n /** Event raised after [[rootSubject]] changes. */\r\n public readonly onRootSubjectChanged = new BeEvent<(previousSubject: RootSubjectProps) => void>();\r\n /** Event raised after [[projectExtents]] changes. */\r\n public readonly onProjectExtentsChanged = new BeEvent<(previousExtents: AxisAlignedBox3d) => void>();\r\n /** Event raised after [[globalOrigin]] changes. */\r\n public readonly onGlobalOriginChanged = new BeEvent<(previousOrigin: Point3d) => void>();\r\n /** Event raised after [[ecefLocation]] changes. */\r\n public readonly onEcefLocationChanged = new BeEvent<(previousLocation: EcefLocation | undefined) => void>();\r\n /** Event raised after [[geographicCoordinateSystem]] changes. */\r\n public readonly onGeographicCoordinateSystemChanged = new BeEvent<(previousGCS: GeographicCRS | undefined) => void>();\r\n /** Event raised after [[changeset]] changes. */\r\n public readonly onChangesetChanged = new BeEvent<(previousChangeset: ChangesetIdWithIndex) => void>();\r\n\r\n /** Name of the iModel */\r\n public get name(): string {\r\n assert(this._name !== undefined);\r\n return this._name;\r\n }\r\n public set name(name: string) {\r\n if (name !== this._name) {\r\n const old = this._name;\r\n this._name = name;\r\n if (undefined !== old)\r\n this.onNameChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The name and description of the root subject of this iModel */\r\n public get rootSubject(): RootSubjectProps {\r\n assert(this._rootSubject !== undefined);\r\n return this._rootSubject;\r\n }\r\n public set rootSubject(subject: RootSubjectProps) {\r\n if (undefined === this._rootSubject || this._rootSubject.name !== subject.name || this._rootSubject.description !== subject.description) {\r\n const old = this._rootSubject;\r\n this._rootSubject = subject;\r\n if (old)\r\n this.onRootSubjectChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** Returns `true` if this is a snapshot iModel. */\r\n public abstract get isSnapshot(): boolean;\r\n /** Returns `true` if this is a briefcase copy of an iModel that is synchronized with iModelHub. */\r\n public abstract get isBriefcase(): boolean;\r\n\r\n public abstract get isOpen(): boolean;\r\n\r\n /**\r\n * The volume, in spatial coordinates, inside which the entire project is contained.\r\n * @note The object returned from this method is frozen. You *must* make a copy before you do anything that might attempt to modify it.\r\n */\r\n public get projectExtents() {\r\n assert(undefined !== this._projectExtents);\r\n return this._projectExtents;\r\n }\r\n public set projectExtents(extents: AxisAlignedBox3d) {\r\n // Don't allow any axis of the project extents to be less than 1 meter.\r\n const projectExtents = extents.clone();\r\n projectExtents.ensureMinLengths(1.0);\r\n if (!this._projectExtents || !this._projectExtents.isAlmostEqual(projectExtents)) {\r\n const old = this._projectExtents;\r\n projectExtents.freeze();\r\n this._projectExtents = projectExtents;\r\n if (old)\r\n this.onProjectExtentsChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** An offset to be applied to all spatial coordinates. */\r\n public get globalOrigin(): Point3d {\r\n assert(this._globalOrigin !== undefined);\r\n return this._globalOrigin;\r\n }\r\n public set globalOrigin(org: Point3d) {\r\n if (!this._globalOrigin || !this._globalOrigin.isAlmostEqual(org)) {\r\n const old = this._globalOrigin;\r\n org.freeze();\r\n this._globalOrigin = org;\r\n if (old)\r\n this.onGlobalOriginChanged.raiseEvent(old);\r\n }\r\n }\r\n\r\n /** The [EcefLocation]($docs/learning/glossary#ecefLocation) of the iModel in Earth Centered Earth Fixed coordinates.\r\n * If the iModel property geographicCoordinateSystem is not defined then the ecefLocation provides a geolocation by defining a\r\n * 3D coordinate system relative to the Earth model WGS84. Refer to additional documentation for details. If the geographicCoordinateSystem\r\n * property is defined then the ecefLocation must be used with care. When the geographicCoordinateSystem is defined it indicates the\r\n * iModel cartesian space is the result of a cartographic projection. This implies a flattening of the Earth surface process that\r\n * results in scale, angular or area distortion. The ecefLocation is then an approximation calculated at the center of the project extent.\r\n * If the project is more than 2 kilometer in size, the ecefLocation may represent a poor approximation of the effective\r\n * cartographic projection used and a linear transformation should then be calculated at the exact origin of the data\r\n * it must position.\r\n * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md)\r\n */\r\n public get ecefLocation(): EcefLocation | undefined {\r\n return this._ecefLocation;\r\n }\r\n public set ecefLocation(ecefLocation: EcefLocation | undefined) {\r\n const old = this._ecefLocation;\r\n if (!old && !ecefLocation)\r\n return;\r\n else if (old && ecefLocation && old.isAlmostEqual(ecefLocation))\r\n return;\r\n\r\n this._ecefLocation = ecefLocation;\r\n this.onEcefLocationChanged.raiseEvent(old);\r\n }\r\n\r\n /** Set the [EcefLocation]($docs/learning/glossary#ecefLocation) for this iModel. */\r\n public setEcefLocation(ecef: EcefLocationProps): void {\r\n this.ecefLocation = new EcefLocation(ecef);\r\n }\r\n\r\n /** The geographic coordinate reference system of the iModel. */\r\n public get geographicCoordinateSystem(): GeographicCRS | undefined {\r\n return this._geographicCoordinateSystem;\r\n }\r\n public set geographicCoordinateSystem(geoCRS: GeographicCRS | undefined) {\r\n const old = this._geographicCoordinateSystem;\r\n if (!old && !geoCRS)\r\n return;\r\n else if (old && geoCRS && old.equals(geoCRS))\r\n return;\r\n\r\n this._geographicCoordinateSystem = geoCRS;\r\n this.onGeographicCoordinateSystemChanged.raiseEvent(old);\r\n }\r\n\r\n /** Sets the geographic coordinate reference system from GeographicCRSProps. */\r\n public setGeographicCoordinateSystem(geoCRS: GeographicCRSProps) {\r\n this.geographicCoordinateSystem = new GeographicCRS(geoCRS);\r\n }\r\n\r\n /** @internal */\r\n public getConnectionProps(): IModelConnectionProps {\r\n return {\r\n name: this.name,\r\n rootSubject: this.rootSubject,\r\n projectExtents: this.projectExtents.toJSON(),\r\n globalOrigin: this.globalOrigin.toJSON(),\r\n ecefLocation: this.ecefLocation,\r\n geographicCoordinateSystem: this.geographicCoordinateSystem?.toJSON(),\r\n ...this._getRpcProps(),\r\n };\r\n }\r\n\r\n /** Convert this iModel to a JSON representation. */\r\n public toJSON(): IModelConnectionProps {\r\n return this.getConnectionProps();\r\n }\r\n\r\n /** A key used to identify this iModel in RPC calls from frontend to backend.\r\n * @internal\r\n */\r\n protected _fileKey: string;\r\n /** Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications. */\r\n public get key(): string { return this._fileKey; }\r\n\r\n /** @internal */\r\n protected _iTwinId?: GuidString;\r\n /** The Guid that identifies the iTwin that owns this iModel. */\r\n public get iTwinId(): GuidString | undefined { return this._iTwinId; }\r\n\r\n /** The Guid that identifies this iModel. */\r\n public get iModelId(): GuidString | undefined { return this._iModelId; }\r\n\r\n /** @public */\r\n public get changeset(): ChangesetIdWithIndex {\r\n return { ...this._changeset };\r\n }\r\n public set changeset(changeset: ChangesetIdWithIndex) {\r\n const prev = this._changeset;\r\n if (prev.id !== changeset.id || prev.index !== changeset.index) {\r\n this._changeset = { id: changeset.id, index: changeset.index };\r\n this.onChangesetChanged.raiseEvent(prev);\r\n }\r\n }\r\n\r\n protected _openMode = OpenMode.Readonly;\r\n /** The [[OpenMode]] used for this IModel. */\r\n public get openMode(): OpenMode { return this._openMode; }\r\n\r\n /** Return a token for RPC operations.\r\n * @throws IModelError if the iModel is not open.\r\n */\r\n public getRpcProps(): IModelRpcProps {\r\n if (!this.isOpen)\r\n throw new IModelError(IModelStatus.BadRequest, \"IModel is not open for rpc\");\r\n\r\n return this._getRpcProps();\r\n }\r\n\r\n /** Returns the iModel's RPC properties.\r\n * @note It is an error to attempt to use these properties as a token for RPC operations if the iModel is not open.\r\n * @internal\r\n */\r\n protected _getRpcProps(): IModelRpcProps {\r\n return {\r\n key: this._fileKey,\r\n iTwinId: this.iTwinId,\r\n iModelId: this.iModelId,\r\n changeset: this.changeset,\r\n };\r\n }\r\n\r\n /** @internal */\r\n protected constructor(tokenProps?: IModelRpcProps) {\r\n this._changeset = tokenProps?.changeset ?? { id: \"\", index: 0 };\r\n this._fileKey = \"\";\r\n if (tokenProps) {\r\n this._fileKey = tokenProps.key;\r\n this._iTwinId = tokenProps.iTwinId;\r\n this._iModelId = tokenProps.iModelId;\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected initialize(name: string, props: IModelProps) {\r\n this.name = name;\r\n this.rootSubject = props.rootSubject;\r\n this.projectExtents = Range3d.fromJSON(props.projectExtents);\r\n this.globalOrigin = Point3d.fromJSON(props.globalOrigin);\r\n\r\n const ecefLocation = props.ecefLocation ? new EcefLocation(props.ecefLocation) : undefined;\r\n this.ecefLocation = ecefLocation?.isValid ? ecefLocation : undefined;\r\n\r\n this.geographicCoordinateSystem = props.geographicCoordinateSystem ? new GeographicCRS(props.geographicCoordinateSystem) : undefined;\r\n }\r\n\r\n /** Get the default subCategoryId for the supplied categoryId */\r\n public static getDefaultSubCategoryId(categoryId: Id64String): Id64String {\r\n return Id64.isValid(categoryId) ? Id64.fromLocalAndBriefcaseIds(Id64.getLocalId(categoryId) + 1, Id64.getBriefcaseId(categoryId)) : Id64.invalid;\r\n }\r\n\r\n /** True if this iModel has an [EcefLocation]($docs/learning/glossary#ecefLocation). */\r\n public get isGeoLocated() { return undefined !== this._ecefLocation; }\r\n\r\n /** Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its [[IModel.ecefLocation]].\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public getEcefTransform(): Transform {\r\n if (undefined === this._ecefLocation)\r\n throw new IModelError(GeoServiceStatus.NoGeoLocation, \"iModel is not GeoLocated\");\r\n return this._ecefLocation.getTransform();\r\n }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to an ECEF point using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in ECEF coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d { return this.getEcefTransform().multiplyPoint3d(spatial, result); }\r\n\r\n /** Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its [[ecefLocation]].\r\n * @param ecef A point in ECEF coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Point3d in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d { return expectDefined(this.getEcefTransform().multiplyInversePoint3d(ecef, result)); }\r\n\r\n /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using its [[IModel.ecefLocation]].\r\n * @param spatial A point in the iModel's spatial coordinates\r\n * @param result If defined, use this for output\r\n * @returns A Cartographic location\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n */\r\n public spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic { return expectDefined(Cartographic.fromEcef(this.spatialToEcef(spatial), result)); }\r\n\r\n /** Convert a [[Cartographic]] to a point in this iModel's Spatial coordinates using its [[IModel.ecefLocation]].\r\n * @param cartographic A cartographic location\r\n * @param result If defined, use this for output\r\n * @returns A point in this iModel's spatial coordinates\r\n * @throws IModelError if [[isGeoLocated]] is false.\r\n * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel.\r\n */\r\n public cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d) { return this.ecefToSpatial(cartographic.toEcef(result), result); }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-common",
3
- "version": "5.5.0",
3
+ "version": "5.6.0-dev.1",
4
4
  "description": "iTwin.js components common to frontend and backend",
5
5
  "main": "lib/cjs/core-common.js",
6
6
  "module": "lib/esm/core-common.js",
@@ -27,8 +27,8 @@
27
27
  "js-base64": "^3.6.1"
28
28
  },
29
29
  "peerDependencies": {
30
- "@itwin/core-bentley": "5.5.0",
31
- "@itwin/core-geometry": "5.5.0"
30
+ "@itwin/core-bentley": "5.6.0-dev.1",
31
+ "@itwin/core-geometry": "5.6.0-dev.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@itwin/eslint-plugin": "5.2.2-dev.2",
@@ -42,9 +42,9 @@
42
42
  "rimraf": "^6.0.1",
43
43
  "typescript": "~5.6.2",
44
44
  "vitest": "^3.0.6",
45
- "@itwin/build-tools": "5.5.0",
46
- "@itwin/core-geometry": "5.5.0",
47
- "@itwin/core-bentley": "5.5.0"
45
+ "@itwin/build-tools": "5.6.0-dev.1",
46
+ "@itwin/core-bentley": "5.6.0-dev.1",
47
+ "@itwin/core-geometry": "5.6.0-dev.1"
48
48
  },
49
49
  "nyc": {
50
50
  "extends": "./node_modules/@itwin/build-tools/.nycrc",