@itwin/core-frontend 3.0.0-dev.179 → 3.0.0-dev.183

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.
Files changed (133) hide show
  1. package/lib/cjs/BackgroundMapGeometry.d.ts +1 -1
  2. package/lib/cjs/BackgroundMapGeometry.d.ts.map +1 -1
  3. package/lib/cjs/BackgroundMapGeometry.js +2 -2
  4. package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
  5. package/lib/cjs/NotificationManager.d.ts +3 -1
  6. package/lib/cjs/NotificationManager.d.ts.map +1 -1
  7. package/lib/cjs/NotificationManager.js +2 -0
  8. package/lib/cjs/NotificationManager.js.map +1 -1
  9. package/lib/cjs/RealityDataSource.js +3 -1
  10. package/lib/cjs/RealityDataSource.js.map +1 -1
  11. package/lib/cjs/ViewContext.js.map +1 -1
  12. package/lib/cjs/ViewCreator3d.d.ts +1 -1
  13. package/lib/cjs/ViewCreator3d.d.ts.map +1 -1
  14. package/lib/cjs/ViewCreator3d.js +1 -1
  15. package/lib/cjs/ViewCreator3d.js.map +1 -1
  16. package/lib/cjs/ViewingSpace.js +1 -1
  17. package/lib/cjs/ViewingSpace.js.map +1 -1
  18. package/lib/cjs/core-frontend.d.ts +4 -0
  19. package/lib/cjs/core-frontend.d.ts.map +1 -1
  20. package/lib/cjs/core-frontend.js +4 -0
  21. package/lib/cjs/core-frontend.js.map +1 -1
  22. package/lib/cjs/render/GraphicBuilder.d.ts +6 -0
  23. package/lib/cjs/render/GraphicBuilder.d.ts.map +1 -1
  24. package/lib/cjs/render/GraphicBuilder.js.map +1 -1
  25. package/lib/cjs/render/primitives/geometry/GeometryAccumulator.d.ts +2 -0
  26. package/lib/cjs/render/primitives/geometry/GeometryAccumulator.d.ts.map +1 -1
  27. package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js +2 -1
  28. package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
  29. package/lib/cjs/render/primitives/geometry/GeometryListBuilder.d.ts.map +1 -1
  30. package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js +1 -0
  31. package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
  32. package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts +2 -2
  33. package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
  34. package/lib/cjs/render/primitives/mesh/MeshPrimitives.js +3 -3
  35. package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
  36. package/lib/cjs/render/webgl/BranchUniforms.d.ts.map +1 -1
  37. package/lib/cjs/render/webgl/BranchUniforms.js +8 -5
  38. package/lib/cjs/render/webgl/BranchUniforms.js.map +1 -1
  39. package/lib/cjs/render/webgl/SolarShadowMap.js +1 -1
  40. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  41. package/lib/cjs/tile/internal.d.ts +1 -0
  42. package/lib/cjs/tile/internal.d.ts.map +1 -1
  43. package/lib/cjs/tile/internal.js +1 -0
  44. package/lib/cjs/tile/internal.js.map +1 -1
  45. package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
  46. package/lib/cjs/tile/map/ArcGisUtilities.js +7 -2
  47. package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
  48. package/lib/cjs/tile/map/MapLayerAuthentication.d.ts +20 -0
  49. package/lib/cjs/tile/map/MapLayerAuthentication.d.ts.map +1 -0
  50. package/lib/cjs/tile/map/MapLayerAuthentication.js +18 -0
  51. package/lib/cjs/tile/map/MapLayerAuthentication.js.map +1 -0
  52. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +5 -2
  53. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  54. package/lib/cjs/tile/map/MapLayerFormatRegistry.js +3 -1
  55. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  56. package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts +1 -1
  57. package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  58. package/lib/cjs/tile/map/MapLayerImageryFormats.js +4 -2
  59. package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
  60. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +1 -1
  61. package/lib/cjs/tile/map/MapLayerImageryProvider.js +1 -1
  62. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  63. package/lib/cjs/tile/map/MapLayerSources.d.ts +3 -1
  64. package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
  65. package/lib/cjs/tile/map/MapLayerSources.js +3 -1
  66. package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
  67. package/lib/esm/BackgroundMapGeometry.d.ts +1 -1
  68. package/lib/esm/BackgroundMapGeometry.d.ts.map +1 -1
  69. package/lib/esm/BackgroundMapGeometry.js +2 -2
  70. package/lib/esm/BackgroundMapGeometry.js.map +1 -1
  71. package/lib/esm/NotificationManager.d.ts +3 -1
  72. package/lib/esm/NotificationManager.d.ts.map +1 -1
  73. package/lib/esm/NotificationManager.js +2 -0
  74. package/lib/esm/NotificationManager.js.map +1 -1
  75. package/lib/esm/RealityDataSource.js +3 -1
  76. package/lib/esm/RealityDataSource.js.map +1 -1
  77. package/lib/esm/ViewContext.js.map +1 -1
  78. package/lib/esm/ViewCreator3d.d.ts +1 -1
  79. package/lib/esm/ViewCreator3d.d.ts.map +1 -1
  80. package/lib/esm/ViewCreator3d.js +1 -1
  81. package/lib/esm/ViewCreator3d.js.map +1 -1
  82. package/lib/esm/ViewingSpace.js +1 -1
  83. package/lib/esm/ViewingSpace.js.map +1 -1
  84. package/lib/esm/core-frontend.d.ts +4 -0
  85. package/lib/esm/core-frontend.d.ts.map +1 -1
  86. package/lib/esm/core-frontend.js +4 -0
  87. package/lib/esm/core-frontend.js.map +1 -1
  88. package/lib/esm/render/GraphicBuilder.d.ts +6 -0
  89. package/lib/esm/render/GraphicBuilder.d.ts.map +1 -1
  90. package/lib/esm/render/GraphicBuilder.js.map +1 -1
  91. package/lib/esm/render/primitives/geometry/GeometryAccumulator.d.ts +2 -0
  92. package/lib/esm/render/primitives/geometry/GeometryAccumulator.d.ts.map +1 -1
  93. package/lib/esm/render/primitives/geometry/GeometryAccumulator.js +2 -1
  94. package/lib/esm/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
  95. package/lib/esm/render/primitives/geometry/GeometryListBuilder.d.ts.map +1 -1
  96. package/lib/esm/render/primitives/geometry/GeometryListBuilder.js +1 -0
  97. package/lib/esm/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
  98. package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts +2 -2
  99. package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
  100. package/lib/esm/render/primitives/mesh/MeshPrimitives.js +3 -3
  101. package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
  102. package/lib/esm/render/webgl/BranchUniforms.d.ts.map +1 -1
  103. package/lib/esm/render/webgl/BranchUniforms.js +8 -5
  104. package/lib/esm/render/webgl/BranchUniforms.js.map +1 -1
  105. package/lib/esm/render/webgl/SolarShadowMap.js +1 -1
  106. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  107. package/lib/esm/tile/internal.d.ts +1 -0
  108. package/lib/esm/tile/internal.d.ts.map +1 -1
  109. package/lib/esm/tile/internal.js +1 -0
  110. package/lib/esm/tile/internal.js.map +1 -1
  111. package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
  112. package/lib/esm/tile/map/ArcGisUtilities.js +8 -3
  113. package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
  114. package/lib/esm/tile/map/MapLayerAuthentication.d.ts +20 -0
  115. package/lib/esm/tile/map/MapLayerAuthentication.d.ts.map +1 -0
  116. package/lib/esm/tile/map/MapLayerAuthentication.js +15 -0
  117. package/lib/esm/tile/map/MapLayerAuthentication.js.map +1 -0
  118. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +5 -2
  119. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  120. package/lib/esm/tile/map/MapLayerFormatRegistry.js +3 -1
  121. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  122. package/lib/esm/tile/map/MapLayerImageryFormats.d.ts +1 -1
  123. package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  124. package/lib/esm/tile/map/MapLayerImageryFormats.js +5 -3
  125. package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
  126. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +1 -1
  127. package/lib/esm/tile/map/MapLayerImageryProvider.js +1 -1
  128. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  129. package/lib/esm/tile/map/MapLayerSources.d.ts +3 -1
  130. package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
  131. package/lib/esm/tile/map/MapLayerSources.js +3 -1
  132. package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
  133. package/package.json +22 -22
@@ -182,7 +182,7 @@ export class BackgroundMapGeometry {
182
182
  }
183
183
  }
184
184
  /** @internal */
185
- getFrustumIntersectionDepthRange(frustum, heightRange, gridPlane, doGlobalScope) {
185
+ getFrustumIntersectionDepthRange(frustum, bimRange, heightRange, gridPlane, doGlobalScope) {
186
186
  const clipPlanes = frustum.getRangePlanes(false, false, 0);
187
187
  const eyePoint = frustum.getEyePoint(scratchEyePoint);
188
188
  const viewRotation = frustum.getRotation(scratchViewRotation);
@@ -239,7 +239,7 @@ export class BackgroundMapGeometry {
239
239
  }
240
240
  else {
241
241
  /* If parallel projection - clip toward side of ellipsoid with BIM geometry */
242
- if (viewZ.dotProduct(scratchSilhouetteNormal) < 0)
242
+ if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)
243
243
  scratchSilhouetteNormal.negate(scratchSilhouetteNormal);
244
244
  }
245
245
  clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratch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S;QACtB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAG,CAAC;AACpF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Angle, Arc3d, ClipPlane, ClipPlaneContainment, Constant, CurvePrimitive, Ellipsoid, GrowableXYZArray, LongitudeLatitudeNumber, Matrix3d, Plane3dByOriginAndUnitNormal, Point2d, Point3d, Point4d, Range1d, Range3d, Ray3d, Transform, Vector3d, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { Cartographic, ColorByName, ColorDef, Frustum, GeoCoordStatus, GlobeMode } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\r\nimport { WebMercatorTilingScheme } from \"./tile/internal\";\r\n\r\nconst scratchRange = Range3d.createNull();\r\nconst scratchZeroPoint = Point3d.createZero();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchVector = Vector3d.create();\r\nconst scratchCenterPoint = Point3d.createZero();\r\nconst scratchIntersectRay = Ray3d.create(Point3d.create(), Vector3d.create());\r\nconst scratchEyePoint = Point3d.createZero();\r\nconst scratchViewRotation = Matrix3d.createIdentity();\r\nconst scratchSilhouetteNormal = Vector3d.create();\r\nconst scratchCartoRectangle = new GrowableXYZArray();\r\nconst scratchWorkArray = new GrowableXYZArray();\r\n\r\nfunction accumulateDepthRange(point: Point3d, viewRotation: Matrix3d, range: Range3d) {\r\n viewRotation.multiplyXYZtoXYZ(point, scratchPoint);\r\n range.extend(scratchPoint);\r\n}\r\n\r\nfunction accumulateFrustumPlaneDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal, viewRotation: Matrix3d, range: Range3d, eyePoint?: Point3d) {\r\n let includeHorizon = false;\r\n for (let i = 0; i < 4; i++) {\r\n const frustumRay = Ray3d.createStartEnd(eyePoint ? eyePoint : frustum.points[i + 4], frustum.points[i]);\r\n const thisFraction = frustumRay.intersectionWithPlane(plane, scratchPoint);\r\n if (undefined !== thisFraction && (!eyePoint || thisFraction > 0))\r\n accumulateDepthRange(scratchPoint, viewRotation, range);\r\n else\r\n includeHorizon = true;\r\n }\r\n if (includeHorizon) {\r\n if (eyePoint !== undefined) {\r\n const eyeHeight = plane.altitude(eyePoint);\r\n if (eyeHeight < 0)\r\n accumulateDepthRange(eyePoint, viewRotation, range);\r\n else {\r\n const viewZ = viewRotation.getRow(2);\r\n const horizonDistance = Math.sqrt(eyeHeight * eyeHeight + 2 * eyeHeight * Constant.earthRadiusWGS84.equator);\r\n accumulateDepthRange(eyePoint.plusScaled(viewZ, -horizonDistance, scratchPoint), viewRotation, range);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function getFrustumPlaneIntersectionDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal): Range1d {\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewRotation = frustum.getRotation(scratchViewRotation)!;\r\n const intersectRange = Range3d.createNull();\r\n accumulateFrustumPlaneDepthRange(frustum, plane, viewRotation, intersectRange, eyePoint);\r\n\r\n return intersectRange.isNull ? Range1d.createNull() : Range1d.createXX(intersectRange.low.z, intersectRange.high.z);\r\n}\r\n\r\n/** Geometry of background map - either an ellipsoid or a plane as defined by GlobeMode.\r\n * @internal\r\n */\r\nexport class BackgroundMapGeometry {\r\n public readonly globeMode: GlobeMode;\r\n public readonly geometry: Plane3dByOriginAndUnitNormal | Ellipsoid;\r\n public readonly globeOrigin: Point3d;\r\n public readonly globeMatrix: Matrix3d;\r\n public readonly cartesianRange: Range3d;\r\n public readonly cartesianTransitionRange: Range3d;\r\n public readonly cartesianPlane: Plane3dByOriginAndUnitNormal;\r\n public readonly cartesianDiagonal: number;\r\n public readonly cartesianChordHeight: number;\r\n public readonly maxGeometryChordHeight: number;\r\n private _mercatorFractionToDb: Transform;\r\n private _mercatorTilingScheme: WebMercatorTilingScheme;\r\n private _ecefToDb: Transform;\r\n public static maxCartesianDistance = 1E4; // If globe is 3D we still consider the map geometry flat within this distance of the project extents.\r\n private static _transitionDistanceMultiplier = .25; // In the transition range which extends beyond the cartesian range we interpolate between cartesian and ellipsoid.\r\n\r\n private static _scratchRayFractions = new Array<number>();\r\n private static _scratchRayAngles = new Array<LongitudeLatitudeNumber>();\r\n private static _scratchPoint = Point3d.createZero();\r\n\r\n constructor(private _bimElevationBias: number, globeMode: GlobeMode, private _iModel: IModelConnection) {\r\n this._ecefToDb = _iModel.getMapEcefToDb(_bimElevationBias);\r\n this.globeMode = globeMode;\r\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(_iModel);\r\n this.cartesianTransitionRange = this.cartesianRange.clone();\r\n this.cartesianTransitionRange.expandInPlace(BackgroundMapGeometry.getCartesianTransitionDistance(_iModel));\r\n this.cartesianDiagonal = this.cartesianRange.diagonal().magnitudeXY();\r\n const earthRadius = Constant.earthRadiusWGS84.equator;\r\n this.globeOrigin = this._ecefToDb.origin.cloneAsPoint3d();\r\n this.globeMatrix = this._ecefToDb.matrix.clone();\r\n this.cartesianChordHeight = Math.sqrt(this.cartesianDiagonal * this.cartesianDiagonal + earthRadius * earthRadius) - earthRadius; // Maximum chord height deviation of the cartesian area.\r\n const halfChordAngle = Angle.piOver2Radians / 10;\r\n this.maxGeometryChordHeight = (1 - Math.cos(halfChordAngle)) * earthRadius;\r\n this.cartesianPlane = this.getPlane();\r\n this.geometry = (globeMode === GlobeMode.Ellipsoid) ? this.getEarthEllipsoid() : this.cartesianPlane;\r\n this._mercatorTilingScheme = new WebMercatorTilingScheme();\r\n this._mercatorFractionToDb = this._mercatorTilingScheme.computeMercatorFractionToDb(this._ecefToDb, _bimElevationBias, _iModel, false);\r\n }\r\n public static getCartesianRange(iModel: IModelConnection, result?: Range3d): Range3d {\r\n const cartesianRange = Range3d.createFrom(iModel.projectExtents, result);\r\n cartesianRange.expandInPlace(BackgroundMapGeometry.maxCartesianDistance);\r\n return cartesianRange;\r\n }\r\n public static getCartesianTransitionDistance(iModel: IModelConnection): number {\r\n return BackgroundMapGeometry.getCartesianRange(iModel, scratchRange).diagonal().magnitudeXY() * BackgroundMapGeometry._transitionDistanceMultiplier;\r\n }\r\n\r\n public async dbToCartographicFromGcs(db: XYAndZ, result?: Cartographic): Promise<Cartographic> {\r\n return this.cartesianRange.containsPoint(Point3d.createFrom(db)) ? this._iModel.spatialToCartographic(db, result) : this.dbToCartographic(db, result);\r\n }\r\n\r\n public dbToCartographic(db: XYAndZ, result?: Cartographic): Cartographic {\r\n if (undefined === result)\r\n result = Cartographic.createZero();\r\n\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const mercatorFraction = this._mercatorFractionToDb.multiplyInversePoint3d(db)!;\r\n return this._mercatorTilingScheme.fractionToCartographic(mercatorFraction.x, mercatorFraction.y, result, mercatorFraction.z);\r\n } else {\r\n const ecef = this._ecefToDb.multiplyInversePoint3d(db)!;\r\n return Cartographic.fromEcef(ecef, result)!;\r\n }\r\n }\r\n\r\n public async cartographicToDbFromGcs(cartographic: Cartographic, result?: Point3d): Promise<Point3d> {\r\n let db;\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\r\n db = this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\r\n } else {\r\n db = this._ecefToDb.multiplyPoint3d(cartographic.toEcef())!;\r\n }\r\n return (!this._iModel.noGcsDefined && this.cartesianRange.containsPoint(db)) ? this._iModel.cartographicToSpatialFromGcs(cartographic) : db;\r\n }\r\n public cartographicToDb(cartographic: Cartographic, result?: Point3d): Point3d {\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\r\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\r\n } else {\r\n return this._ecefToDb.multiplyPoint3d(cartographic.toEcef())!;\r\n }\r\n }\r\n\r\n public getEarthEllipsoid(radiusOffset = 0): Ellipsoid {\r\n const equatorRadius = Constant.earthRadiusWGS84.equator + radiusOffset, polarRadius = Constant.earthRadiusWGS84.polar + radiusOffset;\r\n return Ellipsoid.createCenterMatrixRadii(this.globeOrigin, this.globeMatrix, equatorRadius, equatorRadius, polarRadius);\r\n }\r\n public getPlane(offset = 0) {\r\n return Plane3dByOriginAndUnitNormal.create(Point3d.create(0, 0, this._bimElevationBias + offset), Vector3d.create(0, 0, 1))!;\r\n }\r\n\r\n public getRayIntersection(ray: Ray3d, positiveOnly: boolean): Ray3d | undefined {\r\n let intersect;\r\n if (this.globeMode === GlobeMode.Ellipsoid) {\r\n const ellipsoid = this.geometry as Ellipsoid;\r\n BackgroundMapGeometry._scratchRayAngles.length = 0;\r\n BackgroundMapGeometry._scratchRayFractions.length = 0;\r\n\r\n const count = ellipsoid.intersectRay(ray, BackgroundMapGeometry._scratchRayFractions, undefined, BackgroundMapGeometry._scratchRayAngles);\r\n let intersectDistance;\r\n for (let i = 0; i < count; i++) {\r\n const thisFraction = BackgroundMapGeometry._scratchRayFractions[i];\r\n if ((!positiveOnly || thisFraction > 0) && (undefined === intersectDistance || thisFraction < intersectDistance)) {\r\n intersectDistance = thisFraction;\r\n intersect = scratchIntersectRay;\r\n ellipsoid.radiansToUnitNormalRay(BackgroundMapGeometry._scratchRayAngles[i].longitudeRadians, BackgroundMapGeometry._scratchRayAngles[i].latitudeRadians, intersect);\r\n if (intersect.direction.dotProduct(ray.direction) < 0) {\r\n if (this.cartesianRange.containsPoint(intersect.origin)) { // If we're in the cartesian range, correct to planar intersection.\r\n const planeFraction = ray.intersectionWithPlane(this.cartesianPlane, scratchIntersectRay.origin);\r\n if (undefined !== planeFraction && (!positiveOnly || planeFraction > 0)) {\r\n intersect.direction.setFromVector3d(this.cartesianPlane.getNormalRef());\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\r\n const thisFraction = ray.intersectionWithPlane(plane, scratchIntersectRay.origin);\r\n if (undefined !== thisFraction && (!positiveOnly || thisFraction > 0)) {\r\n intersect = scratchIntersectRay;\r\n intersect.direction.setFromVector3d(plane.getNormalRef());\r\n }\r\n }\r\n return intersect;\r\n }\r\n public getPointHeight(point: Point3d): number | undefined {\r\n if (this.globeMode === GlobeMode.Ellipsoid) {\r\n const ellipsoid = this.geometry as Ellipsoid;\r\n const projected = ellipsoid.projectPointToSurface(point);\r\n if (undefined === projected)\r\n return undefined;\r\n\r\n const distance = ellipsoid.radiansToPoint(projected.longitudeRadians, projected.latitudeRadians).distance(point);\r\n const ellipsePoint = ellipsoid.transformRef.multiplyInversePoint3d(point, BackgroundMapGeometry._scratchPoint)!;\r\n return ellipsePoint.magnitude() < 1 ? -distance : distance;\r\n } else {\r\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\r\n return plane.altitude(point);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public getFrustumIntersectionDepthRange(frustum: Frustum, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewRotation = frustum.getRotation(scratchViewRotation);\r\n if (undefined === viewRotation)\r\n return Range1d.createNull(); // Degenerate frustum...\r\n const viewZ = viewRotation.getRow(2);\r\n const cartoRange = this.cartesianTransitionRange;\r\n const intersectRange = Range3d.createNull();\r\n const doAccumulate = ((point: Point3d) => accumulateDepthRange(point, viewRotation, intersectRange));\r\n\r\n if (gridPlane)\r\n accumulateFrustumPlaneDepthRange(frustum, gridPlane, viewRotation, intersectRange, eyePoint);\r\n if (this.geometry instanceof Plane3dByOriginAndUnitNormal) {\r\n // Intersection with a planar background projection...\r\n const heights = heightRange ? [heightRange.low, heightRange.high] : [0];\r\n for (const height of heights) {\r\n accumulateFrustumPlaneDepthRange(frustum, this.getPlane(height), viewRotation, intersectRange, eyePoint);\r\n }\r\n } else {\r\n const minOffset = heightRange ? heightRange.low : 0, maxOffset = (heightRange ? heightRange.high : 0) + this.cartesianChordHeight;\r\n const radiusOffsets = [minOffset, maxOffset];\r\n\r\n // If we are doing global scope then include minimum ellipsoid that represents the chordal approximation of the low level tiles.\r\n // this substantially expands the frustum so don't do it for non-global views, but this clipping out the low level tiles.\r\n if (doGlobalScope)\r\n radiusOffsets.push(minOffset - this.maxGeometryChordHeight);\r\n\r\n const toView = Transform.createRefs(Point3d.createZero(), viewRotation);\r\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\r\n\r\n for (const radiusOffset of radiusOffsets) {\r\n const ellipsoid = this.getEarthEllipsoid(radiusOffset);\r\n const isInside = eyePoint && ellipsoid.worldToLocal(eyePoint)!.magnitude() < 1.0;\r\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\r\n const clipPlaneCount = clipPlanes.planes.length;\r\n\r\n // Extrema...\r\n let angles, extremaPoint;\r\n if (undefined !== (angles = ellipsoid.surfaceNormalToAngles(viewZ)) &&\r\n undefined !== (extremaPoint = ellipsoid.radiansToPoint(angles.longitudeRadians, angles.latitudeRadians)) &&\r\n (eyePoint === undefined || viewZ.dotProductStartEnd(extremaPoint, eyePoint) > 0) &&\r\n clipPlanes.classifyPointContainment([extremaPoint], false) !== ClipPlaneContainment.StronglyOutside)\r\n doAccumulate(extremaPoint);\r\n\r\n if (isInside) {\r\n if (eyePoint) doAccumulate(eyePoint);\r\n } else {\r\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\r\n if (silhouette !== undefined) {\r\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\r\n // Push the silhouette plane as clip so that we do not include geometry at other side of ellipsoid.\r\n // First make sure that it is pointing in the right direction.\r\n if (eyePoint) {\r\n // Clip toward eye.\r\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n } else {\r\n /* If parallel projection - clip toward side of ellipsoid with BIM geometry */\r\n if (viewZ.dotProduct(scratchSilhouetteNormal) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n }\r\n clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))!);\r\n } else {\r\n clipPlanes.planes.push(ClipPlane.createNormalAndPoint(viewZ, center)!);\r\n }\r\n }\r\n if (!isInside || radiusOffset === radiusOffsets[0]) {\r\n // Intersections of ellipsoid with frustum planes...\r\n const viewingInside = eyePoint !== undefined && viewZ.dotProduct(Vector3d.createStartEnd(center, eyePoint)) < 0;\r\n if (eyePoint === undefined || !isInside || viewingInside) {\r\n for (const clipPlane of clipPlanes.planes) {\r\n const plane = clipPlane.getPlane3d();\r\n const arc = ellipsoid.createPlaneSection(plane);\r\n if (undefined !== arc) {\r\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\r\n if (Math.abs(a1 - a0) < 1.0E-8) {\r\n doAccumulate(cp.fractionToPoint(a0)); // Tiny sweep - avoid problem with rangeMethod (not worth doing anyway).\r\n } else {\r\n const segment = cp.clonePartialCurve(a0, a1);\r\n if (segment !== undefined)\r\n segment.extendRange(intersectRange, toView);\r\n\r\n }\r\n });\r\n }\r\n }\r\n }\r\n // Intersections of the cartesian region with frustum planes.\r\n scratchCartoRectangle.resize(0);\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\r\n\r\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\r\n for (let i = 0; i < scratchCartoRectangle.length; i++)\r\n doAccumulate(scratchCartoRectangle.getPoint3dAtUncheckedPointIndex(i));\r\n while (clipPlanes.planes.length > clipPlaneCount) // Remove pushed silhouette plane.\r\n clipPlanes.planes.pop();\r\n }\r\n }\r\n }\r\n\r\n if (intersectRange.zLength() < 5) {\r\n // For the case where the fitted depth is small (less than 5 meters) we must be viewing planar projection or the\r\n // planar portion of the iModel in plan view. In this case use a constant (arbitrarily 100 meters) depth so that the frustum\r\n // Z is doesn't change and cause nearly planar geometry to jitter in Z buffer.\r\n const zCenter = (intersectRange.low.z + intersectRange.high.z) / 2;\r\n const zExpand = 50;\r\n return Range1d.createXX(zCenter - zExpand, zCenter + zExpand);\r\n } else {\r\n const diagonal = intersectRange.diagonal(scratchVector).magnitudeXY();\r\n const expansion = diagonal * .01;\r\n return Range1d.createXX(intersectRange.low.z - expansion, intersectRange.high.z + expansion);\r\n }\r\n }\r\n\r\n public addFrustumDecorations(builder: GraphicBuilder, frustum: Frustum) {\r\n if (this.geometry instanceof Ellipsoid) {\r\n const ellipsoid = this.geometry;\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const viewRotation = frustum.getRotation()!;\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewZ = viewRotation.getRow(2);\r\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\r\n const isInside = eyePoint && ellipsoid.worldToLocal(eyePoint)!.magnitude() < 1.0;\r\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\r\n const cartoRange = this.cartesianTransitionRange;\r\n\r\n if (!isInside) {\r\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\r\n if (silhouette !== undefined) {\r\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\r\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))!);\r\n } else {\r\n clipPlanes.planes.push(ClipPlane.createNormalAndPoint(viewZ, center)!);\r\n }\r\n\r\n const ellipsoidColor = ColorDef.create(ColorByName.yellow);\r\n builder.setSymbology(ellipsoidColor, ellipsoidColor, 1, 2);\r\n for (const clipPlane of clipPlanes.planes) {\r\n const plane = clipPlane.getPlane3d();\r\n const arc = ellipsoid.createPlaneSection(plane);\r\n if (undefined !== arc) {\r\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\r\n const segment = cp.clonePartialCurve(a0, a1);\r\n if (segment !== undefined)\r\n builder.addArc(segment as Arc3d, false, false);\r\n });\r\n }\r\n\r\n // Intersections of the cartesian region with frustum planes.\r\n scratchCartoRectangle.resize(0);\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\r\n\r\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\r\n if (scratchCartoRectangle.length > 0) {\r\n builder.addLineString(scratchCartoRectangle.getPoint3dArray());\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** Calculate the ECEF to database (IModel) coordinate transform at a provided location, using the GCS of the iModel.\r\n * The transform will exactly represent the GCS at the provided location.\r\n * @public\r\n */\r\nexport async function calculateEcefToDbTransformAtLocation(originIn: Point3d, iModel: IModelConnection): Promise<Transform | undefined> {\r\n const geoConverter = iModel.noGcsDefined ? undefined : iModel.geoServices.getConverter(\"WGS84\");\r\n if (geoConverter === undefined)\r\n return undefined;\r\n\r\n const origin = Point3d.create(originIn.x, originIn.y, 0); // Always Test at zero.\r\n const eastPoint = origin.plusXYZ(1, 0, 0);\r\n const northPoint = origin.plusXYZ(0, 1, 0);\r\n\r\n const response = await geoConverter.getGeoCoordinatesFromIModelCoordinates([origin, northPoint, eastPoint]);\r\n if (response.geoCoords[0].s !== GeoCoordStatus.Success || response.geoCoords[1].s !== GeoCoordStatus.Success || response.geoCoords[2].s !== GeoCoordStatus.Success)\r\n return undefined;\r\n\r\n const geoOrigin = Point3d.fromJSON(response.geoCoords[0].p);\r\n const geoNorth = Point3d.fromJSON(response.geoCoords[1].p);\r\n const geoEast = Point3d.fromJSON(response.geoCoords[2].p);\r\n const ecefOrigin = Cartographic.fromDegrees({ longitude: geoOrigin.x, latitude: geoOrigin.y, height: geoOrigin.z }).toEcef()!;\r\n const ecefNorth = Cartographic.fromDegrees({ longitude: geoNorth.x, latitude: geoNorth.y, height: geoNorth.z }).toEcef()!;\r\n const ecefEast = Cartographic.fromDegrees({ longitude: geoEast.x, latitude: geoEast.y, height: geoEast.z }).toEcef()!;\r\n\r\n const xVector = Vector3d.createStartEnd(ecefOrigin, ecefEast);\r\n const yVector = Vector3d.createStartEnd(ecefOrigin, ecefNorth);\r\n const zVector = xVector.unitCrossProduct(yVector);\r\n if (undefined === zVector) {\r\n assert(false); // Should never occur.\r\n return undefined;\r\n }\r\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector);\r\n if (matrix === undefined)\r\n return undefined;\r\n\r\n const inverse = matrix.inverse();\r\n if (inverse === undefined) {\r\n assert(false); // Should never occur.\r\n return undefined;\r\n }\r\n\r\n return Transform.createMatrixPickupPutdown(matrix, origin, ecefOrigin).inverse()!;\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"BackgroundMapGeometry.js","sourceRoot":"","sources":["../../src/BackgroundMapGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAS,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAkB,SAAS,EAAE,gBAAgB,EAA2B,QAAQ,EAAE,4BAA4B,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAU,MAAM,sBAAsB,CAAC;AAC9R,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAW,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG7G,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;AAC1C,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;AAC9C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AACtC,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;AAChD,MAAM,mBAAmB,GAAG,KAAK,CAAC,M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AG,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,OAAO,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAY,sBAAsB;QAChD,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,MAAM,GAAG,QAAQ,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;QACzB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAG,CAAC;AACpF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Angle, Arc3d, ClipPlane, ClipPlaneContainment, Constant, CurvePrimitive, Ellipsoid, GrowableXYZArray, LongitudeLatitudeNumber, Matrix3d, Plane3dByOriginAndUnitNormal, Point2d, Point3d, Point4d, Range1d, Range3d, Ray3d, Transform, Vector3d, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { Cartographic, ColorByName, ColorDef, Frustum, GeoCoordStatus, GlobeMode } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\r\nimport { WebMercatorTilingScheme } from \"./tile/internal\";\r\n\r\nconst scratchRange = Range3d.createNull();\r\nconst scratchZeroPoint = Point3d.createZero();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchVector = Vector3d.create();\r\nconst scratchCenterPoint = Point3d.createZero();\r\nconst scratchIntersectRay = Ray3d.create(Point3d.create(), Vector3d.create());\r\nconst scratchEyePoint = Point3d.createZero();\r\nconst scratchViewRotation = Matrix3d.createIdentity();\r\nconst scratchSilhouetteNormal = Vector3d.create();\r\nconst scratchCartoRectangle = new GrowableXYZArray();\r\nconst scratchWorkArray = new GrowableXYZArray();\r\n\r\nfunction accumulateDepthRange(point: Point3d, viewRotation: Matrix3d, range: Range3d) {\r\n viewRotation.multiplyXYZtoXYZ(point, scratchPoint);\r\n range.extend(scratchPoint);\r\n}\r\n\r\nfunction accumulateFrustumPlaneDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal, viewRotation: Matrix3d, range: Range3d, eyePoint?: Point3d) {\r\n let includeHorizon = false;\r\n for (let i = 0; i < 4; i++) {\r\n const frustumRay = Ray3d.createStartEnd(eyePoint ? eyePoint : frustum.points[i + 4], frustum.points[i]);\r\n const thisFraction = frustumRay.intersectionWithPlane(plane, scratchPoint);\r\n if (undefined !== thisFraction && (!eyePoint || thisFraction > 0))\r\n accumulateDepthRange(scratchPoint, viewRotation, range);\r\n else\r\n includeHorizon = true;\r\n }\r\n if (includeHorizon) {\r\n if (eyePoint !== undefined) {\r\n const eyeHeight = plane.altitude(eyePoint);\r\n if (eyeHeight < 0)\r\n accumulateDepthRange(eyePoint, viewRotation, range);\r\n else {\r\n const viewZ = viewRotation.getRow(2);\r\n const horizonDistance = Math.sqrt(eyeHeight * eyeHeight + 2 * eyeHeight * Constant.earthRadiusWGS84.equator);\r\n accumulateDepthRange(eyePoint.plusScaled(viewZ, -horizonDistance, scratchPoint), viewRotation, range);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function getFrustumPlaneIntersectionDepthRange(frustum: Frustum, plane: Plane3dByOriginAndUnitNormal): Range1d {\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewRotation = frustum.getRotation(scratchViewRotation)!;\r\n const intersectRange = Range3d.createNull();\r\n accumulateFrustumPlaneDepthRange(frustum, plane, viewRotation, intersectRange, eyePoint);\r\n\r\n return intersectRange.isNull ? Range1d.createNull() : Range1d.createXX(intersectRange.low.z, intersectRange.high.z);\r\n}\r\n\r\n/** Geometry of background map - either an ellipsoid or a plane as defined by GlobeMode.\r\n * @internal\r\n */\r\nexport class BackgroundMapGeometry {\r\n public readonly globeMode: GlobeMode;\r\n public readonly geometry: Plane3dByOriginAndUnitNormal | Ellipsoid;\r\n public readonly globeOrigin: Point3d;\r\n public readonly globeMatrix: Matrix3d;\r\n public readonly cartesianRange: Range3d;\r\n public readonly cartesianTransitionRange: Range3d;\r\n public readonly cartesianPlane: Plane3dByOriginAndUnitNormal;\r\n public readonly cartesianDiagonal: number;\r\n public readonly cartesianChordHeight: number;\r\n public readonly maxGeometryChordHeight: number;\r\n private _mercatorFractionToDb: Transform;\r\n private _mercatorTilingScheme: WebMercatorTilingScheme;\r\n private _ecefToDb: Transform;\r\n public static maxCartesianDistance = 1E4; // If globe is 3D we still consider the map geometry flat within this distance of the project extents.\r\n private static _transitionDistanceMultiplier = .25; // In the transition range which extends beyond the cartesian range we interpolate between cartesian and ellipsoid.\r\n\r\n private static _scratchRayFractions = new Array<number>();\r\n private static _scratchRayAngles = new Array<LongitudeLatitudeNumber>();\r\n private static _scratchPoint = Point3d.createZero();\r\n\r\n constructor(private _bimElevationBias: number, globeMode: GlobeMode, private _iModel: IModelConnection) {\r\n this._ecefToDb = _iModel.getMapEcefToDb(_bimElevationBias);\r\n this.globeMode = globeMode;\r\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(_iModel);\r\n this.cartesianTransitionRange = this.cartesianRange.clone();\r\n this.cartesianTransitionRange.expandInPlace(BackgroundMapGeometry.getCartesianTransitionDistance(_iModel));\r\n this.cartesianDiagonal = this.cartesianRange.diagonal().magnitudeXY();\r\n const earthRadius = Constant.earthRadiusWGS84.equator;\r\n this.globeOrigin = this._ecefToDb.origin.cloneAsPoint3d();\r\n this.globeMatrix = this._ecefToDb.matrix.clone();\r\n this.cartesianChordHeight = Math.sqrt(this.cartesianDiagonal * this.cartesianDiagonal + earthRadius * earthRadius) - earthRadius; // Maximum chord height deviation of the cartesian area.\r\n const halfChordAngle = Angle.piOver2Radians / 10;\r\n this.maxGeometryChordHeight = (1 - Math.cos(halfChordAngle)) * earthRadius;\r\n this.cartesianPlane = this.getPlane();\r\n this.geometry = (globeMode === GlobeMode.Ellipsoid) ? this.getEarthEllipsoid() : this.cartesianPlane;\r\n this._mercatorTilingScheme = new WebMercatorTilingScheme();\r\n this._mercatorFractionToDb = this._mercatorTilingScheme.computeMercatorFractionToDb(this._ecefToDb, _bimElevationBias, _iModel, false);\r\n }\r\n public static getCartesianRange(iModel: IModelConnection, result?: Range3d): Range3d {\r\n const cartesianRange = Range3d.createFrom(iModel.projectExtents, result);\r\n cartesianRange.expandInPlace(BackgroundMapGeometry.maxCartesianDistance);\r\n return cartesianRange;\r\n }\r\n public static getCartesianTransitionDistance(iModel: IModelConnection): number {\r\n return BackgroundMapGeometry.getCartesianRange(iModel, scratchRange).diagonal().magnitudeXY() * BackgroundMapGeometry._transitionDistanceMultiplier;\r\n }\r\n\r\n public async dbToCartographicFromGcs(db: XYAndZ, result?: Cartographic): Promise<Cartographic> {\r\n return this.cartesianRange.containsPoint(Point3d.createFrom(db)) ? this._iModel.spatialToCartographic(db, result) : this.dbToCartographic(db, result);\r\n }\r\n\r\n public dbToCartographic(db: XYAndZ, result?: Cartographic): Cartographic {\r\n if (undefined === result)\r\n result = Cartographic.createZero();\r\n\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const mercatorFraction = this._mercatorFractionToDb.multiplyInversePoint3d(db)!;\r\n return this._mercatorTilingScheme.fractionToCartographic(mercatorFraction.x, mercatorFraction.y, result, mercatorFraction.z);\r\n } else {\r\n const ecef = this._ecefToDb.multiplyInversePoint3d(db)!;\r\n return Cartographic.fromEcef(ecef, result)!;\r\n }\r\n }\r\n\r\n public async cartographicToDbFromGcs(cartographic: Cartographic, result?: Point3d): Promise<Point3d> {\r\n let db;\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\r\n db = this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\r\n } else {\r\n db = this._ecefToDb.multiplyPoint3d(cartographic.toEcef())!;\r\n }\r\n return (!this._iModel.noGcsDefined && this.cartesianRange.containsPoint(db)) ? this._iModel.cartographicToSpatialFromGcs(cartographic) : db;\r\n }\r\n public cartographicToDb(cartographic: Cartographic, result?: Point3d): Point3d {\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n this._mercatorTilingScheme.cartographicToFraction(cartographic.latitude, cartographic.longitude, fraction);\r\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, cartographic.height, result);\r\n } else {\r\n return this._ecefToDb.multiplyPoint3d(cartographic.toEcef())!;\r\n }\r\n }\r\n\r\n public getEarthEllipsoid(radiusOffset = 0): Ellipsoid {\r\n const equatorRadius = Constant.earthRadiusWGS84.equator + radiusOffset, polarRadius = Constant.earthRadiusWGS84.polar + radiusOffset;\r\n return Ellipsoid.createCenterMatrixRadii(this.globeOrigin, this.globeMatrix, equatorRadius, equatorRadius, polarRadius);\r\n }\r\n public getPlane(offset = 0) {\r\n return Plane3dByOriginAndUnitNormal.create(Point3d.create(0, 0, this._bimElevationBias + offset), Vector3d.create(0, 0, 1))!;\r\n }\r\n\r\n public getRayIntersection(ray: Ray3d, positiveOnly: boolean): Ray3d | undefined {\r\n let intersect;\r\n if (this.globeMode === GlobeMode.Ellipsoid) {\r\n const ellipsoid = this.geometry as Ellipsoid;\r\n BackgroundMapGeometry._scratchRayAngles.length = 0;\r\n BackgroundMapGeometry._scratchRayFractions.length = 0;\r\n\r\n const count = ellipsoid.intersectRay(ray, BackgroundMapGeometry._scratchRayFractions, undefined, BackgroundMapGeometry._scratchRayAngles);\r\n let intersectDistance;\r\n for (let i = 0; i < count; i++) {\r\n const thisFraction = BackgroundMapGeometry._scratchRayFractions[i];\r\n if ((!positiveOnly || thisFraction > 0) && (undefined === intersectDistance || thisFraction < intersectDistance)) {\r\n intersectDistance = thisFraction;\r\n intersect = scratchIntersectRay;\r\n ellipsoid.radiansToUnitNormalRay(BackgroundMapGeometry._scratchRayAngles[i].longitudeRadians, BackgroundMapGeometry._scratchRayAngles[i].latitudeRadians, intersect);\r\n if (intersect.direction.dotProduct(ray.direction) < 0) {\r\n if (this.cartesianRange.containsPoint(intersect.origin)) { // If we're in the cartesian range, correct to planar intersection.\r\n const planeFraction = ray.intersectionWithPlane(this.cartesianPlane, scratchIntersectRay.origin);\r\n if (undefined !== planeFraction && (!positiveOnly || planeFraction > 0)) {\r\n intersect.direction.setFromVector3d(this.cartesianPlane.getNormalRef());\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\r\n const thisFraction = ray.intersectionWithPlane(plane, scratchIntersectRay.origin);\r\n if (undefined !== thisFraction && (!positiveOnly || thisFraction > 0)) {\r\n intersect = scratchIntersectRay;\r\n intersect.direction.setFromVector3d(plane.getNormalRef());\r\n }\r\n }\r\n return intersect;\r\n }\r\n public getPointHeight(point: Point3d): number | undefined {\r\n if (this.globeMode === GlobeMode.Ellipsoid) {\r\n const ellipsoid = this.geometry as Ellipsoid;\r\n const projected = ellipsoid.projectPointToSurface(point);\r\n if (undefined === projected)\r\n return undefined;\r\n\r\n const distance = ellipsoid.radiansToPoint(projected.longitudeRadians, projected.latitudeRadians).distance(point);\r\n const ellipsePoint = ellipsoid.transformRef.multiplyInversePoint3d(point, BackgroundMapGeometry._scratchPoint)!;\r\n return ellipsePoint.magnitude() < 1 ? -distance : distance;\r\n } else {\r\n const plane = this.geometry as Plane3dByOriginAndUnitNormal;\r\n return plane.altitude(point);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public getFrustumIntersectionDepthRange(frustum: Frustum, bimRange: Range3d, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewRotation = frustum.getRotation(scratchViewRotation);\r\n if (undefined === viewRotation)\r\n return Range1d.createNull(); // Degenerate frustum...\r\n const viewZ = viewRotation.getRow(2);\r\n const cartoRange = this.cartesianTransitionRange;\r\n const intersectRange = Range3d.createNull();\r\n const doAccumulate = ((point: Point3d) => accumulateDepthRange(point, viewRotation, intersectRange));\r\n\r\n if (gridPlane)\r\n accumulateFrustumPlaneDepthRange(frustum, gridPlane, viewRotation, intersectRange, eyePoint);\r\n if (this.geometry instanceof Plane3dByOriginAndUnitNormal) {\r\n // Intersection with a planar background projection...\r\n const heights = heightRange ? [heightRange.low, heightRange.high] : [0];\r\n for (const height of heights) {\r\n accumulateFrustumPlaneDepthRange(frustum, this.getPlane(height), viewRotation, intersectRange, eyePoint);\r\n }\r\n } else {\r\n const minOffset = heightRange ? heightRange.low : 0, maxOffset = (heightRange ? heightRange.high : 0) + this.cartesianChordHeight;\r\n const radiusOffsets = [minOffset, maxOffset];\r\n\r\n // If we are doing global scope then include minimum ellipsoid that represents the chordal approximation of the low level tiles.\r\n // this substantially expands the frustum so don't do it for non-global views, but this clipping out the low level tiles.\r\n if (doGlobalScope)\r\n radiusOffsets.push(minOffset - this.maxGeometryChordHeight);\r\n\r\n const toView = Transform.createRefs(Point3d.createZero(), viewRotation);\r\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\r\n\r\n for (const radiusOffset of radiusOffsets) {\r\n const ellipsoid = this.getEarthEllipsoid(radiusOffset);\r\n const isInside = eyePoint && ellipsoid.worldToLocal(eyePoint)!.magnitude() < 1.0;\r\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\r\n const clipPlaneCount = clipPlanes.planes.length;\r\n\r\n // Extrema...\r\n let angles, extremaPoint;\r\n if (undefined !== (angles = ellipsoid.surfaceNormalToAngles(viewZ)) &&\r\n undefined !== (extremaPoint = ellipsoid.radiansToPoint(angles.longitudeRadians, angles.latitudeRadians)) &&\r\n (eyePoint === undefined || viewZ.dotProductStartEnd(extremaPoint, eyePoint) > 0) &&\r\n clipPlanes.classifyPointContainment([extremaPoint], false) !== ClipPlaneContainment.StronglyOutside)\r\n doAccumulate(extremaPoint);\r\n\r\n if (isInside) {\r\n if (eyePoint) doAccumulate(eyePoint);\r\n } else {\r\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\r\n if (silhouette !== undefined) {\r\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\r\n // Push the silhouette plane as clip so that we do not include geometry at other side of ellipsoid.\r\n // First make sure that it is pointing in the right direction.\r\n if (eyePoint) {\r\n // Clip toward eye.\r\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n } else {\r\n /* If parallel projection - clip toward side of ellipsoid with BIM geometry */\r\n if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n }\r\n clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))!);\r\n } else {\r\n clipPlanes.planes.push(ClipPlane.createNormalAndPoint(viewZ, center)!);\r\n }\r\n }\r\n if (!isInside || radiusOffset === radiusOffsets[0]) {\r\n // Intersections of ellipsoid with frustum planes...\r\n const viewingInside = eyePoint !== undefined && viewZ.dotProduct(Vector3d.createStartEnd(center, eyePoint)) < 0;\r\n if (eyePoint === undefined || !isInside || viewingInside) {\r\n for (const clipPlane of clipPlanes.planes) {\r\n const plane = clipPlane.getPlane3d();\r\n const arc = ellipsoid.createPlaneSection(plane);\r\n if (undefined !== arc) {\r\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\r\n if (Math.abs(a1 - a0) < 1.0E-8) {\r\n doAccumulate(cp.fractionToPoint(a0)); // Tiny sweep - avoid problem with rangeMethod (not worth doing anyway).\r\n } else {\r\n const segment = cp.clonePartialCurve(a0, a1);\r\n if (segment !== undefined)\r\n segment.extendRange(intersectRange, toView);\r\n\r\n }\r\n });\r\n }\r\n }\r\n }\r\n // Intersections of the cartesian region with frustum planes.\r\n scratchCartoRectangle.resize(0);\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: radiusOffset });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: radiusOffset });\r\n\r\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\r\n for (let i = 0; i < scratchCartoRectangle.length; i++)\r\n doAccumulate(scratchCartoRectangle.getPoint3dAtUncheckedPointIndex(i));\r\n while (clipPlanes.planes.length > clipPlaneCount) // Remove pushed silhouette plane.\r\n clipPlanes.planes.pop();\r\n }\r\n }\r\n }\r\n\r\n if (intersectRange.zLength() < 5) {\r\n // For the case where the fitted depth is small (less than 5 meters) we must be viewing planar projection or the\r\n // planar portion of the iModel in plan view. In this case use a constant (arbitrarily 100 meters) depth so that the frustum\r\n // Z is doesn't change and cause nearly planar geometry to jitter in Z buffer.\r\n const zCenter = (intersectRange.low.z + intersectRange.high.z) / 2;\r\n const zExpand = 50;\r\n return Range1d.createXX(zCenter - zExpand, zCenter + zExpand);\r\n } else {\r\n const diagonal = intersectRange.diagonal(scratchVector).magnitudeXY();\r\n const expansion = diagonal * .01;\r\n return Range1d.createXX(intersectRange.low.z - expansion, intersectRange.high.z + expansion);\r\n }\r\n }\r\n\r\n public addFrustumDecorations(builder: GraphicBuilder, frustum: Frustum) {\r\n if (this.geometry instanceof Ellipsoid) {\r\n const ellipsoid = this.geometry;\r\n const clipPlanes = frustum.getRangePlanes(false, false, 0);\r\n const viewRotation = frustum.getRotation()!;\r\n const eyePoint = frustum.getEyePoint(scratchEyePoint);\r\n const viewZ = viewRotation.getRow(2);\r\n const eyePoint4d = eyePoint ? Point4d.createFromPointAndWeight(eyePoint, 1) : Point4d.createFromPointAndWeight(viewZ, 0);\r\n const isInside = eyePoint && ellipsoid.worldToLocal(eyePoint)!.magnitude() < 1.0;\r\n const center = ellipsoid.localToWorld(scratchZeroPoint, scratchCenterPoint);\r\n const cartoRange = this.cartesianTransitionRange;\r\n\r\n if (!isInside) {\r\n const silhouette = ellipsoid.silhouetteArc(eyePoint4d);\r\n if (silhouette !== undefined) {\r\n silhouette.perpendicularVector.clone(scratchSilhouetteNormal);\r\n if (scratchSilhouetteNormal.dotProduct(viewZ) < 0)\r\n scratchSilhouetteNormal.negate(scratchSilhouetteNormal);\r\n clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))!);\r\n } else {\r\n clipPlanes.planes.push(ClipPlane.createNormalAndPoint(viewZ, center)!);\r\n }\r\n\r\n const ellipsoidColor = ColorDef.create(ColorByName.yellow);\r\n builder.setSymbology(ellipsoidColor, ellipsoidColor, 1, 2);\r\n for (const clipPlane of clipPlanes.planes) {\r\n const plane = clipPlane.getPlane3d();\r\n const arc = ellipsoid.createPlaneSection(plane);\r\n if (undefined !== arc) {\r\n arc.announceClipIntervals(clipPlanes, (a0: number, a1: number, cp: CurvePrimitive) => {\r\n const segment = cp.clonePartialCurve(a0, a1);\r\n if (segment !== undefined)\r\n builder.addArc(segment as Arc3d, false, false);\r\n });\r\n }\r\n\r\n // Intersections of the cartesian region with frustum planes.\r\n scratchCartoRectangle.resize(0);\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.low.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.high.x, y: cartoRange.high.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.high.y, z: 0 });\r\n scratchCartoRectangle.push({ x: cartoRange.low.x, y: cartoRange.low.y, z: 0 });\r\n\r\n clipPlanes.clipConvexPolygonInPlace(scratchCartoRectangle, scratchWorkArray);\r\n if (scratchCartoRectangle.length > 0) {\r\n builder.addLineString(scratchCartoRectangle.getPoint3dArray());\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** Calculate the ECEF to database (IModel) coordinate transform at a provided location, using the GCS of the iModel.\r\n * The transform will exactly represent the GCS at the provided location.\r\n * @public\r\n */\r\nexport async function calculateEcefToDbTransformAtLocation(originIn: Point3d, iModel: IModelConnection): Promise<Transform | undefined> {\r\n const geoConverter = iModel.noGcsDefined ? undefined : iModel.geoServices.getConverter(\"WGS84\");\r\n if (geoConverter === undefined)\r\n return undefined;\r\n\r\n const origin = Point3d.create(originIn.x, originIn.y, 0); // Always Test at zero.\r\n const eastPoint = origin.plusXYZ(1, 0, 0);\r\n const northPoint = origin.plusXYZ(0, 1, 0);\r\n\r\n const response = await geoConverter.getGeoCoordinatesFromIModelCoordinates([origin, northPoint, eastPoint]);\r\n if (response.geoCoords[0].s !== GeoCoordStatus.Success || response.geoCoords[1].s !== GeoCoordStatus.Success || response.geoCoords[2].s !== GeoCoordStatus.Success)\r\n return undefined;\r\n\r\n const geoOrigin = Point3d.fromJSON(response.geoCoords[0].p);\r\n const geoNorth = Point3d.fromJSON(response.geoCoords[1].p);\r\n const geoEast = Point3d.fromJSON(response.geoCoords[2].p);\r\n const ecefOrigin = Cartographic.fromDegrees({ longitude: geoOrigin.x, latitude: geoOrigin.y, height: geoOrigin.z }).toEcef()!;\r\n const ecefNorth = Cartographic.fromDegrees({ longitude: geoNorth.x, latitude: geoNorth.y, height: geoNorth.z }).toEcef()!;\r\n const ecefEast = Cartographic.fromDegrees({ longitude: geoEast.x, latitude: geoEast.y, height: geoEast.z }).toEcef()!;\r\n\r\n const xVector = Vector3d.createStartEnd(ecefOrigin, ecefEast);\r\n const yVector = Vector3d.createStartEnd(ecefOrigin, ecefNorth);\r\n const zVector = xVector.unitCrossProduct(yVector);\r\n if (undefined === zVector) {\r\n assert(false); // Should never occur.\r\n return undefined;\r\n }\r\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector);\r\n if (matrix === undefined)\r\n return undefined;\r\n\r\n const inverse = matrix.inverse();\r\n if (inverse === undefined) {\r\n assert(false); // Should never occur.\r\n return undefined;\r\n }\r\n\r\n return Transform.createMatrixPickupPutdown(matrix, origin, ecefOrigin).inverse()!;\r\n}\r\n\r\n"]}
@@ -25,6 +25,7 @@ export declare enum OutputMessageType {
25
25
  */
26
26
  export declare enum OutputMessagePriority {
27
27
  None = 0,
28
+ Success = 1,
28
29
  Error = 10,
29
30
  Warning = 11,
30
31
  Info = 12,
@@ -65,7 +66,8 @@ export declare enum MessageBoxIconType {
65
66
  Information = 1,
66
67
  Question = 2,
67
68
  Warning = 3,
68
- Critical = 4
69
+ Critical = 4,
70
+ Success = 5
69
71
  }
70
72
  /** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].
71
73
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationManager.d.ts","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBA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QG;IACI,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAK7H,iDAAiD;IAC1C,YAAY,IAAI,IAAI;IAE3B;;;OAGG;IACI,oBAAoB,CAAC,aAAa,EAAE,KAAK,EAAE,iBAAiB,mBAA4B,GAAG,IAAI;IAEtG,gEAAgE;IACzD,mBAAmB,IAAI,IAAI;IAElC,mEAAmE;IAC5D,sBAAsB,IAAI,IAAI;IAErC;;OAEG;IACI,iBAAiB,CAAC,YAAY,EAAE,0BAA0B,GAAG,SAAS;IAI7E;;;;;;OAMG;IACI,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,GAAG,MAAM,EAAE,eAAe,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,WAAW,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAKpK;;;;;;OAMG;IACI,wBAAwB,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,GAAG,MAAM,EAAE,eAAe,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAMrK,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,kBAAkB;CAe3B"}
@@ -32,6 +32,7 @@ export var OutputMessageType;
32
32
  export var OutputMessagePriority;
33
33
  (function (OutputMessagePriority) {
34
34
  OutputMessagePriority[OutputMessagePriority["None"] = 0] = "None";
35
+ OutputMessagePriority[OutputMessagePriority["Success"] = 1] = "Success";
35
36
  OutputMessagePriority[OutputMessagePriority["Error"] = 10] = "Error";
36
37
  OutputMessagePriority[OutputMessagePriority["Warning"] = 11] = "Warning";
37
38
  OutputMessagePriority[OutputMessagePriority["Info"] = 12] = "Info";
@@ -77,6 +78,7 @@ export var MessageBoxIconType;
77
78
  MessageBoxIconType[MessageBoxIconType["Question"] = 2] = "Question";
78
79
  MessageBoxIconType[MessageBoxIconType["Warning"] = 3] = "Warning";
79
80
  MessageBoxIconType[MessageBoxIconType["Critical"] = 4] = "Critical";
81
+ MessageBoxIconType[MessageBoxIconType["Success"] = 5] = "Success";
80
82
  })(MessageBoxIconType || (MessageBoxIconType = {}));
81
83
  /** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].
82
84
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAS,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAoB,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uGAAuG;IACvG,2DAAS,CAAA;IACT,2GAA2G;IAC3G,+DAAW,CAAA;IACX,2FAA2F;IAC3F,6DAAU,CAAA;IACV,4EAA4E;IAC5E,qEAAc,CAAA;IACd,yBAAyB;IACzB,2DAAS,CAAA;AACX,CAAC,EAXW,iBAAiB,KAAjB,iBAAiB,QAW5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,iEAAQ,CAAA;IACR,oEAAU,CAAA;IACV,wEAAY,CAAA;IACZ,kEAAS,CAAA;IACT,oEAAU,CAAA;IACV,oEAAU,CAAA;AACZ,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,2DAAQ,CAAA;IACR,+DAAU,CAAA;I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qBAAqB,CAAC,KAAK,CAAC;YACrC,KAAK,eAAe,CAAC,IAAI,CAAC;YAC1B;gBACE,OAAO,qBAAqB,CAAC,IAAI,CAAC;SACrC;IACH,CAAC;IAEO,kBAAkB,CAAC,aAAkC;QAC3D,QAAQ,aAAa,EAAE;YACrB,KAAK,kBAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC,KAAK,kBAAkB,CAAC,UAAU;gBAChC,OAAO,iBAAiB,CAAC,UAAU,CAAC;YACtC,KAAK,kBAAkB,CAAC,MAAM;gBAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC;YAClC,KAAK,kBAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Notifications\r\n */\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { Point2d, XAndY } from \"@itwin/core-geometry\";\r\nimport { DisplayMessageType, MessagePresenter, MessageSeverity, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolAssistanceInstructions } from \"./tools/ToolAssistance\";\r\n\r\n// cSpell:words messagebox\r\n\r\n/** Describes the type and behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageType {\r\n /** Temporary message box displays at the top or bottom of the screen then disappears automatically. */\r\n Toast = 0,\r\n /** Message box displays near the cursor over a Viewport and is closed by calling `closePointerMessage`. */\r\n Pointer = 1,\r\n /** Message box displays at the top or bottom of the screen and contains a Close button. */\r\n Sticky = 2,\r\n /** Message box displays near an input field and contains a Close button. */\r\n InputField = 3,\r\n /** Modal message box. */\r\n Alert = 4,\r\n}\r\n\r\n/** Classifies a [[NotifyMessageDetails]] by its level of importance.\r\n * @public\r\n */\r\nexport enum OutputMessagePriority {\r\n None = 0,\r\n Error = 10,\r\n Warning = 11,\r\n Info = 12,\r\n Debug = 13,\r\n Fatal = 17,\r\n}\r\n\r\n/** Describes the alert behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageAlert {\r\n None = 0,\r\n Dialog = 1,\r\n Balloon = 2,\r\n}\r\n\r\n/** Reason for ending the activity message via endActivityMessage\r\n * @public\r\n */\r\nexport enum ActivityMessageEndReason {\r\n Completed = 0,\r\n Cancelled = 1,\r\n}\r\n\r\n/** Describes the set of buttons displayed in a message box opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxType {\r\n OkCancel,\r\n Ok,\r\n LargeOk,\r\n MediumAlert,\r\n YesNoCancel,\r\n YesNo,\r\n}\r\n\r\n/** Describes the icon displayed in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxIconType {\r\n NoSymbol = 0, // Means Don't draw Symbol\r\n Information = 1, // Lower Case i\r\n Question = 2, // Question Mark\r\n Warning = 3, // Exclamation Point\r\n Critical = 4, // Stop Sign\r\n}\r\n\r\n/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxValue {\r\n Apply = 1,\r\n Reset = 2,\r\n Ok = 3,\r\n Cancel = 4,\r\n Default = 5,\r\n Yes = 6,\r\n No = 7,\r\n Retry = 8,\r\n Stop = 9,\r\n Help = 10,\r\n YesToAll = 11,\r\n NoToAll = 12,\r\n}\r\n\r\n/** Describes the behavior of a tooltip created using [[NotificationManager.openToolTip]].\r\n * @public\r\n */\r\nexport interface ToolTipOptions {\r\n duration?: BeDuration;\r\n placement?: string;\r\n}\r\n\r\n/** Describes a message to be displayed to the user.\r\n * @public\r\n */\r\nexport class NotifyMessageDetails {\r\n public displayTime = BeDuration.fromSeconds(5);\r\n public viewport?: HTMLElement;\r\n public inputField?: HTMLElement;\r\n public displayPoint?: Point2d;\r\n public relativePosition = RelativePosition.TopRight;\r\n\r\n /** Constructor\r\n * @param priority The priority this message should be accorded by the NotificationManager.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param msgType The type of message. Defaults to Toast.\r\n * @param openAlert Whether an alert box should be displayed or not, and if so what kind.\r\n */\r\n public constructor(public priority: OutputMessagePriority, public briefMessage: HTMLElement | string,\r\n public detailedMessage?: HTMLElement | string, public msgType = OutputMessageType.Toast, public openAlert = OutputMessageAlert.None) { }\r\n\r\n /** Set OutputMessageType.Pointer message details.\r\n * @param viewport Viewport over which to display the Pointer type message.\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public setPointerTypeDetails(viewport: HTMLElement, displayPoint: XAndY, relativePosition = RelativePosition.TopRight) {\r\n this.viewport = viewport;\r\n this.displayPoint = Point2d.fromJSON(displayPoint);\r\n this.relativePosition = relativePosition;\r\n this.msgType = OutputMessageType.Pointer;\r\n }\r\n\r\n /** Set OutputMessageType.InputField message details.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n */\r\n public setInputFieldTypeDetails(inputField: HTMLElement) {\r\n this.inputField = inputField;\r\n this.msgType = OutputMessageType.InputField;\r\n }\r\n}\r\n\r\n/** Specifies the details of an activity message to be displayed to the user.\r\n * @public\r\n */\r\nexport class ActivityMessageDetails {\r\n public wasCancelled = false;\r\n\r\n /**\r\n * @param showProgressBar Indicates whether to show the progress bar in the activity message dialog.\r\n * @param showPercentInMessage Indicates whether to show the percentage complete in the activity message text.\r\n * @param supportsCancellation Indicates whether to show the Cancel button, giving the user the ability to cancel the operation.\r\n * @param showDialogInitially Indicates whether to show the activity message dialog initially. User can click status bar to open it.\r\n */\r\n public constructor(public showProgressBar: boolean, public showPercentInMessage: boolean, public supportsCancellation: boolean, public showDialogInitially: boolean = true) { }\r\n\r\n /** Called from NotificationAdmin when the user cancels the activity. */\r\n public onActivityCancelled() { this.wasCancelled = true; }\r\n\r\n /** Called from NotificationAdmin when the activity completes successfully. */\r\n public onActivityCompleted() { this.wasCancelled = false; }\r\n}\r\n\r\n/** The NotificationManager controls the interaction with the user for prompts, error messages, and alert dialogs.\r\n * Implementations of the NotificationManager may present the information in different ways. For example, in\r\n * non-interactive sessions, these messages may be saved to a log file or simply discarded.\r\n * @public\r\n */\r\nexport class NotificationManager implements MessagePresenter {\r\n public readonly toolTipLocation = new Point2d();\r\n\r\n /** Output a prompt, given a localization key.\r\n * @param key The key of the localized string with the prompt message.\r\n */\r\n public outputPromptByKey(key: string) { this.outputPrompt(IModelApp.localization.getLocalizedString(key)); }\r\n\r\n /** Output a localized prompt to the user. A 'prompt' indicates an action the user should take to proceed.\r\n * @param _prompt The localized string with the prompt message.\r\n */\r\n public outputPrompt(_prompt: string) { }\r\n\r\n /** Output a message and/or alert to the user. */\r\n public outputMessage(_message: NotifyMessageDetails) { }\r\n\r\n /** Output a MessageBox and wait for response from the user.\r\n * @param _mbType The MessageBox type.\r\n * @param _message The message to display.\r\n * @param _icon The MessageBox icon type.\r\n * @return the response from the user.\r\n */\r\n public async openMessageBox(_mbType: MessageBoxType, _message: HTMLElement | string, _icon: MessageBoxIconType): Promise<MessageBoxValue> { return MessageBoxValue.Ok; }\r\n\r\n /**\r\n * Set up for activity messages.\r\n * @param _details The activity message details.\r\n * @return true if the message was displayed, false if an invalid priority is specified.\r\n */\r\n public setupActivityMessage(_details: ActivityMessageDetails) { return true; }\r\n\r\n /**\r\n * Output an activity message to the user.\r\n * @param _messageText The message text.\r\n * @param _percentComplete The percentage of completion.\r\n * @return true if the message was displayed, false if the message could not be displayed.\r\n */\r\n public outputActivityMessage(_messageText: HTMLElement | string, _percentComplete: number) { return true; }\r\n\r\n /**\r\n * End an activity message.\r\n * @param _reason The reason for the end of the Activity Message.\r\n * @return true if the message was ended successfully, false if the activityMessage could not be ended.\r\n */\r\n public endActivityMessage(_reason: ActivityMessageEndReason) { return true; }\r\n\r\n /** Return true if _showTooltip has an implementation and will display a tooltip. */\r\n public get isToolTipSupported(): boolean { return false; }\r\n\r\n /** Return true if the tooltip is currently open. */\r\n public get isToolTipOpen(): boolean { return false; }\r\n\r\n /** Implement to display a tooltip message at the specified location. */\r\n protected _showToolTip(_htmlElement: HTMLElement, _message: HTMLElement | string, _location?: XAndY, _options?: ToolTipOptions): void { }\r\n\r\n /** Show a tooltip window. Saves tooltip location for AccuSnap to test if cursor has moved far enough away to close tooltip.\r\n * @param htmlElement The HTMLElement that anchors the toolTip.\r\n * @param message What to display inside the ToolTip. May be a string or an HTMLElement.\r\n * @param location An optional location, relative to the origin of _htmlElement, for the ToolTip. If undefined, center of `htmlElement`\r\n * @param options Options that supply additional information about how the ToolTip should function.\r\n * @note If message is an HTMLElement, the notification manager will display the HTMLElement verbatim. This can represent a security\r\n * risk if any part the element is created from user input. Applications should be careful to *sanitize* any such input before\r\n * creating an HTMLElement to pass to this method.\r\n */\r\n public openToolTip(htmlElement: HTMLElement, message: HTMLElement | string, location?: XAndY, options?: ToolTipOptions): void {\r\n this.toolTipLocation.setFrom(location);\r\n this._showToolTip(htmlElement, message, location, options);\r\n }\r\n\r\n /** Clear the tooltip if it is currently open. */\r\n public clearToolTip(): void { }\r\n\r\n /** Update message position created with [[OutputMessageType.Pointer]].\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }\r\n\r\n /** Close message created with [[OutputMessageType.Pointer]]. */\r\n public closePointerMessage(): void { }\r\n\r\n /** Close message created with [[OutputMessageType.InputField]]. */\r\n public closeInputFieldMessage(): void { }\r\n\r\n /** Setup tool assistance instructions for a tool. The instructions include the main instruction, which includes the current prompt.\r\n * @param instructions The tool assistance instructions.\r\n */\r\n public setToolAssistance(instructions: ToolAssistanceInstructions | undefined) {\r\n this.outputPrompt(instructions ? instructions.mainInstruction.text : \"\");\r\n }\r\n\r\n /**\r\n * Displays a notification message.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param messageType The type of message. Defaults to Toast.\r\n */\r\n public displayMessage(severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string, messageType?: DisplayMessageType): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage, this.convertMessageType(messageType));\r\n this.outputMessage(details);\r\n }\r\n\r\n /**\r\n * Displays an input field notification message.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n */\r\n public displayInputFieldMessage(inputField: HTMLElement, severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage);\r\n details.setInputFieldTypeDetails(inputField);\r\n this.outputMessage(details);\r\n }\r\n\r\n private convertSeverityToPriority(severity: MessageSeverity): OutputMessagePriority {\r\n switch (severity) {\r\n case MessageSeverity.Information:\r\n return OutputMessagePriority.Info;\r\n case MessageSeverity.Warning:\r\n return OutputMessagePriority.Warning;\r\n case MessageSeverity.Error:\r\n return OutputMessagePriority.Error;\r\n case MessageSeverity.Fatal:\r\n return OutputMessagePriority.Fatal;\r\n case MessageSeverity.None:\r\n default:\r\n return OutputMessagePriority.None;\r\n }\r\n }\r\n\r\n private convertMessageType(inMessageType?: DisplayMessageType): OutputMessageType | undefined {\r\n switch (inMessageType) {\r\n case DisplayMessageType.Alert:\r\n return OutputMessageType.Alert;\r\n case DisplayMessageType.InputField:\r\n return OutputMessageType.InputField;\r\n case DisplayMessageType.Sticky:\r\n return OutputMessageType.Sticky;\r\n case DisplayMessageType.Toast:\r\n return OutputMessageType.Toast;\r\n default:\r\n return undefined;\r\n }\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAS,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAoB,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uGAAuG;IACvG,2DAAS,CAAA;IACT,2GAA2G;IAC3G,+DAAW,CAAA;IACX,2FAA2F;IAC3F,6DAAU,CAAA;IACV,4EAA4E;IAC5E,qEAAc,CAAA;IACd,yBAAyB;IACzB,2DAAS,CAAA;AACX,CAAC,EAXW,iBAAiB,KAAjB,iBAAiB,QAW5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,qBAQX;AARD,WAAY,qBAAqB;IAC/B,iEAAQ,CAAA;IACR,uEAAW,CAAA;IACX,oEAAU,CAAA;IACV,wEAAY,CAAA;IACZ,kEAAS,CAAA;IACT,oEAAU,CAAA;IACV,oEAAU,CAAA;AACZ,CAAC,EARW,qBAAqB,KAArB,qBAAqB,QAQhC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,2DAAQ,CAAA;IACR,+DAAU,CAAA;IACV,iEAAW,CAAA;AACb,CAAC,EAJW,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C,KAAK,CAAC;YACrC,KAAK,eAAe,CAAC,IAAI,CAAC;YAC1B;gBACE,OAAO,qBAAqB,CAAC,IAAI,CAAC;SACrC;IACH,CAAC;IAEO,kBAAkB,CAAC,aAAkC;QAC3D,QAAQ,aAAa,EAAE;YACrB,KAAK,kBAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC,KAAK,kBAAkB,CAAC,UAAU;gBAChC,OAAO,iBAAiB,CAAC,UAAU,CAAC;YACtC,KAAK,kBAAkB,CAAC,MAAM;gBAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC;YAClC,KAAK,kBAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Notifications\r\n */\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { Point2d, XAndY } from \"@itwin/core-geometry\";\r\nimport { DisplayMessageType, MessagePresenter, MessageSeverity, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolAssistanceInstructions } from \"./tools/ToolAssistance\";\r\n\r\n// cSpell:words messagebox\r\n\r\n/** Describes the type and behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageType {\r\n /** Temporary message box displays at the top or bottom of the screen then disappears automatically. */\r\n Toast = 0,\r\n /** Message box displays near the cursor over a Viewport and is closed by calling `closePointerMessage`. */\r\n Pointer = 1,\r\n /** Message box displays at the top or bottom of the screen and contains a Close button. */\r\n Sticky = 2,\r\n /** Message box displays near an input field and contains a Close button. */\r\n InputField = 3,\r\n /** Modal message box. */\r\n Alert = 4,\r\n}\r\n\r\n/** Classifies a [[NotifyMessageDetails]] by its level of importance.\r\n * @public\r\n */\r\nexport enum OutputMessagePriority {\r\n None = 0,\r\n Success = 1,\r\n Error = 10,\r\n Warning = 11,\r\n Info = 12,\r\n Debug = 13,\r\n Fatal = 17,\r\n}\r\n\r\n/** Describes the alert behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageAlert {\r\n None = 0,\r\n Dialog = 1,\r\n Balloon = 2,\r\n}\r\n\r\n/** Reason for ending the activity message via endActivityMessage\r\n * @public\r\n */\r\nexport enum ActivityMessageEndReason {\r\n Completed = 0,\r\n Cancelled = 1,\r\n}\r\n\r\n/** Describes the set of buttons displayed in a message box opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxType {\r\n OkCancel,\r\n Ok,\r\n LargeOk,\r\n MediumAlert,\r\n YesNoCancel,\r\n YesNo,\r\n}\r\n\r\n/** Describes the icon displayed in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxIconType {\r\n NoSymbol = 0, // Means Don't draw Symbol\r\n Information = 1, // Lower Case i\r\n Question = 2, // Question Mark\r\n Warning = 3, // Exclamation Point\r\n Critical = 4, // Stop Sign\r\n Success = 5, // check mark\r\n}\r\n\r\n/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxValue {\r\n Apply = 1,\r\n Reset = 2,\r\n Ok = 3,\r\n Cancel = 4,\r\n Default = 5,\r\n Yes = 6,\r\n No = 7,\r\n Retry = 8,\r\n Stop = 9,\r\n Help = 10,\r\n YesToAll = 11,\r\n NoToAll = 12,\r\n}\r\n\r\n/** Describes the behavior of a tooltip created using [[NotificationManager.openToolTip]].\r\n * @public\r\n */\r\nexport interface ToolTipOptions {\r\n duration?: BeDuration;\r\n placement?: string;\r\n}\r\n\r\n/** Describes a message to be displayed to the user.\r\n * @public\r\n */\r\nexport class NotifyMessageDetails {\r\n public displayTime = BeDuration.fromSeconds(5);\r\n public viewport?: HTMLElement;\r\n public inputField?: HTMLElement;\r\n public displayPoint?: Point2d;\r\n public relativePosition = RelativePosition.TopRight;\r\n\r\n /** Constructor\r\n * @param priority The priority this message should be accorded by the NotificationManager.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param msgType The type of message. Defaults to Toast.\r\n * @param openAlert Whether an alert box should be displayed or not, and if so what kind.\r\n */\r\n public constructor(public priority: OutputMessagePriority, public briefMessage: HTMLElement | string,\r\n public detailedMessage?: HTMLElement | string, public msgType = OutputMessageType.Toast, public openAlert = OutputMessageAlert.None) { }\r\n\r\n /** Set OutputMessageType.Pointer message details.\r\n * @param viewport Viewport over which to display the Pointer type message.\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public setPointerTypeDetails(viewport: HTMLElement, displayPoint: XAndY, relativePosition = RelativePosition.TopRight) {\r\n this.viewport = viewport;\r\n this.displayPoint = Point2d.fromJSON(displayPoint);\r\n this.relativePosition = relativePosition;\r\n this.msgType = OutputMessageType.Pointer;\r\n }\r\n\r\n /** Set OutputMessageType.InputField message details.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n */\r\n public setInputFieldTypeDetails(inputField: HTMLElement) {\r\n this.inputField = inputField;\r\n this.msgType = OutputMessageType.InputField;\r\n }\r\n}\r\n\r\n/** Specifies the details of an activity message to be displayed to the user.\r\n * @public\r\n */\r\nexport class ActivityMessageDetails {\r\n public wasCancelled = false;\r\n\r\n /**\r\n * @param showProgressBar Indicates whether to show the progress bar in the activity message dialog.\r\n * @param showPercentInMessage Indicates whether to show the percentage complete in the activity message text.\r\n * @param supportsCancellation Indicates whether to show the Cancel button, giving the user the ability to cancel the operation.\r\n * @param showDialogInitially Indicates whether to show the activity message dialog initially. User can click status bar to open it.\r\n */\r\n public constructor(public showProgressBar: boolean, public showPercentInMessage: boolean, public supportsCancellation: boolean, public showDialogInitially: boolean = true) { }\r\n\r\n /** Called from NotificationAdmin when the user cancels the activity. */\r\n public onActivityCancelled() { this.wasCancelled = true; }\r\n\r\n /** Called from NotificationAdmin when the activity completes successfully. */\r\n public onActivityCompleted() { this.wasCancelled = false; }\r\n}\r\n\r\n/** The NotificationManager controls the interaction with the user for prompts, error messages, and alert dialogs.\r\n * Implementations of the NotificationManager may present the information in different ways. For example, in\r\n * non-interactive sessions, these messages may be saved to a log file or simply discarded.\r\n * @public\r\n */\r\nexport class NotificationManager implements MessagePresenter {\r\n public readonly toolTipLocation = new Point2d();\r\n\r\n /** Output a prompt, given a localization key.\r\n * @param key The key of the localized string with the prompt message.\r\n */\r\n public outputPromptByKey(key: string) { this.outputPrompt(IModelApp.localization.getLocalizedString(key)); }\r\n\r\n /** Output a localized prompt to the user. A 'prompt' indicates an action the user should take to proceed.\r\n * @param _prompt The localized string with the prompt message.\r\n */\r\n public outputPrompt(_prompt: string) { }\r\n\r\n /** Output a message and/or alert to the user. */\r\n public outputMessage(_message: NotifyMessageDetails) { }\r\n\r\n /** Output a MessageBox and wait for response from the user.\r\n * @param _mbType The MessageBox type.\r\n * @param _message The message to display.\r\n * @param _icon The MessageBox icon type.\r\n * @return the response from the user.\r\n */\r\n public async openMessageBox(_mbType: MessageBoxType, _message: HTMLElement | string, _icon: MessageBoxIconType): Promise<MessageBoxValue> { return MessageBoxValue.Ok; }\r\n\r\n /**\r\n * Set up for activity messages.\r\n * @param _details The activity message details.\r\n * @return true if the message was displayed, false if an invalid priority is specified.\r\n */\r\n public setupActivityMessage(_details: ActivityMessageDetails) { return true; }\r\n\r\n /**\r\n * Output an activity message to the user.\r\n * @param _messageText The message text.\r\n * @param _percentComplete The percentage of completion.\r\n * @return true if the message was displayed, false if the message could not be displayed.\r\n */\r\n public outputActivityMessage(_messageText: HTMLElement | string, _percentComplete: number) { return true; }\r\n\r\n /**\r\n * End an activity message.\r\n * @param _reason The reason for the end of the Activity Message.\r\n * @return true if the message was ended successfully, false if the activityMessage could not be ended.\r\n */\r\n public endActivityMessage(_reason: ActivityMessageEndReason) { return true; }\r\n\r\n /** Return true if _showTooltip has an implementation and will display a tooltip. */\r\n public get isToolTipSupported(): boolean { return false; }\r\n\r\n /** Return true if the tooltip is currently open. */\r\n public get isToolTipOpen(): boolean { return false; }\r\n\r\n /** Implement to display a tooltip message at the specified location. */\r\n protected _showToolTip(_htmlElement: HTMLElement, _message: HTMLElement | string, _location?: XAndY, _options?: ToolTipOptions): void { }\r\n\r\n /** Show a tooltip window. Saves tooltip location for AccuSnap to test if cursor has moved far enough away to close tooltip.\r\n * @param htmlElement The HTMLElement that anchors the toolTip.\r\n * @param message What to display inside the ToolTip. May be a string or an HTMLElement.\r\n * @param location An optional location, relative to the origin of _htmlElement, for the ToolTip. If undefined, center of `htmlElement`\r\n * @param options Options that supply additional information about how the ToolTip should function.\r\n * @note If message is an HTMLElement, the notification manager will display the HTMLElement verbatim. This can represent a security\r\n * risk if any part the element is created from user input. Applications should be careful to *sanitize* any such input before\r\n * creating an HTMLElement to pass to this method.\r\n */\r\n public openToolTip(htmlElement: HTMLElement, message: HTMLElement | string, location?: XAndY, options?: ToolTipOptions): void {\r\n this.toolTipLocation.setFrom(location);\r\n this._showToolTip(htmlElement, message, location, options);\r\n }\r\n\r\n /** Clear the tooltip if it is currently open. */\r\n public clearToolTip(): void { }\r\n\r\n /** Update message position created with [[OutputMessageType.Pointer]].\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }\r\n\r\n /** Close message created with [[OutputMessageType.Pointer]]. */\r\n public closePointerMessage(): void { }\r\n\r\n /** Close message created with [[OutputMessageType.InputField]]. */\r\n public closeInputFieldMessage(): void { }\r\n\r\n /** Setup tool assistance instructions for a tool. The instructions include the main instruction, which includes the current prompt.\r\n * @param instructions The tool assistance instructions.\r\n */\r\n public setToolAssistance(instructions: ToolAssistanceInstructions | undefined) {\r\n this.outputPrompt(instructions ? instructions.mainInstruction.text : \"\");\r\n }\r\n\r\n /**\r\n * Displays a notification message.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param messageType The type of message. Defaults to Toast.\r\n */\r\n public displayMessage(severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string, messageType?: DisplayMessageType): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage, this.convertMessageType(messageType));\r\n this.outputMessage(details);\r\n }\r\n\r\n /**\r\n * Displays an input field notification message.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n */\r\n public displayInputFieldMessage(inputField: HTMLElement, severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage);\r\n details.setInputFieldTypeDetails(inputField);\r\n this.outputMessage(details);\r\n }\r\n\r\n private convertSeverityToPriority(severity: MessageSeverity): OutputMessagePriority {\r\n switch (severity) {\r\n case MessageSeverity.Information:\r\n return OutputMessagePriority.Info;\r\n case MessageSeverity.Warning:\r\n return OutputMessagePriority.Warning;\r\n case MessageSeverity.Error:\r\n return OutputMessagePriority.Error;\r\n case MessageSeverity.Fatal:\r\n return OutputMessagePriority.Fatal;\r\n case MessageSeverity.None:\r\n default:\r\n return OutputMessagePriority.None;\r\n }\r\n }\r\n\r\n private convertMessageType(inMessageType?: DisplayMessageType): OutputMessageType | undefined {\r\n switch (inMessageType) {\r\n case DisplayMessageType.Alert:\r\n return OutputMessageType.Alert;\r\n case DisplayMessageType.InputField:\r\n return OutputMessageType.InputField;\r\n case DisplayMessageType.Sticky:\r\n return OutputMessageType.Sticky;\r\n case DisplayMessageType.Toast:\r\n return OutputMessageType.Toast;\r\n default:\r\n return undefined;\r\n }\r\n }\r\n\r\n}\r\n"]}
@@ -243,8 +243,10 @@ class RealityDataSourceImpl {
243
243
  }
244
244
  else if (this.key.provider === RealityDataProvider.CesiumIonAsset) {
245
245
  this._tilesetUrl = this.key.id;
246
- if (this.key.id === CesiumIonAssetProvider.osmBuildingId)
246
+ if (this.key.id === CesiumIonAssetProvider.osmBuildingId) {
247
247
  this._tilesetUrl = getCesiumOSMBuildingsUrl();
248
+ this._isUrlResolved = true;
249
+ }
248
250
  }
249
251
  return this._tilesetUrl;
250
252
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAkB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAe,aAAa,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAiC,iBAAiB,EAAE,mBAAmB,EAAgD,MAAM,oBAAoB,CAAC;AACtK,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AA0C7I;;GAEG;AACH,MAAM,KAAW,iBAAiB,CAyEjC;AAzED,WAAiB,iBAAiB;IAChC;;;;;;OAMG;IACH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,aAAmC,EAAE,WAA+B;QACvH,IAAI,MAA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Aa,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { getJson, request, RequestOptions } from \"@bentley/itwin-client\";\r\nimport { AccessToken, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelError, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\n\r\n/**\r\n * This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /**\r\n * This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /**\r\n * Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /**\r\n * Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if(orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName,inputProvider,format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl,inputProvider,format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex+2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @internal\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.fromKey(rdSourceKey, iTwinId);\r\n }\r\n}\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @beta\r\n*/\r\nclass RealityDataSourceImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n this.key = props.sourceKey;\r\n this._isUrlResolved=false;\r\n }\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n public static fromProps(props: RealityDataSourceProps): RealityDataSource {\r\n return new RealityDataSourceImpl(props);\r\n }\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n const rdSource = new RealityDataSourceImpl({sourceKey});\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource: undefined;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n */\r\n public static async fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.createFromKey(rdSourceKey, iTwinId);\r\n }\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.isContextShare ? this.key.id : undefined;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n public get iTwinId(): string | undefined {\r\n return this.key.iTwinId;\r\n }\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (this.isContextShare && !this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n private async _doRequest(url: string, responseType: string): Promise<any> {\r\n let options: RequestOptions = {\r\n method: \"GET\",\r\n responseType,\r\n };\r\n\r\n const authToken = this._requestAuthorization;\r\n if (authToken) {\r\n options = {\r\n ...options,\r\n headers: {\r\n authorization: authToken,\r\n },\r\n };\r\n }\r\n\r\n const data = await request(url, options);\r\n return data.body;\r\n }\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await getJson(url.toString());\r\n return data;\r\n }\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (this.isContextShare && !this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved=true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n } else if (this.key.provider === RealityDataProvider.TilesetUrl) {\r\n this._tilesetUrl = this.key.id;\r\n } else if (this.key.provider === RealityDataProvider.CesiumIonAsset ) {\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId)\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n }\r\n return this._tilesetUrl;\r\n }\r\n /** TODO: This probably required three different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium */\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (this.isContextShare && token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return this._doRequest(url, \"json\");\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"json\");\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAkB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAe,aAAa,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAiC,iBAAiB,EAAE,mBAAmB,EAAgD,MAA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;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,IAAY;QACtC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAK,IAAI,CAAC,WAAW,EAAE;YAC/B,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACzE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { getJson, request, RequestOptions } from \"@bentley/itwin-client\";\r\nimport { AccessToken, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelError, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\n\r\n/**\r\n * This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /**\r\n * This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /**\r\n * Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /**\r\n * Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if(orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName,inputProvider,format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl,inputProvider,format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex+2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @internal\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.fromKey(rdSourceKey, iTwinId);\r\n }\r\n}\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @beta\r\n*/\r\nclass RealityDataSourceImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n this.key = props.sourceKey;\r\n this._isUrlResolved=false;\r\n }\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n public static fromProps(props: RealityDataSourceProps): RealityDataSource {\r\n return new RealityDataSourceImpl(props);\r\n }\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n const rdSource = new RealityDataSourceImpl({sourceKey});\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource: undefined;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n */\r\n public static async fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.createFromKey(rdSourceKey, iTwinId);\r\n }\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.isContextShare ? this.key.id : undefined;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n public get iTwinId(): string | undefined {\r\n return this.key.iTwinId;\r\n }\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (this.isContextShare && !this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n private async _doRequest(url: string, responseType: string): Promise<any> {\r\n let options: RequestOptions = {\r\n method: \"GET\",\r\n responseType,\r\n };\r\n\r\n const authToken = this._requestAuthorization;\r\n if (authToken) {\r\n options = {\r\n ...options,\r\n headers: {\r\n authorization: authToken,\r\n },\r\n };\r\n }\r\n\r\n const data = await request(url, options);\r\n return data.body;\r\n }\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await getJson(url.toString());\r\n return data;\r\n }\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (this.isContextShare && !this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved=true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n } else if (this.key.provider === RealityDataProvider.TilesetUrl) {\r\n this._tilesetUrl = this.key.id;\r\n } else if (this.key.provider === RealityDataProvider.CesiumIonAsset ) {\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId) {\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n this._isUrlResolved = true;\r\n }\r\n }\r\n return this._tilesetUrl;\r\n }\r\n /** TODO: This probably required three different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium */\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (this.isContextShare && token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return this._doRequest(url, \"json\");\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"json\");\r\n }\r\n}\r\n\r\n"]}