@itwin/core-frontend 5.9.2 → 5.9.4

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,6 +1,18 @@
1
1
  # Change Log - @itwin/core-frontend
2
2
 
3
- This log was last generated on Fri, 08 May 2026 20:36:41 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 19 May 2026 19:45:27 GMT and should not be manually modified.
4
+
5
+ ## 5.9.4
6
+ Tue, 19 May 2026 19:45:27 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.9.3
11
+ Fri, 15 May 2026 11:25:54 GMT
12
+
13
+ ### Updates
14
+
15
+ - Fix crash in BackgroundMapGeometry.getFrustumIntersectionDepthRange when an iModel without an ecefLocation has a global context reality model.
4
16
 
5
17
  ## 5.9.2
6
18
  Fri, 08 May 2026 20:36:41 GMT
@@ -30,6 +42,13 @@ Mon, 04 May 2026 16:32:08 GMT
30
42
  - Added async versions of Txn reverse and reinstate operations, and added support for abandoning locks when reversing Txns.
31
43
  - Fix event listener leak in LayerTileTreeReferenceHandler
32
44
 
45
+ ## 5.8.5
46
+ Thu, 14 May 2026 19:12:21 GMT
47
+
48
+ ### Updates
49
+
50
+ - Fix crash in BackgroundMapGeometry.getFrustumIntersectionDepthRange when an iModel without an ecefLocation has a global context reality model.
51
+
33
52
  ## 5.8.4
34
53
  Thu, 23 Apr 2026 18:05:14 GMT
35
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundMapGeometry.d.ts","sourceRoot":"","sources":["../../src/BackgroundMapGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAA2E,SAAS,EAA6C,QAAQ,EAAE,4BAA4B,EAAW,OAAO,EAAW,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9S,OAAO,EAAE,YAAY,EAAyB,OAAO,EAAkB,SAAS,EA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;GAGG;AACH,wBAAsB,oCAAoC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAsCtI"}
@@ -305,7 +305,14 @@ class BackgroundMapGeometry {
305
305
  const eyePoint4d = eyePoint ? core_geometry_1.Point4d.createFromPointAndWeight(eyePoint, 1) : core_geometry_1.Point4d.createFromPointAndWeight(viewZ, 0);
306
306
  for (const radiusOffset of radiusOffsets) {
307
307
  const ellipsoid = this.getEarthEllipsoid(radiusOffset);
308
- const isInside = eyePoint && (0, core_bentley_1.expectDefined)(ellipsoid.worldToLocal(eyePoint)).magnitude() < 1.0;
308
+ const eyeLocal = eyePoint ? ellipsoid.worldToLocal(eyePoint) : undefined;
309
+ if (eyePoint && undefined === eyeLocal) {
310
+ // If the globe transform cannot map the eye point into ellipsoid-local
311
+ // space, treat the globe as unavailable here and let the caller fall
312
+ // back to its extents-based depth fitting.
313
+ return core_geometry_1.Range1d.createNull();
314
+ }
315
+ const isInside = eyeLocal !== undefined && eyeLocal.magnitude() < 1.0;
309
316
  const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);
310
317
  const clipPlaneCount = clipPlanes.planes.length;
311
318
  // Extrema...
@@ -335,10 +342,22 @@ class BackgroundMapGeometry {
335
342
  if (core_geometry_1.Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)
336
343
  scratchSilhouetteNormal.negate(scratchSilhouetteNormal);
337
344
  }
338
- clipPlanes.planes.push((0, core_bentley_1.expectDefined)(core_geometry_1.ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))));
345
+ // The silhouette arc is the horizon between the visible and hidden
346
+ // halves of the globe. Its perpendicular vector is the normal of the
347
+ // clip plane that keeps us on the visible side. If that plane cannot
348
+ // be constructed, fall back to a view-aligned plane through the
349
+ // ellipsoid center instead of pushing an invalid entry.
350
+ const silhouettePlane = core_geometry_1.ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))
351
+ ?? core_geometry_1.ClipPlane.createNormalAndPoint(viewZ, center);
352
+ if (undefined === silhouettePlane)
353
+ return core_geometry_1.Range1d.createNull();
354
+ clipPlanes.planes.push(silhouettePlane);
339
355
  }
340
356
  else {
341
- clipPlanes.planes.push((0, core_bentley_1.expectDefined)(core_geometry_1.ClipPlane.createNormalAndPoint(viewZ, center)));
357
+ const centerPlane = core_geometry_1.ClipPlane.createNormalAndPoint(viewZ, center);
358
+ if (undefined === centerPlane)
359
+ return core_geometry_1.Range1d.createNull();
360
+ clipPlanes.planes.push(centerPlane);
342
361
  }
343
362
  }
344
363
  if (!isInside || radiusOffset === radiusOffsets[0]) {
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundMapGeometry.js","sourceRoot":"","sources":["../../src/BackgroundMapGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAmDH,sFAOC;AAwZD,oFAsCC;AAtfD,sDAA4D;AAC5D,wDAA8S;AAC9S,oDAAyH;AAGzH,8CAA0D;AAE1D,MAAM,YAAY,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC1C,MAAM,gBAAgB,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC9C,MAAM,YAAY,GAAG,uBAAO,CAAC,MAAM,EAAE,CAAC;AACtC,MAAM,aAAa,GAAG,wBAAQ,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,kBAAkB,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAChD,MAAM,mBAAmB,GAAG,qBAAK,CAAC,MAAM,CAAC,uBAAO,CAAC,MAAM,EAAE,EAAE,wBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9E,MAAM,eAAe,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC7C,MAAM,mBAAmB,GAAG,wBAAQ,CAAC,cAA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C/D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC1B,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAY,sBAAsB;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,wBAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,IAAI,MAAM,KAAK,SAAS;QACtB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,yBAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;AACnF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { assert, expectDefined } from \"@itwin/core-bentley\";\nimport { Angle, Arc3d, ClipPlane, ClipPlaneContainment, Constant, CurvePrimitive, Ellipsoid, GrowableXYZArray, LongitudeLatitudeNumber, Matrix3d, Plane3dByOriginAndUnitNormal, Point2d, Point3d, Point4d, Range1d, Range3d, Ray3d, Transform, Vector3d, WritableXYAndZ, XYAndZ } from \"@itwin/core-geometry\";\nimport { Cartographic, ColorByName, ColorDef, Frustum, GeoCoordStatus, GlobeMode, LinePixels } from \"@itwin/core-common\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { WebMercatorTilingScheme } from \"./tile/internal\";\n\nconst scratchRange = Range3d.createNull();\nconst scratchZeroPoint = Point3d.createZero();\nconst scratchPoint = Point3d.create();\nconst scratchVector = Vector3d.create();\nconst scratchCenterPoint = Point3d.createZero();\nconst scratchIntersectRay = Ray3d.create(Point3d.create(), Vector3d.create());\nconst scratchEyePoint = Point3d.createZero();\nconst scratchViewRotation = Matrix3d.createIdentity();\nconst scratchSilhouetteNormal = Vector3d.create();\nconst scratchCartoRectangle = new GrowableXYZArray();\nconst scratchWorkArray = new GrowableXYZArray();\n\nfunction accumulateDepthRange(point: Point3d, viewRotation: Matrix3d, range: Range3d) {\n viewRotation.multiplyXYZtoXYZ(point, scratchPoint);\n range.extend(scratchPoint);\n}\n\nfunction accumulateFrustumPlaneDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal, viewRotation: Matrix3d, range: Range3d, eyePoint?: Point3d) {\n let includeHorizon = false;\n for (let i = 0; i < 4; i++) {\n const frustumRay = Ray3d.createStartEnd(eyePoint ? eyePoint : frustum.points[i + 4], frustum.points[i]);\n const thisFraction = frustumRay.intersectionWithPlane(plane, scratchPoint);\n if (undefined !== thisFraction && (!eyePoint || thisFraction > 0))\n accumulateDepthRange(scratchPoint, viewRotation, range);\n else\n includeHorizon = true;\n }\n if (includeHorizon) {\n if (eyePoint !== undefined) {\n const eyeHeight = plane.altitude(eyePoint);\n if (eyeHeight < 0)\n accumulateDepthRange(eyePoint, viewRotation, range);\n else {\n const viewZ = viewRotation.getRow(2);\n const horizonDistance = Math.sqrt(eyeHeight * eyeHeight + 2 * eyeHeight * Constant.earthRadiusWGS84.equator);\n accumulateDepthRange(eyePoint.plusScaled(viewZ, -horizonDistance, scratchPoint), viewRotation, range);\n }\n }\n }\n}\n\n/** @internal */\nexport function getFrustumPlaneIntersectionDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal): Range1d {\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewRotation = expectDefined(frustum.getRotation(scratchViewRotation));\n const intersectRange = Range3d.createNull();\n accumulateFrustumPlaneDepthRange(frustum, plane, viewRotation, intersectRange, eyePoint);\n\n return intersectRange.isNull ? Range1d.createNull() : Range1d.createXX(intersectRange.low.z, intersectRange.high.z);\n}\n\n/** Geometry of background map - either an ellipsoid or a plane as defined by GlobeMode.\n * @internal\n */\nexport class BackgroundMapGeometry {\n public readonly globeMode: GlobeMode;\n public readonly geometry: Plane3dByOriginAndUnitNormal | Ellipsoid;\n public readonly globeOrigin: Point3d;\n public readonly globeMatrix: Matrix3d;\n public readonly cartesianRange: Range3d;\n public readonly cartesianTransitionRange: Range3d;\n public readonly cartesianPlane: Plane3dByOriginAndUnitNormal;\n public readonly cartesianDiagonal: number;\n public readonly cartesianChordHeight: number;\n public readonly maxGeometryChordHeight: number;\n private _mercatorFractionToDb: Transform;\n private _mercatorTilingScheme: WebMercatorTilingScheme;\n private _ecefToDb: Transform;\n public static maxCartesianDistance = 1E4; // If globe is 3D we still consider the map geometry flat within this distance of the project extents.\n private static _transitionDistanceMultiplier = .25; // In the transition range which extends beyond the cartesian range we interpolate between cartesian and ellipsoid.\n\n private static _scratchRayFractions = new Array<number>();\n private static _scratchRayAngles = new Array<LongitudeLatitudeNumber>();\n private static _scratchPoint = Point3d.createZero();\n\n constructor(private _bimElevationBias: number, globeMode: GlobeMode, private _iModel: IModelConnection) {\n this._ecefToDb = _iModel.getMapEcefToDb(_bimElevationBias);\n this.globeMode = globeMode;\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(_iModel);\n this.cartesianTransitionRange = this.cartesianRange.clone();\n this.cartesianTransitionRange.expandInPlace(BackgroundMapGeometry.getCartesianTransitionDistance(_iModel));\n this.cartesianDiagonal = this.cartesianRange.diagonal().magnitudeXY();\n const earthRadius = Constant.earthRadiusWGS84.equator;\n this.globeOrigin = this._ecefToDb.origin.cloneAsPoint3d();\n this.globeMatrix = this._ecefToDb.matrix.clone();\n this.cartesianChordHeight = Math.sqrt(this.cartesianDiagonal * this.cartesianDiagonal + earthRadius * earthRadius) - earthRadius; // Maximum chord height deviation of the cartesian area.\n const halfChordAngle = Angle.piOver2Radians / 10;\n this.maxGeometryChordHeight = (1 - Math.cos(halfChordAngle)) * earthRadius;\n this.cartesianPlane = this.getPlane();\n this.geometry = (globeMode === GlobeMode.Ellipsoid) ? this.getEarthEllipsoid() : this.cartesianPlane;\n this._mercatorTilingScheme = new WebMercatorTilingScheme();\n this._mercatorFractionToDb = this._mercatorTilingScheme.computeMercatorFractionToDb(this._ecefToDb, _bimElevationBias, _iModel, false);\n }\n public static getCartesianRange(iModel: IModelConnection, result?: Range3d): Range3d {\n const cartesianRange = Range3d.createFrom(iModel.projectExtents, result);\n cartesianRange.expandInPlace(BackgroundMapGeometry.maxCartesianDistance);\n return cartesianRange;\n }\n public static getCartesianTransitionDistance(iModel: IModelConnection): number {\n return BackgroundMapGeometry.getCartesianRange(iModel, scratchRange).diagonal().magnitudeXY() * BackgroundMapGeometry._transitionDistanceMultiplier;\n }\n\n public async dbToCartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]> {\n const scratch = new Point3d();\n const promises = db.map(async (p) => {\n return this.cartesianRange.containsPoint(Point3d.createFrom(p, scratch)) ? this._iModel.spatialToCartographic(p) : this.dbToCartographic(p);\n });\n\n return Promise.all(promises);\n }\n\n public async dbToWGS84CartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]> {\n if (db.length === 0)\n return [];\n\n const result: Cartographic[] = Array(db.length);\n const reproject: XYAndZ[] = [];\n const reprojectIdx: number[] = [];\n const scratch = new Point3d();\n for (let i = 0; i < db.length; i++) {\n Point3d.createFrom(db[i], scratch);\n if (this.cartesianRange.containsPoint(scratch) ) {\n reprojectIdx.push(i);\n reproject.push(db[i]);\n } else {\n result[i] = this.dbToCartographic(db[i]);\n }\n }\n\n if (reproject.length === 0)\n return result;\n\n const reprojectPromise = this._iModel.wgs84CartographicFromSpatial(reproject);\n return reprojectPromise.then((reprojected) => {\n if (reprojected.length === reprojectIdx.length) { // reprojected array size must match our index array, otherwise something is OFF\n for (let i = 0; i < reprojected.length; i++) {\n result[reprojectIdx[i]] = reprojected[i]; // Insert the reprojected values at their original index\n }\n }\n return result;\n });\n }\n\n public dbToCartographic(db: XYAndZ, result?: Cartographic): Cartographic {\n if (undefined === result)\n result = Cartographic.createZero();\n\n if (this.globeMode === GlobeMode.Plane) {\n const mercatorFraction = expectDefined(this._mercatorFractionToDb.multiplyInversePoint3d(db));\n return this._mercatorTilingScheme.fractionToCartographic(mercatorFraction.x, mercatorFraction.y, result, mercatorFraction.z);\n } else {\n const ecef = expectDefined(this._ecefToDb.multiplyInversePoint3d(db));\n return expectDefined(Cartographic.fromEcef(ecef, result));\n }\n }\n\n public async cartographicToDbFromGcs(cartographic: Cartographic[]): Promise<Point3d[]> {\n let db;\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n db = cartographic.map((p) => {\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\n });\n } else {\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef()));\n }\n\n if (this._iModel.noGcsDefined)\n return db;\n\n const promises = db.map(async (p, i) => {\n return this.cartesianRange.containsPoint(p) ? this._iModel.cartographicToSpatialFromGcs(cartographic[i]) : p;\n });\n\n return Promise.all(promises);\n }\n\n public async cartographicToDbFromWgs84Gcs(cartographic: Cartographic[]): Promise<Point3d[]> {\n let db;\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n db = cartographic.map((p) => {\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\n });\n } else {\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef()));\n }\n\n if (this._iModel.noGcsDefined)\n return db;\n\n const toReprojectCoords: WritableXYAndZ[] = [];\n const toReprojectIdx: number[] = [];\n db.forEach(async (p, i) => {\n if (this.cartesianRange.containsPoint(p)) {\n toReprojectCoords.push({x:cartographic[i].longitudeDegrees, y:cartographic[i].latitudeDegrees, z:cartographic[i].height});\n toReprojectIdx.push(i);\n }\n });\n const spatialPoints = await this._iModel.toSpatialFromGcs(toReprojectCoords, { horizontalCRS: { epsg: 4326 }, verticalCRS: { id: \"ELLIPSOID\" } });\n return db.map((p, i) => {\n const reprojectedIdx = toReprojectIdx.findIndex((value) => value === i);\n return (reprojectedIdx === -1 ? p : spatialPoints[reprojectedIdx]);\n });\n }\n\n public cartographicToDb(cartographic: Cartographic, result?: Point3d): Point3d {\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\n } else {\n return this._ecefToDb.multiplyPoint3d(cartographic.toEcef());\n }\n }\n\n public getEarthEllipsoid(radiusOffset = 0): Ellipsoid {\n const equatorRadius = Constant.earthRadiusWGS84.equator + radiusOffset, polarRadius = Constant.earthRadiusWGS84.polar + radiusOffset;\n return Ellipsoid.createCenterMatrixRadii(this.globeOrigin, this.globeMatrix, equatorRadius, equatorRadius, polarRadius);\n }\n\n public getPlane(offset = 0) {\n return expectDefined(Plane3dByOriginAndUnitNormal.create(Point3d.create(0, 0, this._bimElevationBias + offset), Vector3d.create(0, 0, 1)));\n }\n\n public getRayIntersection(ray: Ray3d, positiveOnly: boolean): Ray3d | undefined {\n let intersect;\n if (this.globeMode === GlobeMode.Ellipsoid) {\n const ellipsoid = this.geometry as Ellipsoid;\n BackgroundMapGeometry._scratchRayAngles.length = 0;\n BackgroundMapGeometry._scratchRayFractions.length = 0;\n\n const count = ellipsoid.intersectRay(ray, BackgroundMapGeometry._scratchRayFractions, undefined, BackgroundMapGeometry._scratchRayAngles);\n let intersectDistance;\n for (let i = 0; i < count; i++) {\n const thisFraction = BackgroundMapGeometry._scratchRayFractions[i];\n if ((!positiveOnly || thisFraction > 0) && (undefined === intersectDistance || thisFraction < intersectDistance)) {\n intersectDistance = thisFraction;\n intersect = scratchIntersectRay;\n ellipsoid.radiansToUnitNormalRay(BackgroundMapGeometry._scratchRayAngles[i].longitudeRadians, BackgroundMapGeometry._scratchRayAngles[i].latitudeRadians, intersect);\n if (intersect.direction.dotProduct(ray.direction) < 0) {\n if (this.cartesianRange.containsPoint(intersect.origin)) { // If we're in the cartesian range, correct to planar intersection.\n const planeFraction = ray.intersectionWithPlane(this.cartesianPlane, scratchIntersectRay.origin);\n if (undefined !== planeFraction && (!positiveOnly || planeFraction > 0)) {\n intersect.direction.setFromVector3d(this.cartesianPlane.getNormalRef());\n }\n }\n }\n }\n }\n } else {\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\n const thisFraction = ray.intersectionWithPlane(plane, scratchIntersectRay.origin);\n if (undefined !== thisFraction && (!positiveOnly || thisFraction > 0)) {\n intersect = scratchIntersectRay;\n intersect.direction.setFromVector3d(plane.getNormalRef());\n }\n }\n return intersect;\n }\n public getPointHeight(point: Point3d): number | undefined {\n if (this.globeMode === GlobeMode.Ellipsoid) {\n const ellipsoid = this.geometry as Ellipsoid;\n const projected = ellipsoid.projectPointToSurface(point);\n if (undefined === projected)\n return undefined;\n\n const distance = ellipsoid.radiansToPoint(projected.longitudeRadians, projected.latitudeRadians).distance(point);\n const ellipsePoint = expectDefined(ellipsoid.transformRef.multiplyInversePoint3d(point, BackgroundMapGeometry._scratchPoint));\n return ellipsePoint.magnitude() < 1 ? -distance : distance;\n } else {\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\n return plane.altitude(point);\n }\n }\n\n /** @internal */\n public getFrustumIntersectionDepthRange(frustum: Frustum, bimRange: Range3d, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewRotation = frustum.getRotation(scratchViewRotation);\n if (undefined === viewRotation)\n return Range1d.createNull(); // Degenerate frustum...\n const viewZ = viewRotation.getRow(2);\n const cartoRange = this.cartesianTransitionRange;\n const intersectRange = Range3d.createNull();\n const doAccumulate = ((point: Point3d) => accumulateDepthRange(point, viewRotation, intersectRange));\n\n if (gridPlane)\n accumulateFrustumPlaneDepthRange(frustum, gridPlane, viewRotation, intersectRange, eyePoint);\n if (this.geometry instanceof Plane3dByOriginAndUnitNormal) {\n // Intersection with a planar background projection...\n const heights = heightRange ? [heightRange.low, heightRange.high] : [0];\n for (const height of heights) {\n accumulateFrustumPlaneDepthRange(frustum, this.getPlane(height), viewRotation, intersectRange, eyePoint);\n }\n } else {\n const minOffset = heightRange ? heightRange.low : 0, maxOffset = (heightRange ? heightRange.high : 0) + this.cartesianChordHeight;\n const radiusOffsets = [minOffset, maxOffset];\n\n // If we are doing global scope then include minimum ellipsoid that represents the chordal approximation of the low level tiles.\n // this substantially expands the frustum so don't do it for non-global views, but this clipping out the low level tiles.\n if (doGlobalScope)\n radiusOffsets.push(minOffset - this.maxGeometryChordHeight);\n\n const toView = Transform.createRefs(Point3d.createZero(), viewRotation);\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\n\n for (const radiusOffset of radiusOffsets) {\n const ellipsoid = this.getEarthEllipsoid(radiusOffset);\n const isInside = eyePoint && expectDefined(ellipsoid.worldToLocal(eyePoint)).magnitude() < 1.0;\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\n const clipPlaneCount = clipPlanes.planes.length;\n\n // Extrema...\n let angles, extremaPoint;\n if (undefined !== (angles = ellipsoid.surfaceNormalToAngles(viewZ)) &&\n undefined !== (extremaPoint = ellipsoid.radiansToPoint(angles.longitudeRadians, angles.latitudeRadians)) &&\n (eyePoint === undefined || viewZ.dotProductStartEnd(extremaPoint, eyePoint) > 0) &&\n clipPlanes.classifyPointContainment([extremaPoint], false) !== ClipPlaneContainment.StronglyOutside)\n doAccumulate(extremaPoint);\n\n if (isInside) {\n if (eyePoint)\n doAccumulate(eyePoint);\n } else {\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\n if (silhouette !== undefined) {\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\n // Push the silhouette plane as clip so that we do not include geometry at other side of ellipsoid.\n // First make sure that it is pointing in the right direction.\n if (eyePoint) {\n // Clip toward eye.\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n } else {\n /* If parallel projection - clip toward side of ellipsoid with BIM geometry */\n if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n }\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))));\n } else {\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndPoint(viewZ, center)));\n }\n }\n if (!isInside || radiusOffset === radiusOffsets[0]) {\n // Intersections of ellipsoid with frustum planes...\n const viewingInside = eyePoint !== undefined && viewZ.dotProduct(Vector3d.createStartEnd(center, eyePoint)) < 0;\n if (eyePoint === undefined || !isInside || viewingInside) {\n for (const clipPlane of clipPlanes.planes) {\n const plane = clipPlane.getPlane3d();\n const arc = ellipsoid.createPlaneSection(plane);\n if (undefined !== arc) {\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\n if (Math.abs(a1 - a0) < 1.0E-8) {\n doAccumulate(cp.fractionToPoint(a0)); // Tiny sweep - avoid problem with rangeMethod (not worth doing anyway).\n } else {\n const segment = cp.clonePartialCurve(a0, a1);\n if (segment !== undefined)\n segment.extendRange(intersectRange, toView);\n\n }\n });\n }\n }\n }\n // Intersections of the cartesian region with frustum planes.\n scratchCartoRectangle.resize(0);\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\n\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\n for (let i = 0; i < scratchCartoRectangle.length; i++)\n doAccumulate(scratchCartoRectangle.getPoint3dAtUncheckedPointIndex(i));\n while (clipPlanes.planes.length > clipPlaneCount) // Remove pushed silhouette plane.\n clipPlanes.planes.pop();\n }\n }\n }\n\n if (intersectRange.zLength() < 5) {\n // For the case where the fitted depth is small (less than 5 meters) we must be viewing planar projection or the\n // planar portion of the iModel in plan view. In this case use a constant (arbitrarily 100 meters) depth so that the frustum\n // Z is doesn't change and cause nearly planar geometry to jitter in Z buffer.\n const zCenter = (intersectRange.low.z + intersectRange.high.z) / 2;\n const zExpand = 50;\n return Range1d.createXX(zCenter - zExpand, zCenter + zExpand);\n } else {\n const diagonal = intersectRange.diagonal(scratchVector).magnitudeXY();\n const expansion = diagonal * .01;\n return Range1d.createXX(intersectRange.low.z - expansion, intersectRange.high.z + expansion);\n }\n }\n\n public addFrustumDecorations(builder: GraphicBuilder, frustum: Frustum) {\n if (this.geometry instanceof Ellipsoid) {\n const ellipsoid = this.geometry;\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\n const viewRotation = expectDefined(frustum.getRotation());\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewZ = viewRotation.getRow(2);\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\n const isInside = eyePoint && expectDefined(ellipsoid.worldToLocal(eyePoint)).magnitude() < 1.0;\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\n const cartoRange = this.cartesianTransitionRange;\n\n if (!isInside) {\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\n if (silhouette !== undefined) {\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))));\n } else {\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndPoint(viewZ, center)));\n }\n\n const ellipsoidColor = ColorDef.create(ColorByName.yellow);\n builder.setSymbology(ellipsoidColor, ellipsoidColor, 1, LinePixels.Code2);\n for (const clipPlane of clipPlanes.planes) {\n const plane = clipPlane.getPlane3d();\n const arc = ellipsoid.createPlaneSection(plane);\n if (undefined !== arc) {\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\n const segment = cp.clonePartialCurve(a0, a1);\n if (segment !== undefined)\n builder.addArc(segment as Arc3d, false, false);\n });\n }\n\n // Intersections of the cartesian region with frustum planes.\n scratchCartoRectangle.resize(0);\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\n\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\n if (scratchCartoRectangle.length > 0) {\n builder.addLineString(scratchCartoRectangle.getPoint3dArray());\n }\n }\n }\n }\n }\n}\n\n/** Calculate the ECEF to database (IModel) coordinate transform at a provided location, using the GCS of the iModel.\n * The transform will exactly represent the GCS at the provided location.\n * @public\n */\nexport async function calculateEcefToDbTransformAtLocation(originIn: Point3d, iModel: IModelConnection): Promise<Transform | undefined> {\n const geoConverter = iModel.noGcsDefined ? undefined : iModel.geoServices.getConverter(\"WGS84\");\n if (geoConverter === undefined)\n return undefined;\n\n const origin = Point3d.create(originIn.x, originIn.y, 0); // Always Test at zero.\n const eastPoint = origin.plusXYZ(1, 0, 0);\n const northPoint = origin.plusXYZ(0, 1, 0);\n\n const response = await geoConverter.getGeoCoordinatesFromIModelCoordinates([origin, northPoint, eastPoint]);\n if (response.geoCoords[0].s !== GeoCoordStatus.Success || response.geoCoords[1].s !== GeoCoordStatus.Success || response.geoCoords[2].s !== GeoCoordStatus.Success)\n return undefined;\n\n const geoOrigin = Point3d.fromJSON(response.geoCoords[0].p);\n const geoNorth = Point3d.fromJSON(response.geoCoords[1].p);\n const geoEast = Point3d.fromJSON(response.geoCoords[2].p);\n const ecefOrigin = Cartographic.fromDegrees({ longitude: geoOrigin.x, latitude: geoOrigin.y, height: geoOrigin.z }).toEcef();\n const ecefNorth = Cartographic.fromDegrees({ longitude: geoNorth.x, latitude: geoNorth.y, height: geoNorth.z }).toEcef();\n const ecefEast = Cartographic.fromDegrees({ longitude: geoEast.x, latitude: geoEast.y, height: geoEast.z }).toEcef();\n\n const xVector = Vector3d.createStartEnd(ecefOrigin, ecefEast);\n const yVector = Vector3d.createStartEnd(ecefOrigin, ecefNorth);\n const zVector = xVector.unitCrossProduct(yVector);\n if (undefined === zVector) {\n assert(false); // Should never occur.\n return undefined;\n }\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector);\n if (matrix === undefined)\n return undefined;\n\n const inverse = matrix.inverse();\n if (inverse === undefined) {\n assert(false); // Should never occur.\n return undefined;\n }\n\n return Transform.createMatrixPickupPutdown(matrix, origin, ecefOrigin).inverse();\n}\n"]}
1
+ {"version":3,"file":"BackgroundMapGeometry.js","sourceRoot":"","sources":["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C/D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC1B,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAY,sBAAsB;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,wBAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,IAAI,MAAM,KAAK,SAAS;QACtB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,yBAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;AACnF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { assert, expectDefined } from \"@itwin/core-bentley\";\nimport { Angle, Arc3d, ClipPlane, ClipPlaneContainment, Constant, CurvePrimitive, Ellipsoid, GrowableXYZArray, LongitudeLatitudeNumber, Matrix3d, Plane3dByOriginAndUnitNormal, Point2d, Point3d, Point4d, Range1d, Range3d, Ray3d, Transform, Vector3d, WritableXYAndZ, XYAndZ } from \"@itwin/core-geometry\";\nimport { Cartographic, ColorByName, ColorDef, Frustum, GeoCoordStatus, GlobeMode, LinePixels } from \"@itwin/core-common\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { WebMercatorTilingScheme } from \"./tile/internal\";\n\nconst scratchRange = Range3d.createNull();\nconst scratchZeroPoint = Point3d.createZero();\nconst scratchPoint = Point3d.create();\nconst scratchVector = Vector3d.create();\nconst scratchCenterPoint = Point3d.createZero();\nconst scratchIntersectRay = Ray3d.create(Point3d.create(), Vector3d.create());\nconst scratchEyePoint = Point3d.createZero();\nconst scratchViewRotation = Matrix3d.createIdentity();\nconst scratchSilhouetteNormal = Vector3d.create();\nconst scratchCartoRectangle = new GrowableXYZArray();\nconst scratchWorkArray = new GrowableXYZArray();\n\nfunction accumulateDepthRange(point: Point3d, viewRotation: Matrix3d, range: Range3d) {\n viewRotation.multiplyXYZtoXYZ(point, scratchPoint);\n range.extend(scratchPoint);\n}\n\nfunction accumulateFrustumPlaneDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal, viewRotation: Matrix3d, range: Range3d, eyePoint?: Point3d) {\n let includeHorizon = false;\n for (let i = 0; i < 4; i++) {\n const frustumRay = Ray3d.createStartEnd(eyePoint ? eyePoint : frustum.points[i + 4], frustum.points[i]);\n const thisFraction = frustumRay.intersectionWithPlane(plane, scratchPoint);\n if (undefined !== thisFraction && (!eyePoint || thisFraction > 0))\n accumulateDepthRange(scratchPoint, viewRotation, range);\n else\n includeHorizon = true;\n }\n if (includeHorizon) {\n if (eyePoint !== undefined) {\n const eyeHeight = plane.altitude(eyePoint);\n if (eyeHeight < 0)\n accumulateDepthRange(eyePoint, viewRotation, range);\n else {\n const viewZ = viewRotation.getRow(2);\n const horizonDistance = Math.sqrt(eyeHeight * eyeHeight + 2 * eyeHeight * Constant.earthRadiusWGS84.equator);\n accumulateDepthRange(eyePoint.plusScaled(viewZ, -horizonDistance, scratchPoint), viewRotation, range);\n }\n }\n }\n}\n\n/** @internal */\nexport function getFrustumPlaneIntersectionDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal): Range1d {\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewRotation = expectDefined(frustum.getRotation(scratchViewRotation));\n const intersectRange = Range3d.createNull();\n accumulateFrustumPlaneDepthRange(frustum, plane, viewRotation, intersectRange, eyePoint);\n\n return intersectRange.isNull ? Range1d.createNull() : Range1d.createXX(intersectRange.low.z, intersectRange.high.z);\n}\n\n/** Geometry of background map - either an ellipsoid or a plane as defined by GlobeMode.\n * @internal\n */\nexport class BackgroundMapGeometry {\n public readonly globeMode: GlobeMode;\n public readonly geometry: Plane3dByOriginAndUnitNormal | Ellipsoid;\n public readonly globeOrigin: Point3d;\n public readonly globeMatrix: Matrix3d;\n public readonly cartesianRange: Range3d;\n public readonly cartesianTransitionRange: Range3d;\n public readonly cartesianPlane: Plane3dByOriginAndUnitNormal;\n public readonly cartesianDiagonal: number;\n public readonly cartesianChordHeight: number;\n public readonly maxGeometryChordHeight: number;\n private _mercatorFractionToDb: Transform;\n private _mercatorTilingScheme: WebMercatorTilingScheme;\n private _ecefToDb: Transform;\n public static maxCartesianDistance = 1E4; // If globe is 3D we still consider the map geometry flat within this distance of the project extents.\n private static _transitionDistanceMultiplier = .25; // In the transition range which extends beyond the cartesian range we interpolate between cartesian and ellipsoid.\n\n private static _scratchRayFractions = new Array<number>();\n private static _scratchRayAngles = new Array<LongitudeLatitudeNumber>();\n private static _scratchPoint = Point3d.createZero();\n\n constructor(private _bimElevationBias: number, globeMode: GlobeMode, private _iModel: IModelConnection) {\n this._ecefToDb = _iModel.getMapEcefToDb(_bimElevationBias);\n this.globeMode = globeMode;\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(_iModel);\n this.cartesianTransitionRange = this.cartesianRange.clone();\n this.cartesianTransitionRange.expandInPlace(BackgroundMapGeometry.getCartesianTransitionDistance(_iModel));\n this.cartesianDiagonal = this.cartesianRange.diagonal().magnitudeXY();\n const earthRadius = Constant.earthRadiusWGS84.equator;\n this.globeOrigin = this._ecefToDb.origin.cloneAsPoint3d();\n this.globeMatrix = this._ecefToDb.matrix.clone();\n this.cartesianChordHeight = Math.sqrt(this.cartesianDiagonal * this.cartesianDiagonal + earthRadius * earthRadius) - earthRadius; // Maximum chord height deviation of the cartesian area.\n const halfChordAngle = Angle.piOver2Radians / 10;\n this.maxGeometryChordHeight = (1 - Math.cos(halfChordAngle)) * earthRadius;\n this.cartesianPlane = this.getPlane();\n this.geometry = (globeMode === GlobeMode.Ellipsoid) ? this.getEarthEllipsoid() : this.cartesianPlane;\n this._mercatorTilingScheme = new WebMercatorTilingScheme();\n this._mercatorFractionToDb = this._mercatorTilingScheme.computeMercatorFractionToDb(this._ecefToDb, _bimElevationBias, _iModel, false);\n }\n public static getCartesianRange(iModel: IModelConnection, result?: Range3d): Range3d {\n const cartesianRange = Range3d.createFrom(iModel.projectExtents, result);\n cartesianRange.expandInPlace(BackgroundMapGeometry.maxCartesianDistance);\n return cartesianRange;\n }\n public static getCartesianTransitionDistance(iModel: IModelConnection): number {\n return BackgroundMapGeometry.getCartesianRange(iModel, scratchRange).diagonal().magnitudeXY() * BackgroundMapGeometry._transitionDistanceMultiplier;\n }\n\n public async dbToCartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]> {\n const scratch = new Point3d();\n const promises = db.map(async (p) => {\n return this.cartesianRange.containsPoint(Point3d.createFrom(p, scratch)) ? this._iModel.spatialToCartographic(p) : this.dbToCartographic(p);\n });\n\n return Promise.all(promises);\n }\n\n public async dbToWGS84CartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]> {\n if (db.length === 0)\n return [];\n\n const result: Cartographic[] = Array(db.length);\n const reproject: XYAndZ[] = [];\n const reprojectIdx: number[] = [];\n const scratch = new Point3d();\n for (let i = 0; i < db.length; i++) {\n Point3d.createFrom(db[i], scratch);\n if (this.cartesianRange.containsPoint(scratch) ) {\n reprojectIdx.push(i);\n reproject.push(db[i]);\n } else {\n result[i] = this.dbToCartographic(db[i]);\n }\n }\n\n if (reproject.length === 0)\n return result;\n\n const reprojectPromise = this._iModel.wgs84CartographicFromSpatial(reproject);\n return reprojectPromise.then((reprojected) => {\n if (reprojected.length === reprojectIdx.length) { // reprojected array size must match our index array, otherwise something is OFF\n for (let i = 0; i < reprojected.length; i++) {\n result[reprojectIdx[i]] = reprojected[i]; // Insert the reprojected values at their original index\n }\n }\n return result;\n });\n }\n\n public dbToCartographic(db: XYAndZ, result?: Cartographic): Cartographic {\n if (undefined === result)\n result = Cartographic.createZero();\n\n if (this.globeMode === GlobeMode.Plane) {\n const mercatorFraction = expectDefined(this._mercatorFractionToDb.multiplyInversePoint3d(db));\n return this._mercatorTilingScheme.fractionToCartographic(mercatorFraction.x, mercatorFraction.y, result, mercatorFraction.z);\n } else {\n const ecef = expectDefined(this._ecefToDb.multiplyInversePoint3d(db));\n return expectDefined(Cartographic.fromEcef(ecef, result));\n }\n }\n\n public async cartographicToDbFromGcs(cartographic: Cartographic[]): Promise<Point3d[]> {\n let db;\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n db = cartographic.map((p) => {\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\n });\n } else {\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef()));\n }\n\n if (this._iModel.noGcsDefined)\n return db;\n\n const promises = db.map(async (p, i) => {\n return this.cartesianRange.containsPoint(p) ? this._iModel.cartographicToSpatialFromGcs(cartographic[i]) : p;\n });\n\n return Promise.all(promises);\n }\n\n public async cartographicToDbFromWgs84Gcs(cartographic: Cartographic[]): Promise<Point3d[]> {\n let db;\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n db = cartographic.map((p) => {\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\n });\n } else {\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef()));\n }\n\n if (this._iModel.noGcsDefined)\n return db;\n\n const toReprojectCoords: WritableXYAndZ[] = [];\n const toReprojectIdx: number[] = [];\n db.forEach(async (p, i) => {\n if (this.cartesianRange.containsPoint(p)) {\n toReprojectCoords.push({x:cartographic[i].longitudeDegrees, y:cartographic[i].latitudeDegrees, z:cartographic[i].height});\n toReprojectIdx.push(i);\n }\n });\n const spatialPoints = await this._iModel.toSpatialFromGcs(toReprojectCoords, { horizontalCRS: { epsg: 4326 }, verticalCRS: { id: \"ELLIPSOID\" } });\n return db.map((p, i) => {\n const reprojectedIdx = toReprojectIdx.findIndex((value) => value === i);\n return (reprojectedIdx === -1 ? p : spatialPoints[reprojectedIdx]);\n });\n }\n\n public cartographicToDb(cartographic: Cartographic, result?: Point3d): Point3d {\n if (this.globeMode === GlobeMode.Plane) {\n const fraction = Point2d.create(0, 0);\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\n } else {\n return this._ecefToDb.multiplyPoint3d(cartographic.toEcef());\n }\n }\n\n public getEarthEllipsoid(radiusOffset = 0): Ellipsoid {\n const equatorRadius = Constant.earthRadiusWGS84.equator + radiusOffset, polarRadius = Constant.earthRadiusWGS84.polar + radiusOffset;\n return Ellipsoid.createCenterMatrixRadii(this.globeOrigin, this.globeMatrix, equatorRadius, equatorRadius, polarRadius);\n }\n\n public getPlane(offset = 0) {\n return expectDefined(Plane3dByOriginAndUnitNormal.create(Point3d.create(0, 0, this._bimElevationBias + offset), Vector3d.create(0, 0, 1)));\n }\n\n public getRayIntersection(ray: Ray3d, positiveOnly: boolean): Ray3d | undefined {\n let intersect;\n if (this.globeMode === GlobeMode.Ellipsoid) {\n const ellipsoid = this.geometry as Ellipsoid;\n BackgroundMapGeometry._scratchRayAngles.length = 0;\n BackgroundMapGeometry._scratchRayFractions.length = 0;\n\n const count = ellipsoid.intersectRay(ray, BackgroundMapGeometry._scratchRayFractions, undefined, BackgroundMapGeometry._scratchRayAngles);\n let intersectDistance;\n for (let i = 0; i < count; i++) {\n const thisFraction = BackgroundMapGeometry._scratchRayFractions[i];\n if ((!positiveOnly || thisFraction > 0) && (undefined === intersectDistance || thisFraction < intersectDistance)) {\n intersectDistance = thisFraction;\n intersect = scratchIntersectRay;\n ellipsoid.radiansToUnitNormalRay(BackgroundMapGeometry._scratchRayAngles[i].longitudeRadians, BackgroundMapGeometry._scratchRayAngles[i].latitudeRadians, intersect);\n if (intersect.direction.dotProduct(ray.direction) < 0) {\n if (this.cartesianRange.containsPoint(intersect.origin)) { // If we're in the cartesian range, correct to planar intersection.\n const planeFraction = ray.intersectionWithPlane(this.cartesianPlane, scratchIntersectRay.origin);\n if (undefined !== planeFraction && (!positiveOnly || planeFraction > 0)) {\n intersect.direction.setFromVector3d(this.cartesianPlane.getNormalRef());\n }\n }\n }\n }\n }\n } else {\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\n const thisFraction = ray.intersectionWithPlane(plane, scratchIntersectRay.origin);\n if (undefined !== thisFraction && (!positiveOnly || thisFraction > 0)) {\n intersect = scratchIntersectRay;\n intersect.direction.setFromVector3d(plane.getNormalRef());\n }\n }\n return intersect;\n }\n public getPointHeight(point: Point3d): number | undefined {\n if (this.globeMode === GlobeMode.Ellipsoid) {\n const ellipsoid = this.geometry as Ellipsoid;\n const projected = ellipsoid.projectPointToSurface(point);\n if (undefined === projected)\n return undefined;\n\n const distance = ellipsoid.radiansToPoint(projected.longitudeRadians, projected.latitudeRadians).distance(point);\n const ellipsePoint = expectDefined(ellipsoid.transformRef.multiplyInversePoint3d(point, BackgroundMapGeometry._scratchPoint));\n return ellipsePoint.magnitude() < 1 ? -distance : distance;\n } else {\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\n return plane.altitude(point);\n }\n }\n\n /** @internal */\n public getFrustumIntersectionDepthRange(frustum: Frustum, bimRange: Range3d, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewRotation = frustum.getRotation(scratchViewRotation);\n if (undefined === viewRotation)\n return Range1d.createNull(); // Degenerate frustum...\n const viewZ = viewRotation.getRow(2);\n const cartoRange = this.cartesianTransitionRange;\n const intersectRange = Range3d.createNull();\n const doAccumulate = ((point: Point3d) => accumulateDepthRange(point, viewRotation, intersectRange));\n\n if (gridPlane)\n accumulateFrustumPlaneDepthRange(frustum, gridPlane, viewRotation, intersectRange, eyePoint);\n if (this.geometry instanceof Plane3dByOriginAndUnitNormal) {\n // Intersection with a planar background projection...\n const heights = heightRange ? [heightRange.low, heightRange.high] : [0];\n for (const height of heights) {\n accumulateFrustumPlaneDepthRange(frustum, this.getPlane(height), viewRotation, intersectRange, eyePoint);\n }\n } else {\n const minOffset = heightRange ? heightRange.low : 0, maxOffset = (heightRange ? heightRange.high : 0) + this.cartesianChordHeight;\n const radiusOffsets = [minOffset, maxOffset];\n\n // If we are doing global scope then include minimum ellipsoid that represents the chordal approximation of the low level tiles.\n // this substantially expands the frustum so don't do it for non-global views, but this clipping out the low level tiles.\n if (doGlobalScope)\n radiusOffsets.push(minOffset - this.maxGeometryChordHeight);\n\n const toView = Transform.createRefs(Point3d.createZero(), viewRotation);\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\n\n for (const radiusOffset of radiusOffsets) {\n const ellipsoid = this.getEarthEllipsoid(radiusOffset);\n const eyeLocal = eyePoint ? ellipsoid.worldToLocal(eyePoint) : undefined;\n if (eyePoint && undefined === eyeLocal) {\n // If the globe transform cannot map the eye point into ellipsoid-local\n // space, treat the globe as unavailable here and let the caller fall\n // back to its extents-based depth fitting.\n return Range1d.createNull();\n }\n const isInside = eyeLocal !== undefined && eyeLocal.magnitude() < 1.0;\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\n const clipPlaneCount = clipPlanes.planes.length;\n\n // Extrema...\n let angles, extremaPoint;\n if (undefined !== (angles = ellipsoid.surfaceNormalToAngles(viewZ)) &&\n undefined !== (extremaPoint = ellipsoid.radiansToPoint(angles.longitudeRadians, angles.latitudeRadians)) &&\n (eyePoint === undefined || viewZ.dotProductStartEnd(extremaPoint, eyePoint) > 0) &&\n clipPlanes.classifyPointContainment([extremaPoint], false) !== ClipPlaneContainment.StronglyOutside)\n doAccumulate(extremaPoint);\n\n if (isInside) {\n if (eyePoint)\n doAccumulate(eyePoint);\n } else {\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\n if (silhouette !== undefined) {\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\n // Push the silhouette plane as clip so that we do not include geometry at other side of ellipsoid.\n // First make sure that it is pointing in the right direction.\n if (eyePoint) {\n // Clip toward eye.\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n } else {\n /* If parallel projection - clip toward side of ellipsoid with BIM geometry */\n if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n }\n // The silhouette arc is the horizon between the visible and hidden\n // halves of the globe. Its perpendicular vector is the normal of the\n // clip plane that keeps us on the visible side. If that plane cannot\n // be constructed, fall back to a view-aligned plane through the\n // ellipsoid center instead of pushing an invalid entry.\n const silhouettePlane =\n ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))\n ?? ClipPlane.createNormalAndPoint(viewZ, center);\n if (undefined === silhouettePlane)\n return Range1d.createNull();\n clipPlanes.planes.push(silhouettePlane);\n } else {\n const centerPlane = ClipPlane.createNormalAndPoint(viewZ, center);\n if (undefined === centerPlane)\n return Range1d.createNull();\n clipPlanes.planes.push(centerPlane);\n }\n }\n if (!isInside || radiusOffset === radiusOffsets[0]) {\n // Intersections of ellipsoid with frustum planes...\n const viewingInside = eyePoint !== undefined && viewZ.dotProduct(Vector3d.createStartEnd(center, eyePoint)) < 0;\n if (eyePoint === undefined || !isInside || viewingInside) {\n for (const clipPlane of clipPlanes.planes) {\n const plane = clipPlane.getPlane3d();\n const arc = ellipsoid.createPlaneSection(plane);\n if (undefined !== arc) {\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\n if (Math.abs(a1 - a0) < 1.0E-8) {\n doAccumulate(cp.fractionToPoint(a0)); // Tiny sweep - avoid problem with rangeMethod (not worth doing anyway).\n } else {\n const segment = cp.clonePartialCurve(a0, a1);\n if (segment !== undefined)\n segment.extendRange(intersectRange, toView);\n\n }\n });\n }\n }\n }\n // Intersections of the cartesian region with frustum planes.\n scratchCartoRectangle.resize(0);\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: radiusOffset });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\n\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\n for (let i = 0; i < scratchCartoRectangle.length; i++)\n doAccumulate(scratchCartoRectangle.getPoint3dAtUncheckedPointIndex(i));\n while (clipPlanes.planes.length > clipPlaneCount) // Remove pushed silhouette plane.\n clipPlanes.planes.pop();\n }\n }\n }\n\n if (intersectRange.zLength() < 5) {\n // For the case where the fitted depth is small (less than 5 meters) we must be viewing planar projection or the\n // planar portion of the iModel in plan view. In this case use a constant (arbitrarily 100 meters) depth so that the frustum\n // Z is doesn't change and cause nearly planar geometry to jitter in Z buffer.\n const zCenter = (intersectRange.low.z + intersectRange.high.z) / 2;\n const zExpand = 50;\n return Range1d.createXX(zCenter - zExpand, zCenter + zExpand);\n } else {\n const diagonal = intersectRange.diagonal(scratchVector).magnitudeXY();\n const expansion = diagonal * .01;\n return Range1d.createXX(intersectRange.low.z - expansion, intersectRange.high.z + expansion);\n }\n }\n\n public addFrustumDecorations(builder: GraphicBuilder, frustum: Frustum) {\n if (this.geometry instanceof Ellipsoid) {\n const ellipsoid = this.geometry;\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\n const viewRotation = expectDefined(frustum.getRotation());\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\n const viewZ = viewRotation.getRow(2);\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\n const isInside = eyePoint && expectDefined(ellipsoid.worldToLocal(eyePoint)).magnitude() < 1.0;\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\n const cartoRange = this.cartesianTransitionRange;\n\n if (!isInside) {\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\n if (silhouette !== undefined) {\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))));\n } else {\n clipPlanes.planes.push(expectDefined(ClipPlane.createNormalAndPoint(viewZ, center)));\n }\n\n const ellipsoidColor = ColorDef.create(ColorByName.yellow);\n builder.setSymbology(ellipsoidColor, ellipsoidColor, 1, LinePixels.Code2);\n for (const clipPlane of clipPlanes.planes) {\n const plane = clipPlane.getPlane3d();\n const arc = ellipsoid.createPlaneSection(plane);\n if (undefined !== arc) {\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\n const segment = cp.clonePartialCurve(a0, a1);\n if (segment !== undefined)\n builder.addArc(segment as Arc3d, false, false);\n });\n }\n\n // Intersections of the cartesian region with frustum planes.\n scratchCartoRectangle.resize(0);\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: 0 });\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\n\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\n if (scratchCartoRectangle.length > 0) {\n builder.addLineString(scratchCartoRectangle.getPoint3dArray());\n }\n }\n }\n }\n }\n}\n\n/** Calculate the ECEF to database (IModel) coordinate transform at a provided location, using the GCS of the iModel.\n * The transform will exactly represent the GCS at the provided location.\n * @public\n */\nexport async function calculateEcefToDbTransformAtLocation(originIn: Point3d, iModel: IModelConnection): Promise<Transform | undefined> {\n const geoConverter = iModel.noGcsDefined ? undefined : iModel.geoServices.getConverter(\"WGS84\");\n if (geoConverter === undefined)\n return undefined;\n\n const origin = Point3d.create(originIn.x, originIn.y, 0); // Always Test at zero.\n const eastPoint = origin.plusXYZ(1, 0, 0);\n const northPoint = origin.plusXYZ(0, 1, 0);\n\n const response = await geoConverter.getGeoCoordinatesFromIModelCoordinates([origin, northPoint, eastPoint]);\n if (response.geoCoords[0].s !== GeoCoordStatus.Success || response.geoCoords[1].s !== GeoCoordStatus.Success || response.geoCoords[2].s !== GeoCoordStatus.Success)\n return undefined;\n\n const geoOrigin = Point3d.fromJSON(response.geoCoords[0].p);\n const geoNorth = Point3d.fromJSON(response.geoCoords[1].p);\n const geoEast = Point3d.fromJSON(response.geoCoords[2].p);\n const ecefOrigin = Cartographic.fromDegrees({ longitude: geoOrigin.x, latitude: geoOrigin.y, height: geoOrigin.z }).toEcef();\n const ecefNorth = Cartographic.fromDegrees({ longitude: geoNorth.x, latitude: geoNorth.y, height: geoNorth.z }).toEcef();\n const ecefEast = Cartographic.fromDegrees({ longitude: geoEast.x, latitude: geoEast.y, height: geoEast.z }).toEcef();\n\n const xVector = Vector3d.createStartEnd(ecefOrigin, ecefEast);\n const yVector = Vector3d.createStartEnd(ecefOrigin, ecefNorth);\n const zVector = xVector.unitCrossProduct(yVector);\n if (undefined === zVector) {\n assert(false); // Should never occur.\n return undefined;\n }\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector);\n if (matrix === undefined)\n return undefined;\n\n const inverse = matrix.inverse();\n if (inverse === undefined) {\n assert(false); // Should never occur.\n return undefined;\n }\n\n return Transform.createMatrixPickupPutdown(matrix, origin, ecefOrigin).inverse();\n}\n"]}
@@ -144,11 +144,11 @@ export declare class BriefcaseConnection extends IModelConnection {
144
144
  hasPendingTxns(): Promise<boolean>;
145
145
  /** Commit pending changes to this briefcase.
146
146
  * @param description Optional description of the changes.
147
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
147
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
148
148
  */
149
149
  saveChanges(description?: string): Promise<void>;
150
150
  /** Abandon pending changes to this briefcase.
151
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
151
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
152
152
  */
153
153
  abandonChanges(): Promise<void>;
154
154
  /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase
@@ -248,13 +248,13 @@ class BriefcaseConnection extends IModelConnection_1.IModelConnection {
248
248
  }
249
249
  /** Commit pending changes to this briefcase.
250
250
  * @param description Optional description of the changes.
251
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
251
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
252
252
  */
253
253
  async saveChanges(description) {
254
254
  await IpcApp_1.IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated
255
255
  }
256
256
  /** Abandon pending changes to this briefcase.
257
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
257
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
258
258
  */
259
259
  async abandonChanges() {
260
260
  await IpcApp_1.IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwI;AACxI,oDAG4B;AAC5B,mDAAgD;AAChD,mEAAgE;AAChE,2CAAwC;AACxC,yDAAsD;AACtD,qCAAkC;AAClC,8CAAqE;AACrE,yCAAsC;AA8CtC;;;GAGG;AACH,MAAM,kBAAkB;IACd,aAAa,CAAyB;IAC7B,UAAU,CAAsB;IAChC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,SAA8B;QAC/C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,iCAAiC;QACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,EAAE;YAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACtC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;QAEJ,8BAA8B;QAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC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DAoMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
1
+ {"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwI;AACxI,oDAG4B;AAC5B,mDAAgD;AAChD,mEAAgE;AAChE,2CAAwC;AACxC,yDAAsD;AACtD,qCAAkC;AAClC,8CAAqE;AACrE,yCAAsC;AA8CtC;;;GAGG;AACH,MAAM,kBAAkB;IACd,aAAa,CAAyB;IAC7B,UAAU,CAAsB;IAChC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,SAA8B;QAC/C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,iCAAiC;QACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,EAAE;YAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7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CAAC,wBAAwB;QACnC,OAAO,eAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,sBAAO,EAA0C,CAAC;CAChG;AApMD,kDAoMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
@@ -297,6 +297,7 @@ export declare abstract class DisplayStyleState extends ElementState implements
297
297
  private _backgroundMapGeometry?;
298
298
  /** @internal */
299
299
  anyMapLayersVisible(overlay: boolean): boolean;
300
+ private get _hasEarthLocation();
300
301
  /** @internal */
301
302
  getIsBackgroundMapVisible(): boolean;
302
303
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayStyleState.d.ts","sourceRoot":"","sources":["../../src/DisplayStyleState.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAU,OAAO,EAAQ,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE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12 @@ class DisplayStyleState extends EntityState_1.ElementState {
615
615
  return true;
616
616
  return false;
617
617
  }
618
+ get _hasEarthLocation() {
619
+ return undefined !== this.iModel.ecefLocation;
620
+ }
618
621
  /** @internal */
619
622
  getIsBackgroundMapVisible() {
620
- return undefined !== this.iModel.ecefLocation && (this.viewFlags.backgroundMap || this.anyMapLayersVisible(false));
623
+ return this._hasEarthLocation && (this.viewFlags.backgroundMap || this.anyMapLayersVisible(false));
621
624
  }
622
625
  /** @internal */
623
626
  get backgroundMapElevationBias() {
@@ -638,7 +641,7 @@ class DisplayStyleState extends EntityState_1.ElementState {
638
641
  }
639
642
  /** @internal */
640
643
  getBackgroundMapGeometry() {
641
- if (undefined === this.iModel.ecefLocation)
644
+ if (!this._hasEarthLocation)
642
645
  return undefined;
643
646
  const bimElevationBias = this.backgroundMapElevationBias;
644
647
  if (undefined === bimElevationBias)
@@ -661,7 +664,7 @@ class DisplayStyleState extends EntityState_1.ElementState {
661
664
  let geometry = this.getIsBackgroundMapVisible() ? this.getBackgroundMapGeometry() : undefined;
662
665
  const terrainRange = ApproximateTerrainHeights_1.ApproximateTerrainHeights.instance.globalHeightRange;
663
666
  let heightRange = this.displayTerrain ? terrainRange : core_geometry_1.Range1d.createXX(-1, 1);
664
- if (this.globeMode === core_common_1.GlobeMode.Ellipsoid && this.contextRealityModelStates.find((model) => model.isGlobal)) {
667
+ if (this.globeMode === core_common_1.GlobeMode.Ellipsoid && this._hasEarthLocation && this.contextRealityModelStates.find((model) => model.isGlobal)) {
665
668
  if (!geometry) {
666
669
  if (!this._ellipsoidMapGeometry)
667
670
  this._ellipsoidMapGeometry = new BackgroundMapGeometry_1.BackgroundMapGeometry(0, core_common_1.GlobeMode.Ellipsoid, this.iModel);