@itwin/core-frontend 4.1.0-dev.51 → 4.1.0-dev.56

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 (139) hide show
  1. package/lib/cjs/BackgroundMapGeometry.d.ts +1 -0
  2. package/lib/cjs/BackgroundMapGeometry.d.ts.map +1 -1
  3. package/lib/cjs/BackgroundMapGeometry.js +29 -0
  4. package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
  5. package/lib/cjs/HitDetail.d.ts.map +1 -1
  6. package/lib/cjs/HitDetail.js +1 -1
  7. package/lib/cjs/HitDetail.js.map +1 -1
  8. package/lib/cjs/IModelConnection.d.ts +22 -4
  9. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  10. package/lib/cjs/IModelConnection.js +32 -8
  11. package/lib/cjs/IModelConnection.js.map +1 -1
  12. package/lib/cjs/Viewport.d.ts +5 -5
  13. package/lib/cjs/Viewport.d.ts.map +1 -1
  14. package/lib/cjs/Viewport.js +6 -6
  15. package/lib/cjs/Viewport.js.map +1 -1
  16. package/lib/cjs/tile/internal.d.ts +4 -0
  17. package/lib/cjs/tile/internal.d.ts.map +1 -1
  18. package/lib/cjs/tile/internal.js +4 -0
  19. package/lib/cjs/tile/internal.js.map +1 -1
  20. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +2 -0
  21. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  22. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +2 -0
  23. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  24. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +55 -2
  25. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  26. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +96 -23
  27. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  28. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.d.ts +15 -0
  29. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.d.ts.map +1 -0
  30. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.js +59 -0
  31. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.js.map +1 -0
  32. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts +44 -0
  33. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts.map +1 -0
  34. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.js +126 -0
  35. package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.js.map +1 -0
  36. package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts +26 -0
  37. package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts.map +1 -0
  38. package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js +134 -0
  39. package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js.map +1 -0
  40. package/lib/cjs/tile/map/ImageryProviders/WebMercator.d.ts +6 -0
  41. package/lib/cjs/tile/map/ImageryProviders/WebMercator.d.ts.map +1 -0
  42. package/lib/cjs/tile/map/ImageryProviders/WebMercator.js +22 -0
  43. package/lib/cjs/tile/map/ImageryProviders/WebMercator.js.map +1 -0
  44. package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -1
  45. package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
  46. package/lib/cjs/tile/map/ImageryTileTree.js +2 -2
  47. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  48. package/lib/cjs/tile/map/MapFeatureInfo.d.ts +67 -7
  49. package/lib/cjs/tile/map/MapFeatureInfo.d.ts.map +1 -1
  50. package/lib/cjs/tile/map/MapFeatureInfo.js +16 -2
  51. package/lib/cjs/tile/map/MapFeatureInfo.js.map +1 -1
  52. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +4 -1
  53. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  54. package/lib/cjs/tile/map/MapLayerImageryProvider.js +3 -1
  55. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  56. package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
  57. package/lib/cjs/tile/map/MapTile.js +9 -1
  58. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  59. package/lib/cjs/tile/map/MapTileLoader.d.ts.map +1 -1
  60. package/lib/cjs/tile/map/MapTileLoader.js +1 -15
  61. package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
  62. package/lib/cjs/tile/map/MapTileTree.d.ts +12 -3
  63. package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
  64. package/lib/cjs/tile/map/MapTileTree.js +33 -20
  65. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  66. package/lib/cjs/tile/map/MapTiledGraphicsProvider.d.ts +2 -3
  67. package/lib/cjs/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  68. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js +3 -4
  69. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  70. package/lib/esm/BackgroundMapGeometry.d.ts +1 -0
  71. package/lib/esm/BackgroundMapGeometry.d.ts.map +1 -1
  72. package/lib/esm/BackgroundMapGeometry.js +29 -0
  73. package/lib/esm/BackgroundMapGeometry.js.map +1 -1
  74. package/lib/esm/HitDetail.d.ts.map +1 -1
  75. package/lib/esm/HitDetail.js +1 -1
  76. package/lib/esm/HitDetail.js.map +1 -1
  77. package/lib/esm/IModelConnection.d.ts +22 -4
  78. package/lib/esm/IModelConnection.d.ts.map +1 -1
  79. package/lib/esm/IModelConnection.js +32 -8
  80. package/lib/esm/IModelConnection.js.map +1 -1
  81. package/lib/esm/Viewport.d.ts +5 -5
  82. package/lib/esm/Viewport.d.ts.map +1 -1
  83. package/lib/esm/Viewport.js +6 -6
  84. package/lib/esm/Viewport.js.map +1 -1
  85. package/lib/esm/tile/internal.d.ts +4 -0
  86. package/lib/esm/tile/internal.d.ts.map +1 -1
  87. package/lib/esm/tile/internal.js +4 -0
  88. package/lib/esm/tile/internal.js.map +1 -1
  89. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +2 -0
  90. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  91. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +2 -0
  92. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  93. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +55 -2
  94. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  95. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +96 -24
  96. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  97. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.d.ts +15 -0
  98. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.d.ts.map +1 -0
  99. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.js +55 -0
  100. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryReaderJSON.js.map +1 -0
  101. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts +44 -0
  102. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts.map +1 -0
  103. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.js +122 -0
  104. package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.js.map +1 -0
  105. package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts +26 -0
  106. package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts.map +1 -0
  107. package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js +130 -0
  108. package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js.map +1 -0
  109. package/lib/esm/tile/map/ImageryProviders/WebMercator.d.ts +6 -0
  110. package/lib/esm/tile/map/ImageryProviders/WebMercator.d.ts.map +1 -0
  111. package/lib/esm/tile/map/ImageryProviders/WebMercator.js +18 -0
  112. package/lib/esm/tile/map/ImageryProviders/WebMercator.js.map +1 -0
  113. package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -1
  114. package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
  115. package/lib/esm/tile/map/ImageryTileTree.js +2 -2
  116. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  117. package/lib/esm/tile/map/MapFeatureInfo.d.ts +67 -7
  118. package/lib/esm/tile/map/MapFeatureInfo.d.ts.map +1 -1
  119. package/lib/esm/tile/map/MapFeatureInfo.js +14 -1
  120. package/lib/esm/tile/map/MapFeatureInfo.js.map +1 -1
  121. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +4 -1
  122. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  123. package/lib/esm/tile/map/MapLayerImageryProvider.js +3 -1
  124. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  125. package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
  126. package/lib/esm/tile/map/MapTile.js +9 -1
  127. package/lib/esm/tile/map/MapTile.js.map +1 -1
  128. package/lib/esm/tile/map/MapTileLoader.d.ts.map +1 -1
  129. package/lib/esm/tile/map/MapTileLoader.js +1 -15
  130. package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
  131. package/lib/esm/tile/map/MapTileTree.d.ts +12 -3
  132. package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
  133. package/lib/esm/tile/map/MapTileTree.js +34 -21
  134. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  135. package/lib/esm/tile/map/MapTiledGraphicsProvider.d.ts +2 -3
  136. package/lib/esm/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  137. package/lib/esm/tile/map/MapTiledGraphicsProvider.js +3 -4
  138. package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  139. package/package.json +18 -18
@@ -35,6 +35,7 @@ export declare class BackgroundMapGeometry {
35
35
  static getCartesianRange(iModel: IModelConnection, result?: Range3d): Range3d;
36
36
  static getCartesianTransitionDistance(iModel: IModelConnection): number;
37
37
  dbToCartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]>;
38
+ dbToWGS84CartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]>;
38
39
  dbToCartographic(db: XYAndZ, result?: Cartographic): Cartographic;
39
40
  cartographicToDbFromGcs(cartographic: Cartographic[]): Promise<Point3d[]>;
40
41
  cartographicToDb(cartographic: Cartographic, result?: Point3d): Point3d;
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundMapGeometry.d.ts","sourceRoot":"","sources":["../../src/BackgroundMapGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAA2E,SAAS,EAA6C,QAAQ,EAAE,4BAA4B,EAAW,OAAO,EAAW,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9R,OAAO,EAAE,YAAY,EAAyB,OAAO,EAAkB,SAAS,EAAc,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA4CzD,gBAAgB;AAChB,wBAAgB,qCAAqC,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAOpH;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAqBpB,OAAO,CAAC,iB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M,CAAC,EAAE,YAAY,GAAG,YAAY;IAa3D,uBAAuB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAqB/E,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAUvE,iBAAiB,CAAC,YAAY,SAAI,GAAG,SAAS;IAK9C,QAAQ,CAAC,MAAM,SAAI;IAInB,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS;IAmCxE,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAgBzD,gBAAgB;IACT,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,4BAA4B,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO;IAwHxK,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO;CAoDvE;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAsCtI"}
@@ -98,6 +98,35 @@ class BackgroundMapGeometry {
98
98
  });
99
99
  return Promise.all(promises);
100
100
  }
101
+ async dbToWGS84CartographicFromGcs(db) {
102
+ if (db.length === 0)
103
+ return [];
104
+ const result = Array(db.length);
105
+ const reproject = [];
106
+ const reprojectIdx = [];
107
+ const scratch = new core_geometry_1.Point3d();
108
+ for (let i = 0; i < db.length; i++) {
109
+ core_geometry_1.Point3d.createFrom(db[i], scratch);
110
+ if (this.cartesianRange.containsPoint(scratch)) {
111
+ reprojectIdx.push(i);
112
+ reproject.push(db[i]);
113
+ }
114
+ else {
115
+ result[i] = this.dbToCartographic(db[i]);
116
+ }
117
+ }
118
+ if (reproject.length === 0)
119
+ return result;
120
+ const reprojectPromise = this._iModel.wgs84CartographicFromSpatial(reproject);
121
+ return reprojectPromise.then((reprojected) => {
122
+ if (reprojected.length === reprojectIdx.length) { // reprojected array size must match our index array, otherwise something is OFF
123
+ for (let i = 0; i < reprojected.length; i++) {
124
+ result[reprojectIdx[i]] = reprojected[i]; // Insert the reprojected values at their original index
125
+ }
126
+ }
127
+ return result;
128
+ });
129
+ }
101
130
  dbToCartographic(db, result) {
102
131
  if (undefined === result)
103
132
  result = core_common_1.Cartographic.createZero();
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundMapGeometry.js","sourceRoot":"","sources":["../../src/BackgroundMapGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,wDAA8R;AAC9R,oDAAyH;AAGzH,8CAA0D;AAE1D,MAAM,YAAY,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC1C,MAAM,gBAAgB,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC9C,MAAM,YAAY,GAAG,uBAAO,CAAC,MAAM,EAAE,CAAC;AACtC,MAAM,aAAa,GAAG,wBAAQ,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,kBAAkB,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAChD,MAAM,mBAAmB,GAAG,qBAAK,CAAC,MAAM,CAAC,uBAAO,CAAC,MAAM,EAAE,EAAE,wBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9E,MAAM,eAAe,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC7C,MAAM,mBAAmB,GAAG,wBAAQ,CAAC,cAAc,EAAE,CAAC;AACtD,MAAM,uBAAuB,GAAG,wBAAQ,CAAC,MAAM,EAAE,CAAC;AAClD,MAAM,qBAAqB,GAAG,IAAI,gCAAgB,EAAE,CAAC;AACrD,MAAM,gBAAgB,GAAG,IAAI,gCAAgB,EAAE,CAAC;A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SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAG,CAAC;IAEtH,MAAM,OAAO,GAAG,wBAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,wBAAQ,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,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAY,sBAAsB;QAChD,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,MAAM,GAAG,wBAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,IAAI,MAAM,KAAK,SAAS;QACtB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,yBAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAG,CAAC;AACpF,CAAC;AAtCD,oFAsCC","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, LinePixels } 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[]): Promise<Cartographic[]> {\r\n const scratch = new Point3d();\r\n const promises = db.map(async (p) => {\r\n return this.cartesianRange.containsPoint(Point3d.createFrom(p, scratch)) ? this._iModel.spatialToCartographic(p) : this.dbToCartographic(p);\r\n });\r\n\r\n return Promise.all(promises);\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[]): Promise<Point3d[]> {\r\n let db;\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n db = cartographic.map((p) => {\r\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\r\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\r\n });\r\n } else {\r\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef())!);\r\n }\r\n\r\n if (this._iModel.noGcsDefined)\r\n return db;\r\n\r\n const promises = db.map(async (p, i) => {\r\n return this.cartesianRange.containsPoint(p) ? this._iModel.cartographicToSpatialFromGcs(cartographic[i]) : p;\r\n });\r\n\r\n return Promise.all(promises);\r\n }\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\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)\r\n 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, LinePixels.Code2);\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":"BackgroundMap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EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,OAAO,EAAE;QACzB,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAY,sBAAsB;QAChD,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,MAAM,GAAG,wBAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,IAAI,MAAM,KAAK,SAAS;QACtB,OAAO,SAAS,CAAC;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAe,sBAAsB;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,yBAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,OAAO,EAAG,CAAC;AACpF,CAAC;AAtCD,oFAsCC","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, LinePixels } 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[]): Promise<Cartographic[]> {\r\n const scratch = new Point3d();\r\n const promises = db.map(async (p) => {\r\n return this.cartesianRange.containsPoint(Point3d.createFrom(p, scratch)) ? this._iModel.spatialToCartographic(p) : this.dbToCartographic(p);\r\n });\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n public async dbToWGS84CartographicFromGcs(db: XYAndZ[]): Promise<Cartographic[]> {\r\n if (db.length === 0)\r\n return [];\r\n\r\n const result: Cartographic[] = Array(db.length);\r\n const reproject: XYAndZ[] = [];\r\n const reprojectIdx: number[] = [];\r\n const scratch = new Point3d();\r\n for (let i = 0; i < db.length; i++) {\r\n Point3d.createFrom(db[i], scratch);\r\n if (this.cartesianRange.containsPoint(scratch) ) {\r\n reprojectIdx.push(i);\r\n reproject.push(db[i]);\r\n } else {\r\n result[i] = this.dbToCartographic(db[i]);\r\n }\r\n }\r\n\r\n if (reproject.length === 0)\r\n return result;\r\n\r\n const reprojectPromise = this._iModel.wgs84CartographicFromSpatial(reproject);\r\n return reprojectPromise.then((reprojected) => {\r\n if (reprojected.length === reprojectIdx.length) { // reprojected array size must match our index array, otherwise something is OFF\r\n for (let i = 0; i < reprojected.length; i++) {\r\n result[reprojectIdx[i]] = reprojected[i]; // Insert the reprojected values at their original index\r\n }\r\n }\r\n return result;\r\n });\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[]): Promise<Point3d[]> {\r\n let db;\r\n if (this.globeMode === GlobeMode.Plane) {\r\n const fraction = Point2d.create(0, 0);\r\n db = cartographic.map((p) => {\r\n this._mercatorTilingScheme.cartographicToFraction(p.latitude, p.longitude, fraction);\r\n return this._mercatorFractionToDb.multiplyXYZ(fraction.x, fraction.y, p.height);\r\n });\r\n } else {\r\n db = cartographic.map((p) => this._ecefToDb.multiplyPoint3d(p.toEcef())!);\r\n }\r\n\r\n if (this._iModel.noGcsDefined)\r\n return db;\r\n\r\n const promises = db.map(async (p, i) => {\r\n return this.cartesianRange.containsPoint(p) ? this._iModel.cartographicToSpatialFromGcs(cartographic[i]) : p;\r\n });\r\n\r\n return Promise.all(promises);\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\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)\r\n 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, LinePixels.Code2);\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 +1 @@
1
- {"version":3,"file":"HitDetail.d.ts","sourceRoot":"","sources":["../../src/HitDetail.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAS,cAAc,EAAqC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxI,OAAO,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAe,MAAM,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtD;;;GAGG;AACH,oBAAY,QAAQ;IAClB,OAAO,IAAI;IACX,eAAe,IAAS;IACxB,QAAQ,IAAS;IACjB,MAAM,IAAS;IACf,MAAM,KAAS;IACf,QAAQ,KAAS;IACjB,YAAY,KAAS;CACtB;AAED;;;GAGG;AACH,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,UAAU,IAAI;IACd,OAAO,IAAI;CACZ;AAED;;;GAGG;AACH,oBAAY,SAAS;IACnB,IAAI,IAAI;IACR,QAAQ,IAAI;IACZ,YAAY,IAAI;IAChB,QAAQ,IAAI;IACZ,aAAa,IAAI;IACjB,SAAS,IA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I,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAO5C,uFAAuF;IAChF,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI;IAMzC,SAAS,IAAI,IAAI;IAOjB,UAAU,IAAI,CAAC,GAAG,SAAS;IAK3B,aAAa,IAAI,CAAC,GAAG,SAAS;IAE9B,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI;IAQlC,4CAA4C;IACrC,gBAAgB;IAEvB,gCAAgC;IACzB,SAAS,CAAC,MAAM,EAAE,MAAM;IAa/B,mFAAmF;IAC5E,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAchD,OAAO,CAAC,oBAAoB;IAgB5B,gDAAgD;IACzC,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAkCpF,2FAA2F;IACpF,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM;IAiBhC,4DAA4D;IACrD,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI;CAM1C"}
@@ -210,7 +210,7 @@ class HitDetail {
210
210
  return this.modelId === this.sourceId;
211
211
  }
212
212
  // return whether the hit point is from map.
213
- get isMapHit() { return undefined !== this.viewport.mapLayerFromHit(this); }
213
+ get isMapHit() { return 0 !== this.viewport.mapLayerFromHit(this).length; }
214
214
  /** Create a deep copy of this HitDetail */
215
215
  clone() {
216
216
  return new HitDetail(this);
@@ -1 +1 @@
1
- {"version":3,"file":"HitDetail.js","sourceRoot":"","sources":["../../src/HitDetail.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA+D;AAC/D,wDAAwI;AACxI,oDAA+D;AAC/D,2CAAwC;AAExC,4DAAsD;AACtD,uCAAgD;AAI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,OAAO,CAAC,CAAC;QAEX,OAAO,CAAC,CAAC;IACX,CAAC;IAED,2FAA2F;IACpF,MAAM,CAAC,MAAS;QACrB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,OAAO,CAAC,CAAC;SACV;QACD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,OAAO,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAChD,IAAI,UAAU,GAAG,CAAC;gBAChB,MAAM;SACT;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4DAA4D;IACrD,SAAS,CAAC,CAAS,EAAE,GAAM;QAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YAEpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AA9JD,0BA8JC","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 LocatingElements\r\n */\r\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Arc3d, CurvePrimitive, LineSegment3d, LineString3d, Path, Point3d, Transform, Vector3d, XYZProps } from \"@itwin/core-geometry\";\r\nimport { GeometryClass, LinePixels } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicType } from \"./render/GraphicBuilder\";\r\nimport { IconSprites, Sprite } from \"./Sprites\";\r\nimport { DecorateContext } from \"./ViewContext\";\r\nimport { ScreenViewport, Viewport } from \"./Viewport\";\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SnapMode {\r\n Nearest = 1,\r\n NearestKeypoint = 1 << 1,\r\n MidPoint = 1 << 2,\r\n Center = 1 << 3,\r\n Origin = 1 << 4,\r\n Bisector = 1 << 5,\r\n Intersection = 1 << 6,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SnapHeat {\r\n None = 0,\r\n NotInRange = 1, // \"of interest\", but out of range\r\n InRange = 2,\r\n}\r\n\r\n/** The procedure that generated this Hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitSource {\r\n None = 0,\r\n FromUser = 1,\r\n MotionLocate = 2,\r\n AccuSnap = 3,\r\n TentativeSnap = 4,\r\n DataPoint = 5,\r\n Application = 6,\r\n EditAction = 7,\r\n EditActionSS = 8,\r\n}\r\n\r\n/** What was being tested to generate this hit. This is not the element or\r\n * GeometricPrimitive that generated the Hit, it is an indication of whether it is an edge or interior hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitGeomType {\r\n None = 0,\r\n Point = 1,\r\n Segment = 2,\r\n Curve = 3,\r\n Arc = 4,\r\n Surface = 5,\r\n}\r\n\r\n/** Classification of GeometricPrimitive that generated the Hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitParentGeomType {\r\n None = 0,\r\n Wire = 1,\r\n Sheet = 2,\r\n Solid = 3,\r\n Mesh = 4,\r\n Text = 5,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitPriority {\r\n WireEdge = 0,\r\n PlanarEdge = 1,\r\n NonPlanarEdge = 2,\r\n SilhouetteEdge = 3,\r\n PlanarSurface = 4,\r\n NonPlanarSurface = 5,\r\n Unknown = 6,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitDetailType {\r\n Hit = 1,\r\n Snap = 2,\r\n Intersection = 3,\r\n}\r\n\r\n/** Describes the [ViewAttachment]($backend), if any, from which the hit represented by a [[HitDetail]] originated.\r\n * @note Only [[SheetViewState]]s contain view attachments.\r\n * @beta\r\n */\r\nexport interface ViewAttachmentHitInfo {\r\n /** The element Id of the [ViewAttachment]($backend) from which the hit originated. */\r\n readonly id: Id64String;\r\n /** The viewport that renders the contents of the attached view into the [[ScreenViewport]].\r\n * @alpha\r\n */\r\n readonly viewport: Viewport;\r\n}\r\n\r\n/** Arguments supplied to the [[HitDetail]] constructor.\r\n * @public\r\n */\r\nexport interface HitDetailProps {\r\n /** The point in world coordinates that was used as the initial locate point. */\r\n readonly testPoint: Point3d;\r\n /** The viewport in which the locate operation was performed. */\r\n readonly viewport: ScreenViewport;\r\n /** The procedure that requested the locate operation. */\r\n readonly hitSource: HitSource;\r\n /** The approximate location in world coordinates on the geometry identified by this HitDetail. */\r\n readonly hitPoint: Point3d;\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n readonly sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n readonly priority: HitPriority;\r\n /** The xy distance to the hit in view coordinates. */\r\n readonly distXY: number;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n readonly distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n readonly subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n readonly geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n readonly modelId?: string;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n readonly sourceIModel?: IModelConnection;\r\n /** @internal chiefly for debugging */\r\n readonly tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n readonly isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n readonly viewAttachment?: ViewAttachmentHitInfo;\r\n}\r\n\r\n/** A HitDetail stores the result when locating geometry displayed in a view.\r\n * It holds an approximate location on an element (or decoration) from a *pick*.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HitDetail {\r\n private readonly _props: HitDetailProps;\r\n\r\n /** The point in world coordinates that was used as the initial locate point. */\r\n public get testPoint(): Point3d { return this._props.testPoint; }\r\n /** The viewport in which the locate operation was performed. */\r\n public get viewport(): ScreenViewport { return this._props.viewport; }\r\n /** The procedure that requested the locate operation. */\r\n public get hitSource(): HitSource { return this._props.hitSource; }\r\n /** The approximate location in world coordinates on the geometry identified by this HitDetail. */\r\n public get hitPoint(): Point3d { return this._props.hitPoint; }\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n public get sourceId(): Id64String { return this._props.sourceId; }\r\n /** The hit geometry priority/classification. */\r\n public get priority(): HitPriority { return this._props.priority; }\r\n /** The xy distance to the hit in view coordinates. */\r\n public get distXY(): number { return this._props.distXY; }\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n public get distFraction(): number { return this._props.distFraction; }\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n public get subCategoryId(): Id64String | undefined { return this._props.subCategoryId; }\r\n /** The class of the hit geometry. */\r\n public get geometryClass(): GeometryClass | undefined { return this._props.geometryClass; }\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n public get modelId(): string | undefined { return this._props.modelId; }\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n public get sourceIModel(): IModelConnection | undefined { return this._props.sourceIModel; }\r\n /** @internal chiefly for debugging */\r\n public get tileId(): string | undefined { return this._props.tileId; }\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n public get isClassifier(): boolean | undefined { return this._props.isClassifier; }\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n public get viewAttachment(): ViewAttachmentHitInfo | undefined { return this._props.viewAttachment; }\r\n\r\n /** Create a new HitDetail from the inputs to and results of a locate operation. */\r\n public constructor(props: HitDetailProps);\r\n\r\n /** @deprecated in 4.1. Use the overload that takes a [[HitDetailProps]]. */\r\n public constructor(testPoint: Point3d, viewport: ScreenViewport, hitSource: HitSource, hitPoint: Point3d, sourceId: string, priority: HitPriority, distXY: number, distFraction: number, subCategoryId?: string, geometryClass?: GeometryClass, modelId?: string, sourceIModel?: IModelConnection, tileId?: string, isClassifier?: boolean);\r\n\r\n /** @internal */\r\n public constructor(arg0: Point3d | HitDetailProps, viewport?: ScreenViewport, hitSource?: HitSource, hitPoint?: Point3d, sourceId?: string, priority?: HitPriority, distXY?: number, distFraction?: number, subCategoryId?: string, geometryClass?: GeometryClass, modelId?: string, sourceIModel?: IModelConnection, tileId?: string, isClassifier?: boolean) {\r\n if (arg0 instanceof Point3d) {\r\n assert(undefined !== viewport && undefined !== hitSource && undefined !== hitPoint && undefined !== sourceId);\r\n assert(undefined !== priority && undefined !== distXY && undefined !== distFraction);\r\n\r\n this._props = {\r\n testPoint: arg0,\r\n viewport,\r\n hitSource,\r\n hitPoint,\r\n sourceId,\r\n priority,\r\n distXY,\r\n distFraction,\r\n subCategoryId,\r\n geometryClass,\r\n modelId,\r\n sourceIModel,\r\n tileId,\r\n isClassifier,\r\n };\r\n } else {\r\n // Tempting to use { ...arg0 } but spread operator omits getters so, e.g., if input is a HitDetail we would lose all the properties.\r\n this._props = {\r\n testPoint: arg0.testPoint,\r\n viewport: arg0.viewport,\r\n hitSource: arg0.hitSource,\r\n hitPoint: arg0.hitPoint,\r\n sourceId: arg0.sourceId,\r\n priority: arg0.priority,\r\n distXY: arg0.distXY,\r\n distFraction: arg0.distFraction,\r\n subCategoryId: arg0.subCategoryId,\r\n geometryClass: arg0.geometryClass,\r\n modelId: arg0.modelId,\r\n sourceIModel: arg0.sourceIModel,\r\n tileId: arg0.tileId,\r\n isClassifier: arg0.isClassifier,\r\n viewAttachment: arg0.viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Get the type of HitDetail.\r\n * @returns HitDetailType.Hit if this is a HitDetail, HitDetailType.Snap if it is a SnapDetail\r\n */\r\n public getHitType(): HitDetailType { return HitDetailType.Hit; }\r\n\r\n /** Get the *hit point* for this HitDetail. Returns the approximate point on the element that caused the hit when not a SnapDetail or IntersectDetail.\r\n * For a snap that is *hot*, the *exact* point on the Element for the snap mode is returned, otherwise the close point on the hit geometry is returned.\r\n */\r\n public getPoint(): Point3d { return this.hitPoint; }\r\n\r\n /** Determine if this HitPoint is from the same source as another HitDetail. */\r\n public isSameHit(otherHit?: HitDetail): boolean { return (undefined !== otherHit && this.sourceId === otherHit.sourceId && this.iModel === otherHit.iModel); }\r\n /** Return whether sourceId is for a persistent element and not a pickable decoration. */\r\n public get isElementHit(): boolean { return !Id64.isInvalid(this.sourceId) && !Id64.isTransient(this.sourceId); }\r\n // return whether the sourceId is for a model (reality models etc.)\r\n public get isModelHit(): boolean {\r\n return this.modelId === this.sourceId;\r\n }\r\n // return whether the hit point is from map.\r\n public get isMapHit(): boolean { return undefined !== this.viewport.mapLayerFromHit(this); }\r\n\r\n /** Create a deep copy of this HitDetail */\r\n public clone(): HitDetail {\r\n return new HitDetail(this);\r\n }\r\n\r\n /** Draw this HitDetail as a Decoration. Causes the picked element to *flash* */\r\n public draw(_context: DecorateContext) {\r\n this.viewport.flashedId = this.sourceId;\r\n }\r\n\r\n /** Get the tooltip content for this HitDetail. */\r\n public async getToolTip(): Promise<HTMLElement | string> {\r\n let toolTipPromise = this.isElementHit ? IModelApp.viewManager.overrideElementToolTip(this) : IModelApp.viewManager.getDecorationToolTip(this);\r\n for (const toolTipProvider of IModelApp.viewManager.toolTipProviders)\r\n toolTipPromise = toolTipProvider.augmentToolTip(this, toolTipPromise);\r\n return toolTipPromise;\r\n }\r\n\r\n /** The IModelConnection from which the hit originated. In some cases this may not be the same as the iModel associated with the Viewport -\r\n * for example, if a [[TiledGraphicsProvider]] is used to display graphics from a different iModel in the viewport.\r\n * This HitDetail's element, subcategory, and model Ids are defined in the context of this IModelConnection.\r\n */\r\n public get iModel(): IModelConnection {\r\n return this.sourceIModel ?? this.viewport.iModel;\r\n }\r\n\r\n /** Returns true if this hit originated from an [[IModelConnection]] other than the one associated with the [[Viewport]].\r\n * @see [[iModel]].\r\n */\r\n public get isExternalIModelHit(): boolean {\r\n return this.iModel !== this.viewport.iModel;\r\n }\r\n}\r\n\r\n/** A SnapDetail is generated from the result of a snap request. In addition to the HitDetail about the reason the element was *picked*,\r\n * it holds the *exact* point on the element from the snapping logic, plus additional information that varies with the type of element and snap mode.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SnapDetail extends HitDetail {\r\n /** A sprite to show the user the type of snap performed */\r\n public sprite?: Sprite;\r\n /** HitPoint adjusted by snap */\r\n public readonly snapPoint: Point3d;\r\n /** AccuSnap/AccuDraw can adjust the point after the snap. */\r\n public readonly adjustedPoint: Point3d;\r\n /** Curve primitive for snap. */\r\n public primitive?: CurvePrimitive;\r\n /** Surface normal at snapPoint */\r\n public normal?: Vector3d;\r\n /** The HitGeomType of this SnapDetail */\r\n public geomType?: HitGeomType;\r\n /** The HitGeomType of this SnapDetail */\r\n public parentGeomType?: HitParentGeomType;\r\n\r\n /** Constructor for SnapDetail.\r\n * @param from The HitDetail that created this snap\r\n * @param snapMode The SnapMode used to create this SnapDetail\r\n * @param heat The SnapHeat of this SnapDetail\r\n * @param snapPoint The snapped point in the element\r\n */\r\n public constructor(from: HitDetail, public snapMode: SnapMode = SnapMode.Nearest, public heat: SnapHeat = SnapHeat.None, snapPoint?: XYZProps) {\r\n super(from);\r\n this.snapPoint = Point3d.fromJSON(snapPoint ? snapPoint : from.hitPoint);\r\n this.adjustedPoint = this.snapPoint.clone();\r\n this.sprite = IconSprites.getSpriteFromUrl(SnapDetail.getSnapSpriteUrl(snapMode));\r\n }\r\n\r\n /** Returns `HitDetailType.Snap` */\r\n public override getHitType(): HitDetailType { return HitDetailType.Snap; }\r\n /** Get the snap point if this SnapDetail is *hot*, the pick point otherwise. */\r\n public override getPoint(): Point3d { return this.isHot ? this.snapPoint : super.getPoint(); }\r\n /** Return true if the pick point was closer than the snap aperture from the generated snap point. */\r\n public get isHot(): boolean { return this.heat !== SnapHeat.None; }\r\n /** Determine whether the [[adjustedPoint]] is different than the [[snapPoint]]. This happens, for example, when points are adjusted for grids, acs plane snap, and AccuDraw. */\r\n public get isPointAdjusted(): boolean { return !this.adjustedPoint.isExactEqual(this.snapPoint); }\r\n /** Change the snap point. */\r\n public setSnapPoint(point: Point3d, heat: SnapHeat) {\r\n this.snapPoint.setFrom(point);\r\n this.adjustedPoint.setFrom(point);\r\n this.heat = heat;\r\n }\r\n\r\n /** Set curve primitive and HitGeometryType for this SnapDetail. */\r\n public setCurvePrimitive(primitive?: CurvePrimitive, localToWorld?: Transform, geomType?: HitGeomType): void {\r\n this.primitive = primitive;\r\n this.geomType = undefined;\r\n\r\n // Only HitGeomType.Point and HitGeomType.Surface are valid without a curve primitive.\r\n if (undefined === this.primitive) {\r\n if (HitGeomType.Point === geomType || HitGeomType.Surface === geomType)\r\n this.geomType = geomType;\r\n return;\r\n }\r\n\r\n if (undefined !== localToWorld)\r\n this.primitive.tryTransformInPlace(localToWorld);\r\n\r\n if (this.primitive instanceof Arc3d)\r\n this.geomType = HitGeomType.Arc;\r\n else if (this.primitive instanceof LineSegment3d)\r\n this.geomType = HitGeomType.Segment;\r\n else if (this.primitive instanceof LineString3d)\r\n this.geomType = HitGeomType.Segment;\r\n else\r\n this.geomType = HitGeomType.Curve;\r\n\r\n // Set curve primitive geometry type override...\r\n // - HitGeomType.Point with arc/ellipse denotes center.\r\n // - HitGeomType.Surface with any curve primitive denotes an interior hit.\r\n if (undefined !== geomType && HitGeomType.None !== geomType)\r\n this.geomType = geomType;\r\n }\r\n\r\n /** Make a copy of this SnapDetail. */\r\n public override clone(): SnapDetail {\r\n const val = new SnapDetail(this, this.snapMode, this.heat, this.snapPoint);\r\n val.sprite = this.sprite;\r\n val.geomType = this.geomType;\r\n val.parentGeomType = this.parentGeomType;\r\n val.adjustedPoint.setFrom(this.adjustedPoint);\r\n if (undefined !== this.primitive)\r\n val.primitive = this.primitive.clone();\r\n if (undefined !== this.normal)\r\n val.normal = this.normal.clone();\r\n return val;\r\n }\r\n\r\n public getCurvePrimitive(singleSegment: boolean = true): CurvePrimitive | undefined {\r\n if (!singleSegment || undefined === this.primitive)\r\n return this.primitive;\r\n\r\n if (this.primitive instanceof LineString3d) {\r\n const ls = this.primitive;\r\n if (ls.points.length > 2) {\r\n const loc = ls.closestPoint(this.snapPoint, false);\r\n const nSegments = ls.points.length - 1;\r\n const uSegRange = (1.0 / nSegments);\r\n let segmentNo = Math.floor(loc.fraction / uSegRange);\r\n if (segmentNo >= nSegments)\r\n segmentNo = nSegments - 1;\r\n return LineSegment3d.create(ls.points[segmentNo], ls.points[segmentNo + 1]);\r\n }\r\n }\r\n\r\n return this.primitive;\r\n }\r\n\r\n public override draw(context: DecorateContext) {\r\n if (undefined !== this.primitive) {\r\n let singleSegment = false;\r\n switch (this.snapMode) {\r\n case SnapMode.Center:\r\n case SnapMode.Origin:\r\n case SnapMode.Bisector:\r\n break; // Snap point for these is computed using entire linestring, not just the hit segment...\r\n\r\n default: {\r\n singleSegment = true;\r\n break;\r\n }\r\n }\r\n\r\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const outline = context.viewport.hilite.color.adjustedForContrast(context.viewport.view.backgroundColor, 50);\r\n const centerLine = context.viewport.hilite.color.adjustedForContrast(outline, 175);\r\n const path = Path.create(this.getCurvePrimitive(singleSegment)!);\r\n\r\n builder.setSymbology(outline, outline, 6);\r\n builder.addPath(path);\r\n\r\n builder.setSymbology(centerLine, centerLine, 2);\r\n builder.addPath(path);\r\n\r\n context.addDecorationFromBuilder(builder);\r\n return;\r\n }\r\n super.draw(context);\r\n }\r\n\r\n private static getSnapSpriteUrl(snapType: SnapMode): string {\r\n switch (snapType) {\r\n case SnapMode.Nearest: return `${IModelApp.publicPath}sprites/SnapPointOn.png`;\r\n case SnapMode.NearestKeypoint: return `${IModelApp.publicPath}sprites/SnapKeypoint.png`;\r\n case SnapMode.MidPoint: return `${IModelApp.publicPath}sprites/SnapMidpoint.png`;\r\n case SnapMode.Center: return `${IModelApp.publicPath}sprites/SnapCenter.png`;\r\n case SnapMode.Origin: return `${IModelApp.publicPath}sprites/SnapOrigin.png`;\r\n case SnapMode.Bisector: return `${IModelApp.publicPath}sprites/SnapBisector.png`;\r\n case SnapMode.Intersection: return `${IModelApp.publicPath}sprites/SnapIntersection.png`;\r\n }\r\n return \"\";\r\n }\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport class IntersectDetail extends SnapDetail {\r\n public constructor(from: SnapDetail, heat: SnapHeat = SnapHeat.None, snapPoint: XYZProps, public readonly otherPrimitive: CurvePrimitive, public readonly otherId: string) {\r\n super(from, SnapMode.Intersection, heat, snapPoint);\r\n this.primitive = from.primitive;\r\n this.normal = from.normal; // Preserve normal from primary snap location for AccuDraw smart rotation...\r\n }\r\n\r\n public override draw(context: DecorateContext) {\r\n if (undefined !== this.primitive && undefined !== this.otherPrimitive) {\r\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const outline = context.viewport.hilite.color.adjustedForContrast(context.viewport.view.backgroundColor, 50);\r\n const centerLine = context.viewport.hilite.color.adjustedForContrast(outline, 175);\r\n const path1 = Path.create(this.primitive);\r\n const path2 = Path.create(this.otherPrimitive);\r\n\r\n builder.setSymbology(outline, outline, 6);\r\n builder.addPath(path1);\r\n builder.addPath(path2);\r\n\r\n builder.setSymbology(centerLine, centerLine, 2);\r\n builder.addPath(path1);\r\n builder.setSymbology(centerLine, centerLine, 2, LinePixels.Code2);\r\n builder.addPath(path2);\r\n\r\n context.addDecorationFromBuilder(builder);\r\n return;\r\n }\r\n super.draw(context);\r\n }\r\n}\r\n\r\n/** The result of a \"locate\" is a sorted list of objects that satisfied the search criteria (a HitList). Earlier hits in the list\r\n * are somehow *better* than those later on.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HitList<T extends HitDetail> {\r\n public hits: T[] = [];\r\n public currHit = -1;\r\n public get length(): number { return this.hits.length; }\r\n public empty(): void {\r\n this.hits.length = 0;\r\n this.currHit = -1;\r\n }\r\n\r\n public resetCurrentHit(): void { this.currHit = -1; }\r\n\r\n /** Get a hit from a particular index into a HitList\r\n * return the requested hit from the HitList or undefined\r\n */\r\n public getHit(hitNum: number): T | undefined {\r\n if (hitNum < 0)\r\n hitNum = this.length - 1;\r\n\r\n return (hitNum >= this.length) ? undefined : this.hits[hitNum];\r\n }\r\n\r\n /** When setting one or more indices to undefined you must call dropNulls afterwards */\r\n public setHit(i: number, p: T | undefined): void {\r\n if (i < 0 || i >= this.length)\r\n return;\r\n this.hits[i] = p!;\r\n }\r\n\r\n public dropNulls(): void {\r\n const hits = this.hits;\r\n this.hits = [];\r\n for (const hit of hits)\r\n this.hits.push(hit);\r\n }\r\n\r\n public getNextHit(): T | undefined {\r\n this.currHit++;\r\n return this.getCurrentHit();\r\n }\r\n\r\n public getCurrentHit(): T | undefined { return -1 === this.currHit ? undefined : this.getHit(this.currHit); }\r\n\r\n public setCurrentHit(hit: T): void {\r\n this.resetCurrentHit();\r\n for (let thisHit; undefined !== (thisHit = this.getNextHit());) {\r\n if (thisHit === hit)\r\n return;\r\n }\r\n }\r\n\r\n /** remove the current hit from the list. */\r\n public removeCurrentHit() { this.removeHit(this.currHit); }\r\n\r\n /** remove a hit in the list. */\r\n public removeHit(hitNum: number) {\r\n if (hitNum < 0) // Support -1 == END\r\n hitNum = this.length - 1;\r\n\r\n if (hitNum <= this.currHit)\r\n this.currHit = -1;\r\n\r\n if (hitNum >= this.length) // Locate calls GetNextHit, which increments currHit, until it goes beyond the end of size of the array.\r\n return; // Then Reset call RemoteCurrentHit, which passes in currHit. When it is out of range, we do nothing.\r\n\r\n this.hits.splice(hitNum, 1);\r\n }\r\n\r\n /** search through list and remove any hits that contain a specified element id. */\r\n public removeHitsFrom(sourceId: string): boolean {\r\n let removedOne = false;\r\n\r\n // walk backwards through list so we don't have to worry about what happens on remove\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const thisHit = this.hits[i];\r\n if (thisHit && sourceId === thisHit.sourceId) {\r\n removedOne = true;\r\n this.removeHit(i);\r\n }\r\n }\r\n return removedOne;\r\n }\r\n\r\n private getPriorityZOverride(priority: HitPriority): number {\r\n switch (priority) {\r\n case HitPriority.WireEdge:\r\n case HitPriority.PlanarEdge:\r\n case HitPriority.NonPlanarEdge:\r\n return 0;\r\n case HitPriority.SilhouetteEdge:\r\n return 1;\r\n case HitPriority.PlanarSurface:\r\n case HitPriority.NonPlanarSurface:\r\n return 2;\r\n default:\r\n return 3;\r\n }\r\n }\r\n\r\n /** compare two hits for insertion into list. */\r\n public compare(hit1: HitDetail | undefined, hit2: HitDetail | undefined): -1 | 1 | 0 {\r\n if (!hit1 || !hit2)\r\n return 0;\r\n\r\n const zOverride1 = this.getPriorityZOverride(hit1.priority);\r\n const zOverride2 = this.getPriorityZOverride(hit2.priority);\r\n\r\n // Prefer edges over surfaces, this is more important than z because we know the edge isn't obscured...\r\n if (zOverride1 < zOverride2)\r\n return -1;\r\n if (zOverride1 > zOverride2)\r\n return 1;\r\n\r\n // Compare xy distance from pick point, prefer hits closer to center...\r\n if (hit1.distXY < hit2.distXY)\r\n return -1;\r\n if (hit1.distXY > hit2.distXY)\r\n return 1;\r\n\r\n // Compare distance fraction, prefer hits closer to eye...\r\n if (hit1.distFraction > hit2.distFraction)\r\n return -1;\r\n if (hit1.distFraction < hit2.distFraction)\r\n return 1;\r\n\r\n // Compare geometry class, prefer path/region hits over surface hits when all else is equal...\r\n if (hit1.priority < hit2.priority)\r\n return -1;\r\n if (hit1.priority > hit2.priority)\r\n return 1;\r\n\r\n return 0;\r\n }\r\n\r\n /** Add a new hit to the list. Hits are sorted according to their priority and distance. */\r\n public addHit(newHit: T): number {\r\n if (0 === this.hits.length) {\r\n this.hits.push(newHit);\r\n return 0;\r\n }\r\n let index = 0;\r\n for (; index < this.hits.length; ++index) {\r\n const oldHit = this.hits[index];\r\n const comparison = this.compare(newHit, oldHit);\r\n if (comparison < 0)\r\n break;\r\n }\r\n\r\n this.hits.splice(index, 0, newHit);\r\n return index;\r\n }\r\n\r\n /** Insert a new hit into the list at the supplied index. */\r\n public insertHit(i: number, hit: T): void {\r\n if (i < 0 || i >= this.length)\r\n this.hits.push(hit);\r\n else\r\n this.hits.splice(i, 0, hit);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"HitDetail.js","sourceRoot":"","sources":["../../src/HitDetail.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA+D;AAC/D,wDAAwI;AACxI,oDAA+D;AAC/D,2CAAwC;AAExC,4DAAsD;AACtD,uCAAgD;AAIhD;;;GAGG;AACH,IAAY,QAQX;AARD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,6DAAwB,CAAA;IACxB,+CAAiB,CAAA;IACjB,2CAAe,CAAA;IACf,4CAAe,CAAA;IACf,gDAAiB,CAAA;IACjB,wDAAqB,CAAA;AACvB,CAAC,EARW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAQnB;AAED;;;GAGG;AACH,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,uCAAQ,CAAA;IACR,mDAAc,CAAA;IACd,6CAAW,CAAA;AACb,CAAC,EAJW,QAAQ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MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAChD,IAAI,UAAU,GAAG,CAAC;gBAChB,MAAM;SACT;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4DAA4D;IACrD,SAAS,CAAC,CAAS,EAAE,GAAM;QAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YAEpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AA9JD,0BA8JC","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 LocatingElements\r\n */\r\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Arc3d, CurvePrimitive, LineSegment3d, LineString3d, Path, Point3d, Transform, Vector3d, XYZProps } from \"@itwin/core-geometry\";\r\nimport { GeometryClass, LinePixels } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicType } from \"./render/GraphicBuilder\";\r\nimport { IconSprites, Sprite } from \"./Sprites\";\r\nimport { DecorateContext } from \"./ViewContext\";\r\nimport { ScreenViewport, Viewport } from \"./Viewport\";\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SnapMode {\r\n Nearest = 1,\r\n NearestKeypoint = 1 << 1,\r\n MidPoint = 1 << 2,\r\n Center = 1 << 3,\r\n Origin = 1 << 4,\r\n Bisector = 1 << 5,\r\n Intersection = 1 << 6,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SnapHeat {\r\n None = 0,\r\n NotInRange = 1, // \"of interest\", but out of range\r\n InRange = 2,\r\n}\r\n\r\n/** The procedure that generated this Hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitSource {\r\n None = 0,\r\n FromUser = 1,\r\n MotionLocate = 2,\r\n AccuSnap = 3,\r\n TentativeSnap = 4,\r\n DataPoint = 5,\r\n Application = 6,\r\n EditAction = 7,\r\n EditActionSS = 8,\r\n}\r\n\r\n/** What was being tested to generate this hit. This is not the element or\r\n * GeometricPrimitive that generated the Hit, it is an indication of whether it is an edge or interior hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitGeomType {\r\n None = 0,\r\n Point = 1,\r\n Segment = 2,\r\n Curve = 3,\r\n Arc = 4,\r\n Surface = 5,\r\n}\r\n\r\n/** Classification of GeometricPrimitive that generated the Hit.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitParentGeomType {\r\n None = 0,\r\n Wire = 1,\r\n Sheet = 2,\r\n Solid = 3,\r\n Mesh = 4,\r\n Text = 5,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitPriority {\r\n WireEdge = 0,\r\n PlanarEdge = 1,\r\n NonPlanarEdge = 2,\r\n SilhouetteEdge = 3,\r\n PlanarSurface = 4,\r\n NonPlanarSurface = 5,\r\n Unknown = 6,\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport enum HitDetailType {\r\n Hit = 1,\r\n Snap = 2,\r\n Intersection = 3,\r\n}\r\n\r\n/** Describes the [ViewAttachment]($backend), if any, from which the hit represented by a [[HitDetail]] originated.\r\n * @note Only [[SheetViewState]]s contain view attachments.\r\n * @beta\r\n */\r\nexport interface ViewAttachmentHitInfo {\r\n /** The element Id of the [ViewAttachment]($backend) from which the hit originated. */\r\n readonly id: Id64String;\r\n /** The viewport that renders the contents of the attached view into the [[ScreenViewport]].\r\n * @alpha\r\n */\r\n readonly viewport: Viewport;\r\n}\r\n\r\n/** Arguments supplied to the [[HitDetail]] constructor.\r\n * @public\r\n */\r\nexport interface HitDetailProps {\r\n /** The point in world coordinates that was used as the initial locate point. */\r\n readonly testPoint: Point3d;\r\n /** The viewport in which the locate operation was performed. */\r\n readonly viewport: ScreenViewport;\r\n /** The procedure that requested the locate operation. */\r\n readonly hitSource: HitSource;\r\n /** The approximate location in world coordinates on the geometry identified by this HitDetail. */\r\n readonly hitPoint: Point3d;\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n readonly sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n readonly priority: HitPriority;\r\n /** The xy distance to the hit in view coordinates. */\r\n readonly distXY: number;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n readonly distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n readonly subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n readonly geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n readonly modelId?: string;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n readonly sourceIModel?: IModelConnection;\r\n /** @internal chiefly for debugging */\r\n readonly tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n readonly isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n readonly viewAttachment?: ViewAttachmentHitInfo;\r\n}\r\n\r\n/** A HitDetail stores the result when locating geometry displayed in a view.\r\n * It holds an approximate location on an element (or decoration) from a *pick*.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HitDetail {\r\n private readonly _props: HitDetailProps;\r\n\r\n /** The point in world coordinates that was used as the initial locate point. */\r\n public get testPoint(): Point3d { return this._props.testPoint; }\r\n /** The viewport in which the locate operation was performed. */\r\n public get viewport(): ScreenViewport { return this._props.viewport; }\r\n /** The procedure that requested the locate operation. */\r\n public get hitSource(): HitSource { return this._props.hitSource; }\r\n /** The approximate location in world coordinates on the geometry identified by this HitDetail. */\r\n public get hitPoint(): Point3d { return this._props.hitPoint; }\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n public get sourceId(): Id64String { return this._props.sourceId; }\r\n /** The hit geometry priority/classification. */\r\n public get priority(): HitPriority { return this._props.priority; }\r\n /** The xy distance to the hit in view coordinates. */\r\n public get distXY(): number { return this._props.distXY; }\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n public get distFraction(): number { return this._props.distFraction; }\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n public get subCategoryId(): Id64String | undefined { return this._props.subCategoryId; }\r\n /** The class of the hit geometry. */\r\n public get geometryClass(): GeometryClass | undefined { return this._props.geometryClass; }\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n public get modelId(): string | undefined { return this._props.modelId; }\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n public get sourceIModel(): IModelConnection | undefined { return this._props.sourceIModel; }\r\n /** @internal chiefly for debugging */\r\n public get tileId(): string | undefined { return this._props.tileId; }\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n public get isClassifier(): boolean | undefined { return this._props.isClassifier; }\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n public get viewAttachment(): ViewAttachmentHitInfo | undefined { return this._props.viewAttachment; }\r\n\r\n /** Create a new HitDetail from the inputs to and results of a locate operation. */\r\n public constructor(props: HitDetailProps);\r\n\r\n /** @deprecated in 4.1. Use the overload that takes a [[HitDetailProps]]. */\r\n public constructor(testPoint: Point3d, viewport: ScreenViewport, hitSource: HitSource, hitPoint: Point3d, sourceId: string, priority: HitPriority, distXY: number, distFraction: number, subCategoryId?: string, geometryClass?: GeometryClass, modelId?: string, sourceIModel?: IModelConnection, tileId?: string, isClassifier?: boolean);\r\n\r\n /** @internal */\r\n public constructor(arg0: Point3d | HitDetailProps, viewport?: ScreenViewport, hitSource?: HitSource, hitPoint?: Point3d, sourceId?: string, priority?: HitPriority, distXY?: number, distFraction?: number, subCategoryId?: string, geometryClass?: GeometryClass, modelId?: string, sourceIModel?: IModelConnection, tileId?: string, isClassifier?: boolean) {\r\n if (arg0 instanceof Point3d) {\r\n assert(undefined !== viewport && undefined !== hitSource && undefined !== hitPoint && undefined !== sourceId);\r\n assert(undefined !== priority && undefined !== distXY && undefined !== distFraction);\r\n\r\n this._props = {\r\n testPoint: arg0,\r\n viewport,\r\n hitSource,\r\n hitPoint,\r\n sourceId,\r\n priority,\r\n distXY,\r\n distFraction,\r\n subCategoryId,\r\n geometryClass,\r\n modelId,\r\n sourceIModel,\r\n tileId,\r\n isClassifier,\r\n };\r\n } else {\r\n // Tempting to use { ...arg0 } but spread operator omits getters so, e.g., if input is a HitDetail we would lose all the properties.\r\n this._props = {\r\n testPoint: arg0.testPoint,\r\n viewport: arg0.viewport,\r\n hitSource: arg0.hitSource,\r\n hitPoint: arg0.hitPoint,\r\n sourceId: arg0.sourceId,\r\n priority: arg0.priority,\r\n distXY: arg0.distXY,\r\n distFraction: arg0.distFraction,\r\n subCategoryId: arg0.subCategoryId,\r\n geometryClass: arg0.geometryClass,\r\n modelId: arg0.modelId,\r\n sourceIModel: arg0.sourceIModel,\r\n tileId: arg0.tileId,\r\n isClassifier: arg0.isClassifier,\r\n viewAttachment: arg0.viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Get the type of HitDetail.\r\n * @returns HitDetailType.Hit if this is a HitDetail, HitDetailType.Snap if it is a SnapDetail\r\n */\r\n public getHitType(): HitDetailType { return HitDetailType.Hit; }\r\n\r\n /** Get the *hit point* for this HitDetail. Returns the approximate point on the element that caused the hit when not a SnapDetail or IntersectDetail.\r\n * For a snap that is *hot*, the *exact* point on the Element for the snap mode is returned, otherwise the close point on the hit geometry is returned.\r\n */\r\n public getPoint(): Point3d { return this.hitPoint; }\r\n\r\n /** Determine if this HitPoint is from the same source as another HitDetail. */\r\n public isSameHit(otherHit?: HitDetail): boolean { return (undefined !== otherHit && this.sourceId === otherHit.sourceId && this.iModel === otherHit.iModel); }\r\n /** Return whether sourceId is for a persistent element and not a pickable decoration. */\r\n public get isElementHit(): boolean { return !Id64.isInvalid(this.sourceId) && !Id64.isTransient(this.sourceId); }\r\n // return whether the sourceId is for a model (reality models etc.)\r\n public get isModelHit(): boolean {\r\n return this.modelId === this.sourceId;\r\n }\r\n // return whether the hit point is from map.\r\n public get isMapHit(): boolean { return 0 !== this.viewport.mapLayerFromHit(this).length; }\r\n\r\n /** Create a deep copy of this HitDetail */\r\n public clone(): HitDetail {\r\n return new HitDetail(this);\r\n }\r\n\r\n /** Draw this HitDetail as a Decoration. Causes the picked element to *flash* */\r\n public draw(_context: DecorateContext) {\r\n this.viewport.flashedId = this.sourceId;\r\n }\r\n\r\n /** Get the tooltip content for this HitDetail. */\r\n public async getToolTip(): Promise<HTMLElement | string> {\r\n let toolTipPromise = this.isElementHit ? IModelApp.viewManager.overrideElementToolTip(this) : IModelApp.viewManager.getDecorationToolTip(this);\r\n for (const toolTipProvider of IModelApp.viewManager.toolTipProviders)\r\n toolTipPromise = toolTipProvider.augmentToolTip(this, toolTipPromise);\r\n return toolTipPromise;\r\n }\r\n\r\n /** The IModelConnection from which the hit originated. In some cases this may not be the same as the iModel associated with the Viewport -\r\n * for example, if a [[TiledGraphicsProvider]] is used to display graphics from a different iModel in the viewport.\r\n * This HitDetail's element, subcategory, and model Ids are defined in the context of this IModelConnection.\r\n */\r\n public get iModel(): IModelConnection {\r\n return this.sourceIModel ?? this.viewport.iModel;\r\n }\r\n\r\n /** Returns true if this hit originated from an [[IModelConnection]] other than the one associated with the [[Viewport]].\r\n * @see [[iModel]].\r\n */\r\n public get isExternalIModelHit(): boolean {\r\n return this.iModel !== this.viewport.iModel;\r\n }\r\n}\r\n\r\n/** A SnapDetail is generated from the result of a snap request. In addition to the HitDetail about the reason the element was *picked*,\r\n * it holds the *exact* point on the element from the snapping logic, plus additional information that varies with the type of element and snap mode.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SnapDetail extends HitDetail {\r\n /** A sprite to show the user the type of snap performed */\r\n public sprite?: Sprite;\r\n /** HitPoint adjusted by snap */\r\n public readonly snapPoint: Point3d;\r\n /** AccuSnap/AccuDraw can adjust the point after the snap. */\r\n public readonly adjustedPoint: Point3d;\r\n /** Curve primitive for snap. */\r\n public primitive?: CurvePrimitive;\r\n /** Surface normal at snapPoint */\r\n public normal?: Vector3d;\r\n /** The HitGeomType of this SnapDetail */\r\n public geomType?: HitGeomType;\r\n /** The HitGeomType of this SnapDetail */\r\n public parentGeomType?: HitParentGeomType;\r\n\r\n /** Constructor for SnapDetail.\r\n * @param from The HitDetail that created this snap\r\n * @param snapMode The SnapMode used to create this SnapDetail\r\n * @param heat The SnapHeat of this SnapDetail\r\n * @param snapPoint The snapped point in the element\r\n */\r\n public constructor(from: HitDetail, public snapMode: SnapMode = SnapMode.Nearest, public heat: SnapHeat = SnapHeat.None, snapPoint?: XYZProps) {\r\n super(from);\r\n this.snapPoint = Point3d.fromJSON(snapPoint ? snapPoint : from.hitPoint);\r\n this.adjustedPoint = this.snapPoint.clone();\r\n this.sprite = IconSprites.getSpriteFromUrl(SnapDetail.getSnapSpriteUrl(snapMode));\r\n }\r\n\r\n /** Returns `HitDetailType.Snap` */\r\n public override getHitType(): HitDetailType { return HitDetailType.Snap; }\r\n /** Get the snap point if this SnapDetail is *hot*, the pick point otherwise. */\r\n public override getPoint(): Point3d { return this.isHot ? this.snapPoint : super.getPoint(); }\r\n /** Return true if the pick point was closer than the snap aperture from the generated snap point. */\r\n public get isHot(): boolean { return this.heat !== SnapHeat.None; }\r\n /** Determine whether the [[adjustedPoint]] is different than the [[snapPoint]]. This happens, for example, when points are adjusted for grids, acs plane snap, and AccuDraw. */\r\n public get isPointAdjusted(): boolean { return !this.adjustedPoint.isExactEqual(this.snapPoint); }\r\n /** Change the snap point. */\r\n public setSnapPoint(point: Point3d, heat: SnapHeat) {\r\n this.snapPoint.setFrom(point);\r\n this.adjustedPoint.setFrom(point);\r\n this.heat = heat;\r\n }\r\n\r\n /** Set curve primitive and HitGeometryType for this SnapDetail. */\r\n public setCurvePrimitive(primitive?: CurvePrimitive, localToWorld?: Transform, geomType?: HitGeomType): void {\r\n this.primitive = primitive;\r\n this.geomType = undefined;\r\n\r\n // Only HitGeomType.Point and HitGeomType.Surface are valid without a curve primitive.\r\n if (undefined === this.primitive) {\r\n if (HitGeomType.Point === geomType || HitGeomType.Surface === geomType)\r\n this.geomType = geomType;\r\n return;\r\n }\r\n\r\n if (undefined !== localToWorld)\r\n this.primitive.tryTransformInPlace(localToWorld);\r\n\r\n if (this.primitive instanceof Arc3d)\r\n this.geomType = HitGeomType.Arc;\r\n else if (this.primitive instanceof LineSegment3d)\r\n this.geomType = HitGeomType.Segment;\r\n else if (this.primitive instanceof LineString3d)\r\n this.geomType = HitGeomType.Segment;\r\n else\r\n this.geomType = HitGeomType.Curve;\r\n\r\n // Set curve primitive geometry type override...\r\n // - HitGeomType.Point with arc/ellipse denotes center.\r\n // - HitGeomType.Surface with any curve primitive denotes an interior hit.\r\n if (undefined !== geomType && HitGeomType.None !== geomType)\r\n this.geomType = geomType;\r\n }\r\n\r\n /** Make a copy of this SnapDetail. */\r\n public override clone(): SnapDetail {\r\n const val = new SnapDetail(this, this.snapMode, this.heat, this.snapPoint);\r\n val.sprite = this.sprite;\r\n val.geomType = this.geomType;\r\n val.parentGeomType = this.parentGeomType;\r\n val.adjustedPoint.setFrom(this.adjustedPoint);\r\n if (undefined !== this.primitive)\r\n val.primitive = this.primitive.clone();\r\n if (undefined !== this.normal)\r\n val.normal = this.normal.clone();\r\n return val;\r\n }\r\n\r\n public getCurvePrimitive(singleSegment: boolean = true): CurvePrimitive | undefined {\r\n if (!singleSegment || undefined === this.primitive)\r\n return this.primitive;\r\n\r\n if (this.primitive instanceof LineString3d) {\r\n const ls = this.primitive;\r\n if (ls.points.length > 2) {\r\n const loc = ls.closestPoint(this.snapPoint, false);\r\n const nSegments = ls.points.length - 1;\r\n const uSegRange = (1.0 / nSegments);\r\n let segmentNo = Math.floor(loc.fraction / uSegRange);\r\n if (segmentNo >= nSegments)\r\n segmentNo = nSegments - 1;\r\n return LineSegment3d.create(ls.points[segmentNo], ls.points[segmentNo + 1]);\r\n }\r\n }\r\n\r\n return this.primitive;\r\n }\r\n\r\n public override draw(context: DecorateContext) {\r\n if (undefined !== this.primitive) {\r\n let singleSegment = false;\r\n switch (this.snapMode) {\r\n case SnapMode.Center:\r\n case SnapMode.Origin:\r\n case SnapMode.Bisector:\r\n break; // Snap point for these is computed using entire linestring, not just the hit segment...\r\n\r\n default: {\r\n singleSegment = true;\r\n break;\r\n }\r\n }\r\n\r\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const outline = context.viewport.hilite.color.adjustedForContrast(context.viewport.view.backgroundColor, 50);\r\n const centerLine = context.viewport.hilite.color.adjustedForContrast(outline, 175);\r\n const path = Path.create(this.getCurvePrimitive(singleSegment)!);\r\n\r\n builder.setSymbology(outline, outline, 6);\r\n builder.addPath(path);\r\n\r\n builder.setSymbology(centerLine, centerLine, 2);\r\n builder.addPath(path);\r\n\r\n context.addDecorationFromBuilder(builder);\r\n return;\r\n }\r\n super.draw(context);\r\n }\r\n\r\n private static getSnapSpriteUrl(snapType: SnapMode): string {\r\n switch (snapType) {\r\n case SnapMode.Nearest: return `${IModelApp.publicPath}sprites/SnapPointOn.png`;\r\n case SnapMode.NearestKeypoint: return `${IModelApp.publicPath}sprites/SnapKeypoint.png`;\r\n case SnapMode.MidPoint: return `${IModelApp.publicPath}sprites/SnapMidpoint.png`;\r\n case SnapMode.Center: return `${IModelApp.publicPath}sprites/SnapCenter.png`;\r\n case SnapMode.Origin: return `${IModelApp.publicPath}sprites/SnapOrigin.png`;\r\n case SnapMode.Bisector: return `${IModelApp.publicPath}sprites/SnapBisector.png`;\r\n case SnapMode.Intersection: return `${IModelApp.publicPath}sprites/SnapIntersection.png`;\r\n }\r\n return \"\";\r\n }\r\n}\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport class IntersectDetail extends SnapDetail {\r\n public constructor(from: SnapDetail, heat: SnapHeat = SnapHeat.None, snapPoint: XYZProps, public readonly otherPrimitive: CurvePrimitive, public readonly otherId: string) {\r\n super(from, SnapMode.Intersection, heat, snapPoint);\r\n this.primitive = from.primitive;\r\n this.normal = from.normal; // Preserve normal from primary snap location for AccuDraw smart rotation...\r\n }\r\n\r\n public override draw(context: DecorateContext) {\r\n if (undefined !== this.primitive && undefined !== this.otherPrimitive) {\r\n const builder = context.createGraphicBuilder(GraphicType.WorldOverlay);\r\n const outline = context.viewport.hilite.color.adjustedForContrast(context.viewport.view.backgroundColor, 50);\r\n const centerLine = context.viewport.hilite.color.adjustedForContrast(outline, 175);\r\n const path1 = Path.create(this.primitive);\r\n const path2 = Path.create(this.otherPrimitive);\r\n\r\n builder.setSymbology(outline, outline, 6);\r\n builder.addPath(path1);\r\n builder.addPath(path2);\r\n\r\n builder.setSymbology(centerLine, centerLine, 2);\r\n builder.addPath(path1);\r\n builder.setSymbology(centerLine, centerLine, 2, LinePixels.Code2);\r\n builder.addPath(path2);\r\n\r\n context.addDecorationFromBuilder(builder);\r\n return;\r\n }\r\n super.draw(context);\r\n }\r\n}\r\n\r\n/** The result of a \"locate\" is a sorted list of objects that satisfied the search criteria (a HitList). Earlier hits in the list\r\n * are somehow *better* than those later on.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HitList<T extends HitDetail> {\r\n public hits: T[] = [];\r\n public currHit = -1;\r\n public get length(): number { return this.hits.length; }\r\n public empty(): void {\r\n this.hits.length = 0;\r\n this.currHit = -1;\r\n }\r\n\r\n public resetCurrentHit(): void { this.currHit = -1; }\r\n\r\n /** Get a hit from a particular index into a HitList\r\n * return the requested hit from the HitList or undefined\r\n */\r\n public getHit(hitNum: number): T | undefined {\r\n if (hitNum < 0)\r\n hitNum = this.length - 1;\r\n\r\n return (hitNum >= this.length) ? undefined : this.hits[hitNum];\r\n }\r\n\r\n /** When setting one or more indices to undefined you must call dropNulls afterwards */\r\n public setHit(i: number, p: T | undefined): void {\r\n if (i < 0 || i >= this.length)\r\n return;\r\n this.hits[i] = p!;\r\n }\r\n\r\n public dropNulls(): void {\r\n const hits = this.hits;\r\n this.hits = [];\r\n for (const hit of hits)\r\n this.hits.push(hit);\r\n }\r\n\r\n public getNextHit(): T | undefined {\r\n this.currHit++;\r\n return this.getCurrentHit();\r\n }\r\n\r\n public getCurrentHit(): T | undefined { return -1 === this.currHit ? undefined : this.getHit(this.currHit); }\r\n\r\n public setCurrentHit(hit: T): void {\r\n this.resetCurrentHit();\r\n for (let thisHit; undefined !== (thisHit = this.getNextHit());) {\r\n if (thisHit === hit)\r\n return;\r\n }\r\n }\r\n\r\n /** remove the current hit from the list. */\r\n public removeCurrentHit() { this.removeHit(this.currHit); }\r\n\r\n /** remove a hit in the list. */\r\n public removeHit(hitNum: number) {\r\n if (hitNum < 0) // Support -1 == END\r\n hitNum = this.length - 1;\r\n\r\n if (hitNum <= this.currHit)\r\n this.currHit = -1;\r\n\r\n if (hitNum >= this.length) // Locate calls GetNextHit, which increments currHit, until it goes beyond the end of size of the array.\r\n return; // Then Reset call RemoteCurrentHit, which passes in currHit. When it is out of range, we do nothing.\r\n\r\n this.hits.splice(hitNum, 1);\r\n }\r\n\r\n /** search through list and remove any hits that contain a specified element id. */\r\n public removeHitsFrom(sourceId: string): boolean {\r\n let removedOne = false;\r\n\r\n // walk backwards through list so we don't have to worry about what happens on remove\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const thisHit = this.hits[i];\r\n if (thisHit && sourceId === thisHit.sourceId) {\r\n removedOne = true;\r\n this.removeHit(i);\r\n }\r\n }\r\n return removedOne;\r\n }\r\n\r\n private getPriorityZOverride(priority: HitPriority): number {\r\n switch (priority) {\r\n case HitPriority.WireEdge:\r\n case HitPriority.PlanarEdge:\r\n case HitPriority.NonPlanarEdge:\r\n return 0;\r\n case HitPriority.SilhouetteEdge:\r\n return 1;\r\n case HitPriority.PlanarSurface:\r\n case HitPriority.NonPlanarSurface:\r\n return 2;\r\n default:\r\n return 3;\r\n }\r\n }\r\n\r\n /** compare two hits for insertion into list. */\r\n public compare(hit1: HitDetail | undefined, hit2: HitDetail | undefined): -1 | 1 | 0 {\r\n if (!hit1 || !hit2)\r\n return 0;\r\n\r\n const zOverride1 = this.getPriorityZOverride(hit1.priority);\r\n const zOverride2 = this.getPriorityZOverride(hit2.priority);\r\n\r\n // Prefer edges over surfaces, this is more important than z because we know the edge isn't obscured...\r\n if (zOverride1 < zOverride2)\r\n return -1;\r\n if (zOverride1 > zOverride2)\r\n return 1;\r\n\r\n // Compare xy distance from pick point, prefer hits closer to center...\r\n if (hit1.distXY < hit2.distXY)\r\n return -1;\r\n if (hit1.distXY > hit2.distXY)\r\n return 1;\r\n\r\n // Compare distance fraction, prefer hits closer to eye...\r\n if (hit1.distFraction > hit2.distFraction)\r\n return -1;\r\n if (hit1.distFraction < hit2.distFraction)\r\n return 1;\r\n\r\n // Compare geometry class, prefer path/region hits over surface hits when all else is equal...\r\n if (hit1.priority < hit2.priority)\r\n return -1;\r\n if (hit1.priority > hit2.priority)\r\n return 1;\r\n\r\n return 0;\r\n }\r\n\r\n /** Add a new hit to the list. Hits are sorted according to their priority and distance. */\r\n public addHit(newHit: T): number {\r\n if (0 === this.hits.length) {\r\n this.hits.push(newHit);\r\n return 0;\r\n }\r\n let index = 0;\r\n for (; index < this.hits.length; ++index) {\r\n const oldHit = this.hits[index];\r\n const comparison = this.compare(newHit, oldHit);\r\n if (comparison < 0)\r\n break;\r\n }\r\n\r\n this.hits.splice(index, 0, newHit);\r\n return index;\r\n }\r\n\r\n /** Insert a new hit into the list at the supplied index. */\r\n public insertHit(i: number, hit: T): void {\r\n if (i < 0 || i >= this.length)\r\n this.hits.push(hit);\r\n else\r\n this.hits.splice(i, 0, hit);\r\n }\r\n}\r\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module IModelConnection
3
3
  */
4
4
  import { BeEvent, CompressedId64Set, GuidString, Id64Arg, Id64Set, Id64String, PickAsyncMethods, TransientIdSequence } from "@itwin/core-bentley";
5
- import { AxisAlignedBox3d, Cartographic, CodeProps, CodeSpec, EcefLocationProps, ECSqlReader, ElementLoadOptions, ElementMeshRequestProps, ElementProps, EntityQueryParams, FontMap, GeometryContainmentRequestProps, GeometryContainmentResponseProps, GeometrySummaryRequestProps, IModel, IModelConnectionProps, MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelExtentsProps, ModelProps, ModelQueryParams, Placement, QueryBinder, QueryOptions, SnapRequestProps, SnapResponseProps, SubCategoryAppearance, SubCategoryResultRow, TextureData, TextureLoadProps, ThumbnailProps, ViewDefinitionProps, ViewIdString, ViewQueryParams, ViewStateProps, ViewStoreRpc } from "@itwin/core-common";
5
+ import { AxisAlignedBox3d, Cartographic, CodeProps, CodeSpec, EcefLocationProps, ECSqlReader, ElementLoadOptions, ElementMeshRequestProps, ElementProps, EntityQueryParams, FontMap, GeographicCRSProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps, GeometrySummaryRequestProps, IModel, IModelConnectionProps, MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps, ModelExtentsProps, ModelProps, ModelQueryParams, Placement, QueryBinder, QueryOptions, SnapRequestProps, SnapResponseProps, SubCategoryAppearance, SubCategoryResultRow, TextureData, TextureLoadProps, ThumbnailProps, ViewDefinitionProps, ViewIdString, ViewQueryParams, ViewStateProps, ViewStoreRpc } from "@itwin/core-common";
6
6
  import { Point3d, Range3d, Range3dProps, Transform, XYAndZ, XYZProps } from "@itwin/core-geometry";
7
7
  import { BriefcaseConnection } from "./BriefcaseConnection";
8
8
  import { CheckpointConnection } from "./CheckpointConnection";
@@ -256,7 +256,7 @@ export declare abstract class IModelConnection extends IModel {
256
256
  /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using the Geographic location services for this IModelConnection.
257
257
  * @param spatial A point in the iModel's spatial coordinates
258
258
  * @param result If defined, use this for output
259
- * @returns A Cartographic location
259
+ * @returns A Cartographic location (Horizontal datum depends on iModel's GCS)
260
260
  * @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
261
261
  * @see [[cartographicFromSpatial]] if you have more than one point to convert, or you don't know whether the iModel has a GCS.
262
262
  */
@@ -264,20 +264,30 @@ export declare abstract class IModelConnection extends IModel {
264
264
  /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using the Geographic location services for this IModelConnection or [[IModel.ecefLocation]].
265
265
  * @param spatial A point in the iModel's spatial coordinates
266
266
  * @param result If defined, use this for output
267
- * @returns A Cartographic location
267
+ * @returns A Cartographic location (Horizontal datum depends on iModel's GCS)
268
268
  * @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
269
269
  * @see [[cartographicFromSpatial]] to convert multiple points at once.
270
270
  * @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
271
271
  */
272
272
  spatialToCartographic(spatial: XYAndZ, result?: Cartographic): Promise<Cartographic>;
273
273
  /** Convert points in this iModel's spatial coordinate system to [Cartographic]($common) coordinates using either a [[GeoConverter]] or the iModel's [EcefLocation]($common).
274
- * @param spatial Coordiantes to be converted from the iModel's spatial coordinate system
274
+ * @param spatial Coordinates to be converted from the iModel's spatial coordinate system
275
275
  * @returns The `spatial` coordinates converted to cartographic coordinates, of the same length and order as the `spatial`.
276
276
  * @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
277
277
  * @see [[spatialFromCartographic]] to perform the inverse conversion.
278
278
  * @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
279
279
  */
280
280
  cartographicFromSpatial(spatial: XYAndZ[]): Promise<Cartographic[]>;
281
+ /** Convert points in this iModel's spatial coordinate system to [Cartographic]($common) coordinates using either a [[GeoConverter]] or the iModel's [EcefLocation]($common).
282
+ * @param spatial Coordinates to be converted from the iModel's spatial coordinate system
283
+ * @returns The `spatial` coordinates converted to cartographic coordinates (WGS84 horizontal datum), of the same length and order as the `spatial`.
284
+ * @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
285
+ * @see [[cartographicFromSpatial]] to perform conversion using iModel's GCS horizontal datum
286
+ * @beta
287
+ */
288
+ wgs84CartographicFromSpatial(spatial: XYAndZ[]): Promise<Cartographic[]>;
289
+ /** @internal */
290
+ cartographicFromSpatialWithGcs(spatial: XYAndZ[], datumOrGCRS?: string | GeographicCRSProps): Promise<Cartographic[]>;
281
291
  /** Convert a [Cartographic]($common) to a point in this iModel's spatial coordinate system using a [[GeoConverter]].
282
292
  * @param cartographic A cartographic location
283
293
  * @param result If defined, use this for output
@@ -302,6 +312,14 @@ export declare abstract class IModelConnection extends IModel {
302
312
  * @see [[cartographicFromSpatial]] to perform the inverse conversion.
303
313
  */
304
314
  spatialFromCartographic(cartographic: Cartographic[]): Promise<Point3d[]>;
315
+ /** Convert geographic coordinates into points in this iModel's spatial coordinate system using a [[GeoConverter]] or the iModel's [EcefLocation]($common).
316
+ * @param geoCoords Coordinates to be converted are in the coordinate system described by the `datumOrGCRS` parameter. Defaults iModel's spatial coordinate system otherwise.
317
+ * @param datumOrGCRS Datum name or Geographic CRS object definition to use for the conversion.
318
+ * @returns The `geographics` coordinates converted to spatial coordinates, of the same length and order as `geographics`.
319
+ * @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
320
+ * @beta
321
+ */
322
+ toSpatialFromGcs(geoCoords: XYAndZ[], datumOrGCRS?: string | GeographicCRSProps): Promise<Point3d[]>;
305
323
  /** Expand this iModel's [[displayedExtents]] to include the specified range.
306
324
  * This is done automatically when reality models are added to a spatial view. In some cases a [[TiledGraphicsProvider]] may wish to expand
307
325
  * the extents explicitly to include its geometry.