@arcgis/core 4.29.0 → 4.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  12. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  13. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  14. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  15. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  17. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  20. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  21. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  23. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  24. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  26. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  34. package/chunks/Laserlines.glsl.js +3 -3
  35. package/chunks/Precipitation.glsl.js +1 -1
  36. package/chunks/SSAOBlur.glsl.js +2 -2
  37. package/chunks/boundedPlane.js +1 -1
  38. package/chunks/cameraUtilsSpherical.js +1 -1
  39. package/chunks/sphere.js +1 -1
  40. package/chunks/terrainUtilsPlanar.js +1 -1
  41. package/chunks/vec32.js +1 -1
  42. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  43. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  44. package/core/libs/gl-matrix-2/vec3.js +1 -1
  45. package/geometry/support/axisAngleDegrees.js +1 -1
  46. package/geometry/support/coordinateSystem.js +1 -1
  47. package/geometry/support/lineSegment.js +1 -1
  48. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  49. package/geometry/support/meshUtils/georeference.js +1 -1
  50. package/geometry/support/meshUtils/merge.js +1 -1
  51. package/geometry/support/meshUtils/rotate.js +1 -1
  52. package/geometry/support/meshUtils/scale.js +1 -1
  53. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  54. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  55. package/geometry/support/plane.js +1 -1
  56. package/geometry/support/ray.js +1 -1
  57. package/geometry/support/triangle.js +1 -1
  58. package/geometry/support/vector.js +1 -1
  59. package/interfaces.d.ts +6 -6
  60. package/kernel.js +1 -1
  61. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  62. package/layers/LinkChartLayer.js +1 -1
  63. package/layers/VoxelWasmPerSceneView.js +1 -1
  64. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  65. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  66. package/layers/mixins/FeatureReductionLayer.js +1 -1
  67. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  68. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  69. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  70. package/layers/support/layerUtils.js +1 -1
  71. package/layers/video/VideoCameraSensorModel.js +1 -1
  72. package/layers/voxel/VoxelVolume.js +1 -1
  73. package/layers/voxel/voxelPlaneUtils.js +1 -1
  74. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  75. package/package.json +1 -1
  76. package/support/revision.js +1 -1
  77. package/symbols/cim/cimAnalyzer.js +1 -1
  78. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  81. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  82. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  83. package/views/2d/layers/features/Processor.js +1 -1
  84. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  85. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  86. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  87. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  88. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  89. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  90. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  91. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  92. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  93. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  94. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  95. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  96. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  97. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  98. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  99. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  100. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  101. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  102. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  103. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  104. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  105. package/views/2d/layers/features/support/Tile.js +1 -1
  106. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  107. package/views/2d/tiling/TileKey.js +1 -1
  108. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  109. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  110. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  111. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  112. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  113. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  114. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  115. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  116. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  117. package/views/3d/analysis/support/measurementUtils.js +1 -1
  118. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  119. package/views/3d/camera/constraintUtils/common.js +1 -1
  120. package/views/3d/camera/constraintUtils/distance.js +1 -1
  121. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  122. package/views/3d/camera/intersectionUtils.js +1 -1
  123. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  124. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  125. package/views/3d/environment/Fog.js +1 -1
  126. package/views/3d/environment/MarsAtmosphere.js +1 -1
  127. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  128. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  129. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  130. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  131. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  132. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  133. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  134. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  135. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  136. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  137. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  138. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  139. package/views/3d/layers/I3SMeshView3D.js +1 -1
  140. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  141. package/views/3d/layers/PointCloudWorker.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  144. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  145. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  146. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  147. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  148. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  149. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  150. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  151. package/views/3d/layers/support/uvUtils.js +1 -1
  152. package/views/3d/state/Frustum.js +1 -1
  153. package/views/3d/state/NearFarHeuristic.js +1 -1
  154. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  155. package/views/3d/state/controllers/RotateController.js +1 -1
  156. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  157. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  158. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  159. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  160. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  161. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  162. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  163. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  164. package/views/3d/state/utils/navigationUtils.js +1 -1
  165. package/views/3d/state/utils/viewUtils.js +1 -1
  166. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  167. package/views/3d/support/cameraUtils.js +1 -1
  168. package/views/3d/support/cameraUtilsInternal.js +1 -1
  169. package/views/3d/support/intersectionUtils.js +1 -1
  170. package/views/3d/support/mathUtils.js +1 -1
  171. package/views/3d/support/orientedBoundingBox.js +1 -1
  172. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  173. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  174. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  175. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  176. package/views/3d/support/sunUtils.js +1 -1
  177. package/views/3d/support/viewpointUtils.js +1 -1
  178. package/views/3d/terrain/OverlayManager.js +1 -1
  179. package/views/3d/terrain/PatchRenderData.js +1 -1
  180. package/views/3d/terrain/SphericalPatch.js +1 -1
  181. package/views/3d/terrain/TerrainRenderer.js +1 -1
  182. package/views/3d/terrain/Tile.js +1 -1
  183. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  186. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  187. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  188. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  189. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  190. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  191. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  192. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  193. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  194. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  195. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  196. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  197. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  198. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  199. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  200. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  201. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  202. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  203. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  204. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  207. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  211. package/views/SelectionManager.js +1 -1
  212. package/views/draw/support/createUtils.js +1 -1
  213. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/SegmentLabels.js +1 -1
  216. package/views/interactive/coordinateHelper.js +1 -1
  217. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  218. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  219. package/views/interactive/sketch/constraints.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  224. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  225. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  226. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  227. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  228. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  229. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  230. package/views/layers/FeatureLayerView.js +1 -1
  231. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  232. package/views/support/angularMeasurementUtils.js +1 -1
  233. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  234. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  235. package/views/support/geometry3dUtils.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  238. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  239. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  240. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  241. package/widgets/Features/FeaturesViewModel.js +1 -1
  242. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  243. package/widgets/PanoramicViewer/utils.js +1 -1
  244. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  245. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  246. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  247. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  248. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  249. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  250. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  251. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  252. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  253. package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
  254. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  255. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  256. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  257. package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t){const e=this._getBlock(0);e.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:i,highlightFlags:s}of t){if(null==i)continue;const t=a(i);e.setComponent(0,s,[t])}this._idsToHighlight.clear();for(const{objectId:i,highlightFlags:s}of t)this._idsToHighlight.set(i,s)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
5
+ import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=a(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get timeInfo(){return this._options.timeInfo}get objectIdField(){return this._options.objectIdField}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}}class s extends i{static create(e){return new s({fields:[],objectIdField:"uid",geometryType:null,spatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null})}}export{i as FeatureMetadata,s as GraphicsMetadata};
5
+ import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}createArcadeEvalOptions(e){return{$view:{scale:e.scale,timeZone:this._options.timeZone}}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get timeInfo(){return this._options.timeInfo}get timeZone(){return this._options.timeZone}get objectIdField(){return this._options.objectIdField}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}}class s extends i{static create(e){return new s({fields:[],objectIdField:"uid",geometryType:null,spatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,timeZone:null})}}export{i as FeatureMetadata,s as GraphicsMetadata};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
5
+ import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/ArrayPool.js";import e from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(t,e){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return e.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}get arcadeEvaluationOptions(){return{$view:{scale:this.scale}}}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new n(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
5
+ import t from"../../../../../core/ArrayPool.js";import e from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(t,e){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return e.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new n(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as u,isExtent as p,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as F}from"../support/UpdateTracking2D.js";class V{static getOrCreate(e,t,r){let s=t.get(e.id);return s||(s=new V(e,r),t.set(e.id,s)),s}static fromItems(e,t,r){const s=new V(e,r);return s.addedOrModified.push(...t),s}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let $=class extends(s(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new F({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this.requestUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:s}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,s),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(r)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:r,highlightFlags:s}of e){const e=this._graphicStore.getItem(r)?.displayId;t.push({objectId:r,highlightFlags:s,displayId:e})}this._attributeStore.setHighlight(t),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const r of e.added)this._setFilterState(r);for(const r of e.updated)this._setFilterState(r);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const r of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).addedOrModified.push(r)}}for(const r of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(r.prevBounds),s=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const i of e){V.getOrCreate(i,t,this._metadata).removed.push(r.displayId)}for(const i of s){V.getOrCreate(i,t,this._metadata).addedOrModified.push(r)}}for(const r of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).removed.push(r.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const s=r.getCursor();for(;s.next();)for(const e of s.getMeshWriters())e.enqueueRequest(this._resourceProxy,s,t.arcadeEvaluationOptions)}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let r=this._tiles.get(t.tile.key);r||(r=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(r,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){t.entityStart(r.getDisplayId(),r.getZOrder());for(const s of r.getMeshWriters())s.write(t,this._resourceProxy,r,e.tile.arcadeEvaluationOptions,e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,r=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,r|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const r=t.linearCIM.filter((e=>"text"===e.type));if(r.length>0){const s=await this._getTextResources(e,r);e.symbolResource={symbolInfo:t,textInfo:s}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const r=await this._convertToCIMSymbol(t),s=await this._createLinearCIM(r);if("text"===t.type)for(const i of s)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:r,linearCIM:s,meshWriters:await this._createMeshWriters(r,s)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const r=this.container.instanceStore,s=await M(e,t,r);return Promise.all(s.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),r=this.view.featuresTilingScheme.getTileResolution(e.level),s=new v(e,r,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const r=this._createFeatureTile(e.key),s=V.fromItems(e,t,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);r.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:u(t)||p(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const r=new Array,s=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:r}=t.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:r||"",font:a.font}}),o.text=a.textString=r||""})),r.push(t)}else s.push({type:"cim-rasterization-info",resource:a})}r.length>0&&await Promise.all(r);const o=s.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const s of this._graphicStore.items()){const e=s.symbolResource?.symbolInfo.hash;t.add(e)}const r=new Set(this._hashToSymbolInfo.keys());for(const s of r.values())t.has(s)||this._hashToSymbolInfo.delete(s)}};e([h()],$.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],$.prototype,"layerId",void 0),e([h({constructOnly:!0})],$.prototype,"requestUpdateCallback",void 0),e([h()],$.prototype,"container",void 0),e([h({constructOnly:!0})],$.prototype,"graphics",void 0),e([h()],$.prototype,"renderer",void 0),e([h()],$.prototype,"_updateTracking",void 0),e([h()],$.prototype,"updating",null),e([h()],$.prototype,"view",void 0),e([h()],$.prototype,"updateRequested",void 0),e([h()],$.prototype,"defaultPointSymbolEnabled",void 0),$=e([d("esri.views.2d.layers.support.GraphicsView2D")],$);const A=$;export{A as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as A}from"../support/UpdateTracking2D.js";class F{static getOrCreate(e,t,r){let s=t.get(e.id);return s||(s=new F(e,r),t.set(e.id,s)),s}static fromItems(e,t,r){const s=new F(e,r);return s.addedOrModified.push(...t),s}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let V=class extends(s(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new A({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this.requestUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:s}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,s),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(r)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:r,highlightFlags:s}of e){const e=this._graphicStore.getItem(r)?.displayId;t.push({objectId:r,highlightFlags:s,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const r of e.added)this._setFilterState(r);for(const r of e.updated)this._setFilterState(r);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const r of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){F.getOrCreate(s,t,this._metadata).addedOrModified.push(r)}}for(const r of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(r.prevBounds),s=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const i of e){F.getOrCreate(i,t,this._metadata).removed.push(r.displayId)}for(const i of s){F.getOrCreate(i,t,this._metadata).addedOrModified.push(r)}}for(const r of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){F.getOrCreate(s,t,this._metadata).removed.push(r.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const s=r.getCursor();for(;s.next();)for(const e of s.getMeshWriters())e.enqueueRequest(this._resourceProxy,s,this._metadata.createArcadeEvalOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let r=this._tiles.get(t.tile.key);r||(r=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(r,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){t.entityStart(r.getDisplayId(),r.getZOrder());for(const s of r.getMeshWriters())s.write(t,this._resourceProxy,r,this._metadata.createArcadeEvalOptions(e.tile),e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,r=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,r|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const r=t.linearCIM.filter((e=>"text"===e.type));if(r.length>0){const s=await this._getTextResources(e,r);e.symbolResource={symbolInfo:t,textInfo:s}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const r=await this._convertToCIMSymbol(t),s=await this._createLinearCIM(r);if("text"===t.type)for(const i of s)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:r,linearCIM:s,meshWriters:await this._createMeshWriters(r,s)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const r=this.container.instanceStore,s=await M(e,t,r);return Promise.all(s.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),r=this.view.featuresTilingScheme.getTileResolution(e.level),s=new v(e,r,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const r=this._createFeatureTile(e.key),s=F.fromItems(e,t,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);r.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:p(t)||u(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const r=new Array,s=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:r}=t.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:r||"",font:a.font}}),o.text=a.textString=r||""})),r.push(t)}else s.push({type:"cim-rasterization-info",resource:a})}r.length>0&&await Promise.all(r);const o=s.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const s of this._graphicStore.items()){const e=s.symbolResource?.symbolInfo.hash;t.add(e)}const r=new Set(this._hashToSymbolInfo.keys());for(const s of r.values())t.has(s)||this._hashToSymbolInfo.delete(s)}};e([h()],V.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],V.prototype,"layerId",void 0),e([h({constructOnly:!0})],V.prototype,"requestUpdateCallback",void 0),e([h()],V.prototype,"container",void 0),e([h({constructOnly:!0})],V.prototype,"graphics",void 0),e([h()],V.prototype,"renderer",void 0),e([h()],V.prototype,"_updateTracking",void 0),e([h()],V.prototype,"updating",null),e([h()],V.prototype,"view",void 0),e([h()],V.prototype,"updateRequested",void 0),e([h()],V.prototype,"defaultPointSymbolEnabled",void 0),V=e([d("esri.views.2d.layers.support.GraphicsView2D")],V);const $=V;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/ObjectPool.js";class l{static getId(t,l,e,o){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${l}/${e}/${o}`}constructor(t,l,e,o){this.set(t,l,e,o)}get key(){return this}get id(){return this.toString()}set id(t){this.set(t)}get hash(){const t=4095&this.row,l=4095&this.col,e=63&this.level;return(3&this.world)<<30|l<<22|t<<8|e}acquire(t,l,e,o){this.set(t,l,e,o)}contains(t){const l=t.level-this.level;return l>=0&&this.row===t.row>>l&&this.col===t.col>>l&&this.world===t.world}containsChild(t){const l=t.level-this.level;return l>0&&this.row===t.row>>l&&this.col===t.col>>l&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new l(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,l,e,o){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[l,e,o,s]=t.split("/");this.level=parseFloat(l),this.row=parseFloat(e),this.col=parseFloat(o),this.world=parseFloat(s)}else this.level=+t,this.row=+l,this.col=+e,this.world=+o||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new l(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(t,l){return`${this.level}/${this.row+l}/${this.col+t}/${this.world}`}getChildKeys(){const t=this.level+1,e=this.row<<1,o=this.col<<1,s=this.world;return[new l(t,e,o,s),new l(t,e,o+1,s),new l(t,e+1,o,s),new l(t,e+1,o+1,s)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}l.pool=new t(l,null,null,25,50);export{l as default};
5
+ import t from"../../../core/ObjectPool.js";class e{static getId(t,e,l,o){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${l}/${o}`}constructor(t,e,l,o){this.set(t,e,l,o)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,l=63&this.level;return(3&this.world)<<30|e<<22|t<<8|l}acquire(t,e,l,o){this.set(t,e,l,o)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}containsChild(t){const e=t.level-this.level;return e>0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new e(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,l,o){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,l,o,s]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(l),this.col=parseFloat(o),this.world=parseFloat(s)}else this.level=+t,this.row=+e,this.col=+l,this.world=+o||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new e(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(t,e){return`${this.level}/${this.row+e}/${this.col+t}/${this.world}`}getChildKeys(){const t=this.level+1,l=this.row<<1,o=this.col<<1,s=this.world;return[new e(t,l,o,s),new e(t,l,o+1,s),new e(t,l+1,o,s),new e(t,l+1,o+1,s)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}e.pool=new t(e,null,null,25,50);export{e as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as n,c as h,b as a,E as d,f as l,j as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as E,segmentLengthEuclidean as F}from"../../support/measurementUtils.js";import{getElevationAtPoint as N}from"../../../support/ElevationProvider.js";import{midpoint3d as q,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;q(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,q(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(E(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(F(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=N(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
5
+ import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as n,c as h,b as a,F as d,f as l,k as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as F,segmentLengthEuclidean as q}from"../../support/measurementUtils.js";import{getElevationAtPoint as E}from"../../../support/ElevationProvider.js";import{midpoint3d as N,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;N(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,N(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(F(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(q(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=E(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{i as t,h as n,j as i,f as o,o as r}from"../../../../chunks/vec32.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as c,directStartToEnd as d}from"./lengthDimensionUtils.js";import{constraintThresholdPx as m}from"./settings.js";import u from"../../../../geometry/Point.js";var P;function p(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function f(e,s){if(l(e))return P.Direct;if(!e.enabled)return null;const{geometry:u}=e;if(null==u||t(u.directSegment.startRenderSpace,u.directSegment.endRenderSpace))return null;const{camera:p}=s.state,f=c(a.get(),u,s.renderCoordsHelper),g=d(a.get(),u),S=n(a.get(),f,i(g,f)),v=o(a.get(),g,S),y=r(v),A=r(S),{startRenderSpace:R,endRenderSpace:j}=u.directSegment,z=Math.max(p.computeScreenPixelSizeAt(R)*m,p.computeScreenPixelSizeAt(j)*m)**2;return y<z?P.Vertical:A<z?P.Horizontal:null}function g(e,t,{constraint:n,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:r,spatialReference:a}=i,{startRenderSpace:s,endRenderSpace:l}=o.directSegment,c=r.fromRenderCoords(s,new u({spatialReference:a})),d=r.fromRenderCoords(l,new u({spatialReference:a}));let m;m="start"===t?{startPoint:c}:{endPoint:d},S(e,m,{constraint:n,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function S(t,n,i){const{constraint:o,elevationAlignedStartPoint:r,elevationAlignedEndPoint:a,unconstrainedGeometry:l,view:c}=i,{dimension:d,previousConstraint:m,preConstraintProperties:u}=t;if(null==r||null==a)return;const p=()=>{"startPoint"in n?d.startPoint=n.startPoint:"endPoint"in n&&(d.endPoint=n.endPoint)};if(null==o)p(),null!=m&&null!=u&&(d.measureType=u.measureType,d.orientation=u.orientation);else switch(d.measureType=e.Direct,o){case P.Horizontal:if(o!==m&&(d.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=a.z),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=r.z),d.endPoint=e}break;case P.Vertical:if(o!==m&&(d.orientation=s(l,c)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=a.x,e.y=a.y),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=r.x,e.y=r.y),d.endPoint=e}break;case P.Direct:o!==m&&null!=u&&(d.orientation=u.orientation),p()}t.previousConstraint=o,t.unconstrainedGeometry=l}!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"}(P||(P={}));export{P as LengthDimensionConstraint,S as applyConstraint,f as computeConstraint,p as constraintDependencies,g as reapplyConstraint};
5
+ import"../../../../geometry.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import"../../../../core/has.js";import{j as t,h as n,k as i,f as o,p as r}from"../../../../chunks/vec32.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{automaticHeadingFromCamera as s}from"./lengthDimensionManipulatorUtils.js";import{isGeodesicDimension as l,directUp as c,directStartToEnd as d}from"./lengthDimensionUtils.js";import{constraintThresholdPx as m}from"./settings.js";import u from"../../../../geometry/Point.js";var p;function P(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function f(e,s){if(l(e))return p.Direct;if(!e.enabled)return null;const{geometry:u}=e;if(null==u||t(u.directSegment.startRenderSpace,u.directSegment.endRenderSpace))return null;const{camera:P}=s.state,f=c(a.get(),u,s.renderCoordsHelper),g=d(a.get(),u),S=n(a.get(),f,i(g,f)),v=o(a.get(),g,S),y=r(v),A=r(S),{startRenderSpace:R,endRenderSpace:j}=u.directSegment,z=Math.max(P.computeScreenPixelSizeAt(R)*m,P.computeScreenPixelSizeAt(j)*m)**2;return y<z?p.Vertical:A<z?p.Horizontal:null}function g(e,t,{constraint:n,view:i}){const{unconstrainedGeometry:o}=e;if(null==o)return;const{renderCoordsHelper:r,spatialReference:a}=i,{startRenderSpace:s,endRenderSpace:l}=o.directSegment,c=r.fromRenderCoords(s,new u({spatialReference:a})),d=r.fromRenderCoords(l,new u({spatialReference:a}));let m;m="start"===t?{startPoint:c}:{endPoint:d},S(e,m,{constraint:n,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,unconstrainedGeometry:o,view:i})}function S(t,n,i){const{constraint:o,elevationAlignedStartPoint:r,elevationAlignedEndPoint:a,unconstrainedGeometry:l,view:c}=i,{dimension:d,previousConstraint:m,preConstraintProperties:u}=t;if(null==r||null==a)return;const P=()=>{"startPoint"in n?d.startPoint=n.startPoint:"endPoint"in n&&(d.endPoint=n.endPoint)};if(null==o)P(),null!=m&&null!=u&&(d.measureType=u.measureType,d.orientation=u.orientation);else switch(d.measureType=e.Direct,o){case p.Horizontal:if(o!==m&&(d.orientation=0),"startPoint"in n){const e=n.startPoint;null!=e&&(e.z=a.z),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.z=r.z),d.endPoint=e}break;case p.Vertical:if(o!==m&&(d.orientation=s(l,c)),"startPoint"in n){const e=n.startPoint;null!=e&&(e.x=a.x,e.y=a.y),d.startPoint=e}else if("endPoint"in n){const e=n.endPoint;null!=e&&(e.x=r.x,e.y=r.y),d.endPoint=e}break;case p.Direct:o!==m&&null!=u&&(d.orientation=u.orientation),P()}t.previousConstraint=o,t.unconstrainedGeometry=l}!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"}(p||(p={}));export{p as LengthDimensionConstraint,S as applyConstraint,f as computeConstraint,P as constraintDependencies,g as reapplyConstraint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,f as p,b as f,j as g,i as h,l as v,s as y,y as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPositionAndNormal as H,create as M,signedDistance as P,getNormal as C}from"../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as O}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as U,computeGeometryFromDimension as R,computationToGeometryDependencies as z,headingFromGeometry as A,computeOffsetForPoint as D,computeSegmentForMeasureType as _,computeOffsetAxis as F,directUp as L,directStartToEnd as k,dimensionStartToEnd as E}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as I,pointRadius as G,lengthFraction as B,markerLineSizeFraction as N,orientationCalloutOffsetPx as V,orientationCalloutWidth as W,orientationDiscScale as q,orientationFocusMultiplier as J,orientationSnapThresholdDegrees as K,minLengthMeters as Q,linePaddingPx as X,focusedLinePaddingPx as Y}from"./settings.js";import{Manipulator3D as Z}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as $,worldScaledManipulatorSettings as ee,calculateInputRotationTransform as te,calculateTranslateRotateFromBases as re,rotateManipulatorDefaults as ne}from"../../interactive/manipulatorUtils.js";import{RenderObject as ie}from"../../interactive/RenderObject.js";import{screenToMap3D as oe,screenToRenderPlane as ae,hideManipulatorWhileDragging as se}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ce}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as le}from"../../support/engineContent/marker.js";import{Attribute as me}from"../../webgl-engine/lib/Attribute.js";import{Geometry as de}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as ue,createPolylineGeometry as pe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as fe}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as he}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as ye,resetProperties as we,EventPipeline as Se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as je,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";import xe from"../../../../geometry/Point.js";class He{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class Me extends Z{constructor(t,r){const n=$(e.toUnitRGBA(I(t.effectiveTheme))),i=[new ie(ue(n,1,32,32),tt)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:G,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(I(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Pe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),i=n.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(n,be.Unfocused|be.Selected|tt),new ie(i,be.Focused|tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,metadata:t.metadata,available:!1,...ee})}class Ce extends Z{constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:x(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(I(t.effectiveTheme))),(e=>{this._options.calloutColor=e,et(this,Te({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,et(this,Te({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Te({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*le*N*s(t)+V,calloutColor:e,calloutWidth:W,customStateMask:tt,discScale:q,focusMultiplier:J,material:r,metadata:n}}function Oe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.thinOffsetManipulatorMaterial,r),i=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),o=i.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(i,be.Unfocused|tt),new ie(o,be.Focused|tt),new ie(n,tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,available:!1,metadata:t.metadata,...ee})}function Ue(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=ye(e,((e,t,s,c)=>{const l=se(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(we(n,[a,"measureType","orientation"])).next(d),t.next(l).next(oe(o)).next(...m).next((e=>{const t=O(e.mapEnd,new xe);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Re(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{if(!U(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=se(e);n.next(s).next(ke(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(we(a,["offset"]))}))]}function ze(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function Ae(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{De(e,t,r)}))]}function De(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=R({...z(t),orientation:90},a),c=R({...z(t),orientation:270},a);if(null==s||null==c)return;const l=A(s,a),m=A(c,a),d=Ee(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!U(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=Je(S(),l,l.directSegment,s),p=Ke(T.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=H(d,p,M()),g=n?c.orientation??A(l,a.renderCoordsHelper):c.orientation??0;o.next(ae(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=C(f),r=te(m,e.renderEnd,d,t);let o=g-i(r);n||(o=Fe(o)),c.orientation=o})),t.next(we(c,["orientation"]))}function Fe(e){const t=n.normalize(e)%90;return t<K?e-t:90-t<K?e+(90-t):e}function Le(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!U(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(T.get(),e.renderLocation);c.measureType=n,c.offset=D(m,n,l,i.renderCoordsHelper),c.orientation=0})),ye(e,((e,r,c)=>{if(!U(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=_(ot,n,t,d),p=F(T.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=se(e);r.next(f).next(ke(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function ke(e,t,r,n){const i=p(T.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=H(r.startRenderSpace,i,M()),a=H(r.startRenderSpace,n,M()),s=t.offset;let c,l=0;const m=new Se;return m.next(ae(e,o)).next((r=>{"start"===r.action&&(l=P(a,r.renderStart));const n=(P(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function Ee(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=L(T.get(),e,n),o=k(T.get(),e),a=f(T.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,T.get());return n.headingAtPosition(c,a)}function Ie(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=E(rt,t),a=h(o,j)?c(it):re(o,i,j,it),s=Math.max(v(o),Q/r.unitInMeters);l(a,a,y(rt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,rt)}function Ge(e,t,r){Ne(e,t,r,{forHeading:!0})}function Be(e,t,r){Ne(e,t,r,{forHeading:!1})}function Ne(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ve,a,i.offset>=0?1:-1),c=Ke(We,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=re(s,c,j,it);e.modelTransform=l,e.renderLocation=Je(rt,o,o.dimensionSegment,r)}const Ve=S(),We=S();function qe(e,t,r,n){const{geometry:i}=t,o=_(ot,r,t,n),a=F(rt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(nt,o.endRenderSpace,o.startRenderSpace),c=re(s,a,j,it),m=v(s);l(c,c,y(nt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,nt)}function Je(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Qe(t,n)?i:o;return u(e,a)}function Ke(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?L(e,r,n):E(e,r,{invert:!0})}function Qe(e,t){const r=k(Xe,e),n=L(Ye,e,t);return g(r,n)>0}const Xe=S(),Ye=S();function Ze(e){return s(e)+X}function $e(e){return s(e)+Y}function et(e,t){const r=t.material??new he({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:fe.Opaque,isDecoration:!0}),n=t.focusMultiplier??ne.focusMultiplier,i=t.calloutLength??ne.calloutLength,o=ne.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new de(t,[[ge.POSITION,new me([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[ge.UV0,new me([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ne.calloutWidth,l=new ve({width:c,color:t.calloutColor,renderOccluded:fe.OccludeAndTransparent,isDecoration:!0}),m=pe(l,[[0,0,0],[i-o,0,0]]),d=pe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??je.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new ie(s(o,r),be.Unfocused|u),new ie(m,be.Unfocused|u),new ie(s(a,r),be.Focused|u),new ie(d,be.Focused|u)]}const tt=je.Custom1,rt=S(),nt=S(),it=m(),ot=new ce;export{tt as DidPointerMoveRecentlyFlag,He as LengthDimensionManipulators,Me as LengthDimensionPointManipulator,Ce as LineOfSightOrientationManipulator,Ee as automaticHeadingFromCamera,Oe as createMeasureTypeManipulator,Pe as createOffsetManipulator,$e as focusedOffsetWidth,ze as headingManipulatorHandles,Le as measureTypeManipulatorHandles,Re as offsetManipulatorHandles,Ue as pointManipulatorHandles,Ae as rotationManipulatorHandles,Fe as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,qe as updateMeasureTypeManipulatorTransform,Ie as updateOffsetManipulatorTransform,Be as updateRotationManipulatorTransform};
5
+ import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as r}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as n}from"../../../../core/Cyclical.js";import{rad2deg as i}from"../../../../core/mathUtils.js";import{watch as o,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as c,scale as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as d,c as u,f as p,b as f,k as g,j as h,l as v,s as y,z as w}from"../../../../chunks/vec32.js";import{create as S,ZEROS as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPositionAndNormal as H,create as M,signedDistance as P,getNormal as C}from"../../../../geometry/support/plane.js";import{sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as O}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as U,computeGeometryFromDimension as R,computationToGeometryDependencies as z,headingFromGeometry as A,computeOffsetForPoint as D,computeSegmentForMeasureType as _,computeOffsetAxis as k,directUp as F,directStartToEnd as L,dimensionStartToEnd as E}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as I,pointRadius as G,lengthFraction as B,markerLineSizeFraction as N,orientationCalloutOffsetPx as V,orientationCalloutWidth as W,orientationDiscScale as q,orientationFocusMultiplier as J,orientationSnapThresholdDegrees as K,minLengthMeters as Q,linePaddingPx as X,focusedLinePaddingPx as Y}from"./settings.js";import{Manipulator3D as Z}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as $,worldScaledManipulatorSettings as ee,calculateInputRotationTransform as te,calculateTranslateRotateFromBases as re,rotateManipulatorDefaults as ne}from"../../interactive/manipulatorUtils.js";import{RenderObject as ie}from"../../interactive/RenderObject.js";import{screenToMap3D as oe,screenToRenderPlane as ae,hideManipulatorWhileDragging as se}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ce}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as le}from"../../support/engineContent/marker.js";import{Attribute as me}from"../../webgl-engine/lib/Attribute.js";import{Geometry as de}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as ue,createPolylineGeometry as pe}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as fe}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as he}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as ye,resetProperties as we,EventPipeline as Se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as je,ManipulatorStateFlags as be}from"../../../interactive/interfaces.js";import xe from"../../../../geometry/Point.js";class He{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const r of t)e(this.manipulatorForMeasureType(r),r)}manipulatorForMeasureType(e){switch(e){case r.Direct:return this.direct;case r.Horizontal:return this.horizontal;case r.Vertical:return this.vertical}}}class Me extends Z{constructor(t,r){const n=$(e.toUnitRGBA(I(t.effectiveTheme))),i=[new ie(ue(n,1,32,32),tt)];super({view:t,renderObjects:i,metadata:r.metadata,available:!1,grabCursor:"crosshair",radius:G,collisionPriority:1}),this._themeHandle=o((()=>({color:e.toUnitRGBA(I(t.effectiveTheme))})),(e=>n.setParameters(e)))}destroy(){this._themeHandle.remove(),super.destroy()}}function Pe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),i=n.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(n,be.Unfocused|be.Selected|tt),new ie(i,be.Focused|tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,metadata:t.metadata,available:!1,...ee})}class Ce extends Z{constructor(t,{lineSizePt:r,material:n,metadata:i}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:i}),this._options={calloutColor:x(),lineSizePt:r,material:n},this._themeHandle=o((()=>e.toUnitRGBA(I(t.effectiveTheme))),(e=>{this._options.calloutColor=e,et(this,Te({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,et(this,Te({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Te({calloutColor:e,lineSizePt:t,material:r,metadata:n}){return{calloutLength:.25*le*N*s(t)+V,calloutColor:e,calloutWidth:W,customStateMask:tt,discScale:q,focusMultiplier:J,material:r,metadata:n}}function Oe(e,t){const r=[b(-.5,0,0),b(.5,0,0)],n=pe(t.thinOffsetManipulatorMaterial,r),i=pe(t.unfocusedMaterial,r.map((e=>d(S(),e,B)))),o=i.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new ie(i,be.Unfocused|tt),new ie(o,be.Focused|tt),new ie(n,tt)],collisionType:{type:"line",paths:[r]},radius:$e(t.lineSizePt)/2,available:!1,metadata:t.metadata,...ee})}function Ue(e,{isStart:t,createSnappingPipelineStep:r,dimension:n,onUpdate:i,view:o}){const a=t?"startPoint":"endPoint",s=ye(e,((e,t,s,c)=>{const l=se(e),{snappingStep:m,cancelSnapping:d}=r(c);s=s.next(l).next(we(n,[a,"measureType","orientation"])).next(d),t.next(l).next(oe(o)).next(...m).next((e=>{const t=O(e.mapEnd,new xe);i("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Re(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{if(!U(t)||!e.selected)return;const{geometry:o,dimension:a}=t,s=se(e);n.next(s).next(Le(r,a,o.dimensionSegment,o.primaryOffsetAxis)),i.next(s).next(we(a,["offset"]))}))]}function ze(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!0,steps:n,view:r})}))]}function Ae(e,{computation:t,view:r}){return[ye(e,((e,n,i)=>{_e({cancel:i,computation:t,settingHeading:!1,steps:n,view:r})})),e.events.on("immediate-click",(e=>{De(e,t,r)}))]}function De(e,t,r){const{dimension:i,geometry:o}=t;if(90===i.orientation||270===i.orientation)return i.orientation=0,void e.stopPropagation();if(null==o)return;const{renderCoordsHelper:a}=r,s=R({...z(t),orientation:90},a),c=R({...z(t),orientation:270},a);if(null==s||null==c)return;const l=A(s,a),m=A(c,a),d=Ee(o,r),u=n.shortestSignedDiff(d,l),p=n.shortestSignedDiff(d,m);i.orientation=Math.abs(u)<Math.abs(p)?90:270,e.stopPropagation()}function _e(e){const{cancel:t,computation:r,settingHeading:n,steps:o,view:a}=e;if(!U(r))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:l}=r,m=S(),d=Je(S(),l,l.directSegment,s),p=Ke(T.get(),{forHeading:n,geometry:l,renderCoordsHelper:s}),f=H(d,p,M()),g=n?c.orientation??A(l,a.renderCoordsHelper):c.orientation??0;o.next(ae(a,f)).next((e=>{"start"===e.action&&u(m,e.renderStart);const t=C(f),r=te(m,e.renderEnd,d,t);let o=g-i(r);n||(o=ke(o)),c.orientation=o})),t.next(we(c,["orientation"]))}function ke(e){const t=n.normalize(e)%90;return t<K?e-t:90-t<K?e+(90-t):e}function Fe(e,{computation:t,manipulatorMeasureType:n,view:i}){let o=r.Direct,a=0,s=0;return[e.events.on("grab-changed",(r=>{if("start"!==r.action||!U(t))return;const{dimension:c,geometry:l}=t;o=c.measureType,a=c.offset,s=c.orientation;const m=u(T.get(),e.renderLocation);c.measureType=n,c.offset=D(m,n,l,i.renderCoordsHelper),c.orientation=0})),ye(e,((e,r,c)=>{if(!U(t))return;const{geometry:l,dimension:m}=t,{renderCoordsHelper:d}=i,u=_(ot,n,t,d),p=k(T.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),f=se(e);r.next(f).next(Le(i,m,u,p)),c.next(f).next((e=>(m.measureType=o,m.offset=a,m.orientation=s,e)))}))]}function Le(e,t,r,n){const i=p(T.get(),r.endRenderSpace,r.startRenderSpace);f(i,i,n);const o=H(r.startRenderSpace,i,M()),a=H(r.startRenderSpace,n,M()),s=t.offset;let c,l=0;const m=new Se;return m.next(ae(e,o)).next((r=>{"start"===r.action&&(l=P(a,r.renderStart));const n=(P(a,r.renderEnd)-l)*e.renderCoordsHelper.unitInMeters;t.offset=s+n,c=r})),e=>(m.execute(e),c)}function Ee(e,t){const{directSegment:r}=e,{renderCoordsHelper:n}=t,i=F(T.get(),e,n),o=L(T.get(),e),a=f(T.get(),o,i),{viewForward:s}=t.state.camera;g(a,s)>0&&d(a,a,-1);const c=r.eval(.5,T.get());return n.headingAtPosition(c,a)}function Ie(e,t,r){const{dimensionSegment:n,primaryOffsetAxis:i}=t,o=E(rt,t),a=h(o,j)?c(it):re(o,i,j,it),s=Math.max(v(o),Q/r.unitInMeters);l(a,a,y(rt,s,s,s)),e.modelTransform=a,e.renderLocation=n.eval(.5,rt)}function Ge(e,t,r){Ne(e,t,r,{forHeading:!0})}function Be(e,t,r){Ne(e,t,r,{forHeading:!1})}function Ne(e,t,r,{forHeading:n}){const{dimension:i,geometry:o}=t,{primaryOffsetAxis:a}=o,s=d(Ve,a,i.offset>=0?1:-1),c=Ke(We,{forHeading:n,geometry:o,renderCoordsHelper:r});f(c,c,s);const l=re(s,c,j,it);e.modelTransform=l,e.renderLocation=Je(rt,o,o.dimensionSegment,r)}const Ve=S(),We=S();function qe(e,t,r,n){const{geometry:i}=t,o=_(ot,r,t,n),a=k(rt,{measureType:r,directSegment:i.directSegment,renderCoordsHelper:n}),s=w(nt,o.endRenderSpace,o.startRenderSpace),c=re(s,a,j,it),m=v(s);l(c,c,y(nt,m,m,m)),e.modelTransform=c,e.renderLocation=o.eval(.5,nt)}function Je(e,t,r,n){const{startRenderSpace:i,endRenderSpace:o}=r,a=Qe(t,n)?i:o;return u(e,a)}function Ke(e,{forHeading:t,geometry:r,renderCoordsHelper:n}){return t?F(e,r,n):E(e,r,{invert:!0})}function Qe(e,t){const r=L(Xe,e),n=F(Ye,e,t);return g(r,n)>0}const Xe=S(),Ye=S();function Ze(e){return s(e)+X}function $e(e){return s(e)+Y}function et(e,t){const r=t.material??new he({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:fe.Opaque,isDecoration:!0}),n=t.focusMultiplier??ne.focusMultiplier,i=t.calloutLength??ne.calloutLength,o=ne.discRadius*(t.discScale??1),a=o*n,s=(e,t)=>{const r=[0,1,2,2,3,0];return new de(t,[[ge.POSITION,new me([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[ge.UV0,new me([0,0,1,0,1,1,0,1],r,2,!0)]])},c=t.calloutWidth??ne.calloutWidth,l=new ve({width:c,color:t.calloutColor,renderOccluded:fe.OccludeAndTransparent,isDecoration:!0}),m=pe(l,[[0,0,0],[i-o,0,0]]),d=pe(l,[[0,0,0],[i-a,0,0]]),u=t.customStateMask??je.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=o,e.renderObjects=[new ie(s(o,r),be.Unfocused|u),new ie(m,be.Unfocused|u),new ie(s(a,r),be.Focused|u),new ie(d,be.Focused|u)]}const tt=je.Custom1,rt=S(),nt=S(),it=m(),ot=new ce;export{tt as DidPointerMoveRecentlyFlag,He as LengthDimensionManipulators,Me as LengthDimensionPointManipulator,Ce as LineOfSightOrientationManipulator,Ee as automaticHeadingFromCamera,Oe as createMeasureTypeManipulator,Pe as createOffsetManipulator,$e as focusedOffsetWidth,ze as headingManipulatorHandles,Fe as measureTypeManipulatorHandles,Re as offsetManipulatorHandles,Ue as pointManipulatorHandles,Ae as rotationManipulatorHandles,ke as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ge as updateHeadingManipulatorTransform,qe as updateMeasureTypeManipulatorTransform,Ie as updateOffsetManipulatorTransform,Be as updateRotationManipulatorTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,q as d,y as l,F as c,j as u,v as m,e as p,b as S,n as g,o as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as j}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as E}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function C(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function U(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function w({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new E,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();L(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new E;return Y({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,l.startRenderSpace),s(u.endRenderSpace,l.endRenderSpace)):G(u,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:u,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function z(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function M(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function k(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!O(d);const[c,u]=l?[o,a]:[a,o],m=j(u,q);return n===e.Horizontal?m.z=c.z:(m.x=c.x,m.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(m,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&u(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return m(r,t)<m(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const q=y(0,0,0,null);function F(e,t,n,r){const{directSegment:i}=n,o=L(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=G(I,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return u(s,o)*r.unitInMeters}const I=new E;function L(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:m,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,j=v.eval(.5,P.get()),E=y.worldUpAtPosition(j,P.get()),x=y.worldBasisAtPosition(j,A.Y,P.get());switch(i){case e.Horizontal:s(n,E);break;case e.Vertical:u(m,E)<u(f,E)?l(n,f,m):l(n,m,f),S(n,n,E),S(n,n,E);break;case e.Direct:{const e=r.orientation??0;if(Y({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(B,-t(e),E),p(n,x,B);else{const r=l(P.get(),f,m),i=S(P.get(),r,E);S(i,i,r),o(B,t(e),r),p(n,i,B)}break}}return c(n,R)?s(n,x):g(n,n)}const B=a();function Y({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function G(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,u]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,u),e}function J(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,Y as arePointsVerticallyAligned,U as computationToGeometryDependencies,w as computeGeometryFromDimension,C as computeLength,L as computeOffsetAxis,F as computeOffsetForPoint,k as computeSegmentForMeasureType,z as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,M as offsetSegment};
5
+ import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,r as d,z as l,G as c,k as p,w as u,e as m,b as S,n as g,p as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as E}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as j}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function w(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function z(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function C({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new j,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();B(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const p=d?.dimensionSegment??new j;return G({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(p.startRenderSpace,l.startRenderSpace),s(p.endRenderSpace,l.endRenderSpace)):Y(p,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:p,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function U(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function k(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function M(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!O(d);const[c,p]=l?[o,a]:[a,o],u=E(p,I);return n===e.Horizontal?u.z=c.z:(u.x=c.x,u.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(u,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&p(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return u(r,t)<u(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const I=y(0,0,0,null);function L(e,t,n,r){const{directSegment:i}=n,o=B(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=Y(q,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return p(s,o)*r.unitInMeters}const q=new j;function B(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:u,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,E=v.eval(.5,P.get()),j=y.worldUpAtPosition(E,P.get()),x=y.worldBasisAtPosition(E,A.Y,P.get());switch(i){case e.Horizontal:s(n,j);break;case e.Vertical:p(u,j)<p(f,j)?l(n,f,u):l(n,u,f),S(n,n,j),S(n,n,j);break;case e.Direct:{const e=r.orientation??0;if(G({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(F,-t(e),j),m(n,x,F);else{const r=l(P.get(),f,u),i=S(P.get(),r,j);S(i,i,r),o(F,t(e),r),m(n,i,F)}break}}return c(n,R)?s(n,x):g(n,n)}const F=a();function G({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function Y(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,p]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,p),e}function J(e,t,n,r=0){const i=p(t,n),o=p(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,G as arePointsVerticallyAligned,z as computationToGeometryDependencies,C as computeGeometryFromDimension,w as computeLength,B as computeOffsetAxis,L as computeOffsetForPoint,M as computeSegmentForMeasureType,U as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,k as offsetSegment};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{createLength as o}from"../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicLength as m}from"../../../../geometry/geometryEngine.js";import p from"../../../../geometry/Polyline.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import d from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as h,SphericalECEFSpatialReference as f,WGS84ECEFSpatialReference as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectPointToVector as j}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isSupported as P,geodesicLengths as y,inverseGeodeticSolver as _,InverseGeodeticSolverResult as D}from"../../../../geometry/support/geodesicUtils.js";import{MeasurementMode as w}from"../interfaces.js";import{applyProjectionAndElevationAlignment as z,logFailedGeometryProjectionError as R}from"../support/projectionUtils.js";import{UnitNormalizer as A}from"../support/UnitNormalizer.js";import{geodesicDistanceThreshold as E}from"../../../support/geodesicMeasurementUtils.js";let b=class extends t{constructor(e){super(e),this._unitNormalizer=new A,this._tempStartPosition=c(),this._tempEndPosition=c(),this._tempCornerPosition=c()}initialize(){const e=this.view.spatialReference,t=h(e),i=t===f?v:t;this._sphericalPCPF=i;const o=u(e,i);this._unitNormalizer.spatialReference=o?i:e,this.addHandles([r((()=>({viewData:this.viewData,startPoint:this.analysis.startPoint})),(({viewData:e,startPoint:t})=>{e.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({viewData:this.viewData,endPoint:this.analysis.endPoint})),(({viewData:e,endPoint:t})=>{e.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({result:this._computedResult,viewData:this.viewData})),(({result:e,viewData:t})=>{t.result=e}),s)])}_applyProjectionAndElevationAlignment(e){if(null==e)return e;const{spatialReference:t,elevationProvider:o}=this.view,r=z(e,t,o);return r??(R(this.analysis,e.spatialReference,i.getLogger(this)),null)}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i}=this.viewData;if(null==e||null==t)return null;const o=this._euclideanDistances(e,t),r=this._geodesicDistance(e,t);let s,n;switch(i){case w.Auto:n=null!=r?"geodesic":"euclidean",s=r??o.horizontal;break;case w.Geodesic:if(null==r)return null;n="geodesic",s=r;break;case w.Euclidean:n="euclidean",s=o.horizontal}return{mode:n,directDistance:o.direct,horizontalDistance:s,verticalDistance:o.vertical,distance:i===w.Euclidean||o.horizontal.value<=E?o.direct:r??o.horizontal}}_euclideanDistances(e,t){const i=e.clone();i.z=t.z;const r=this._tempStartPosition,s=this._tempEndPosition,n=this._tempCornerPosition,a=this.view.spatialReference,c=this._sphericalPCPF,m=u(a,c)?c:a;j(e,r,m),j(t,s,m),j(i,n,m);const p=l(r,s),d=l(n,s),h=Math.abs(t.z-e.z),f=e=>this._unitNormalizer.normalizeDistance(e),v=f(p),g=f(d),P=f(h);return{direct:o(v,"meters"),horizontal:o(g,"meters"),vertical:o(P,"meters")}}_geodesicDistance(e,t){const{spatialReference:i}=e,r=new p({spatialReference:i});r.addPath([e,t]);const s=i.isGeographic&&P(i)?y([r],"meters")[0]:i.isWebMercator?m(r,"meters"):null,n=null!=s?s:this._fallbackGeodesicDistance(e,t);return null!=n?o(n,"meters"):null}_fallbackGeodesicDistance(e,t){if(g(e,S)&&g(t,C)){const e=new D;return _(e,S,C,d.WGS84),e.distance}return null}};e([n()],b.prototype,"view",void 0),e([n()],b.prototype,"analysis",void 0),e([n()],b.prototype,"viewData",void 0),e([n()],b.prototype,"_computedResult",null),b=e([a("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController")],b);const S=c(),C=c();export{b as DirectLineMeasurementController};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{createLength as o}from"../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{q as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicLength as m}from"../../../../geometry/geometryEngine.js";import p from"../../../../geometry/Polyline.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import d from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as h,SphericalECEFSpatialReference as f,WGS84ECEFSpatialReference as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectPointToVector as j}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isSupported as P,geodesicLengths as y,inverseGeodeticSolver as _,InverseGeodeticSolverResult as D}from"../../../../geometry/support/geodesicUtils.js";import{MeasurementMode as w}from"../interfaces.js";import{applyProjectionAndElevationAlignment as z,logFailedGeometryProjectionError as R}from"../support/projectionUtils.js";import{UnitNormalizer as A}from"../support/UnitNormalizer.js";import{geodesicDistanceThreshold as E}from"../../../support/geodesicMeasurementUtils.js";let b=class extends t{constructor(e){super(e),this._unitNormalizer=new A,this._tempStartPosition=c(),this._tempEndPosition=c(),this._tempCornerPosition=c()}initialize(){const e=this.view.spatialReference,t=h(e),i=t===f?v:t;this._sphericalPCPF=i;const o=u(e,i);this._unitNormalizer.spatialReference=o?i:e,this.addHandles([r((()=>({viewData:this.viewData,startPoint:this.analysis.startPoint})),(({viewData:e,startPoint:t})=>{e.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({viewData:this.viewData,endPoint:this.analysis.endPoint})),(({viewData:e,endPoint:t})=>{e.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(t)}),s),r((()=>({result:this._computedResult,viewData:this.viewData})),(({result:e,viewData:t})=>{t.result=e}),s)])}_applyProjectionAndElevationAlignment(e){if(null==e)return e;const{spatialReference:t,elevationProvider:o}=this.view,r=z(e,t,o);return r??(R(this.analysis,e.spatialReference,i.getLogger(this)),null)}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,measurementMode:i}=this.viewData;if(null==e||null==t)return null;const o=this._euclideanDistances(e,t),r=this._geodesicDistance(e,t);let s,n;switch(i){case w.Auto:n=null!=r?"geodesic":"euclidean",s=r??o.horizontal;break;case w.Geodesic:if(null==r)return null;n="geodesic",s=r;break;case w.Euclidean:n="euclidean",s=o.horizontal}return{mode:n,directDistance:o.direct,horizontalDistance:s,verticalDistance:o.vertical,distance:i===w.Euclidean||o.horizontal.value<=E?o.direct:r??o.horizontal}}_euclideanDistances(e,t){const i=e.clone();i.z=t.z;const r=this._tempStartPosition,s=this._tempEndPosition,n=this._tempCornerPosition,a=this.view.spatialReference,c=this._sphericalPCPF,m=u(a,c)?c:a;j(e,r,m),j(t,s,m),j(i,n,m);const p=l(r,s),d=l(n,s),h=Math.abs(t.z-e.z),f=e=>this._unitNormalizer.normalizeDistance(e),v=f(p),g=f(d),P=f(h);return{direct:o(v,"meters"),horizontal:o(g,"meters"),vertical:o(P,"meters")}}_geodesicDistance(e,t){const{spatialReference:i}=e,r=new p({spatialReference:i});r.addPath([e,t]);const s=i.isGeographic&&P(i)?y([r],"meters")[0]:i.isWebMercator?m(r,"meters"):null,n=null!=s?s:this._fallbackGeodesicDistance(e,t);return null!=n?o(n,"meters"):null}_fallbackGeodesicDistance(e,t){if(g(e,S)&&g(t,C)){const e=new D;return _(e,S,C,d.WGS84),e.distance}return null}};e([n()],b.prototype,"view",void 0),e([n()],b.prototype,"analysis",void 0),e([n()],b.prototype,"viewData",void 0),e([n()],b.prototype,"_computedResult",null),b=e([a("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController")],b);const S=c(),C=c();export{b as DirectLineMeasurementController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{getFeatureId as t}from"../../../../analysis/featureReferenceUtils.js";import n from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{initial as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h,p as m,f as v,n as f,h as _,g as b,m as y,y as C}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as P}from"../../../../geometry/projection.js";import{projectBoundingRect as O}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as S,containsPointObject as j,intersectsSegment as R}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as w,create as A}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as E}from"../../../../support/elevationInfoUtils.js";import{LineOfSightAnalysisResult as H}from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as V}from"../support/projectionUtils.js";import{StoreResults as x}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as D,hasLod as N,getIntersectedFeatureBSRadius as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as k}from"../../../support/Scheduler.js";import M from"../../../../geometry/Point.js";let U=class extends(i.EventedMixin(n)){constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new T,this._frameTask=z,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(k.LINE_OF_SIGHT_TOOL):z,this._intersector=new L({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;h(s,i),h(a,r);this._canCompute(t)?this._computeIntersection(e):this._interpolateIntersection(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_updateAdjustedPointsFromFeatures(e){const n=this.view,{sceneIntersectionHelper:o}=n,{inputPoints:i}=e,{observerAdjusted:r,observerFeatureId:s,targetFeatureId:a,targetAdjusted:l}=i;if(null==s&&null==a)return;const u=m(r,l),c=this._intersector.intersector,d=w(i.observer,i.target,q);c.options.store=x.ALL,o.intersectToolIntersectorRay(d,c);let p=null,g=null,h=null,v=null;for(const m of c.results.all){const e=D(m,this.view);if(null==e||null==m.distanceInRenderSpace)continue;const o=t(e);null!=o&&(null!=s&&o===s&&(null==p&&(p=this._getFeatureDistanceThreshold(m,n,u)),m.distanceInRenderSpace<p&&(h=m)),null!=a&&o===a&&(null==g&&(g=this._getFeatureDistanceThreshold(m,n,u)),null==v&&m.distanceInRenderSpace<u&&u-m.distanceInRenderSpace<g&&(v=m)))}null!=h&&h.getIntersectionPoint(r)&&(i.observerSurfaceNormal=h.getTransformedNormal(I())),null!=v&&v.getIntersectionPoint(l)&&(i.targetSurfaceNormal=v.getTransformedNormal(I()))}_getFeatureDistanceThreshold(e,t,n){if(N(e)){const o=G(e,t);if(null!=o)return Math.min(o*K,n)}return 1e-5*n}_adjustStartEndPositions(e){const t=this._screenPixelSize,n=this.view,{inputPoints:o}=e,{observer:i,observerSurfaceNormal:r,target:s,targetSurfaceNormal:a,observerAdjusted:l,targetAdjusted:u}=o,c=B;h(l,i),h(u,s),this._updateAdjustedPointsFromFeatures(e),null!=r?h(c,r):v(c,u,l);const d=t;f(c,c),_(c,c,Math.min(d,1)),b(l,l,c),null!=a?h(c,a):v(c,l,u);const p=n.state.camera.computeScreenPixelSizeAt(u);f(c,c),_(c,c,Math.min(p,1)),b(u,u,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=w(c,d,q);r.options.store=x.MIN,o.intersectToolIntersectorRay(p,r);const g=r.results.min,m=s.intersection,v=B;let f=!0;if(null!=g&&g.getIntersectionPoint(m)){h(t.originalIntersection,m),h(t.originalObserver,c),h(t.originalTarget,d),i.fromRenderCoords(m,v,n.spatialReference);const e=1-y(d,u)/y(c,u);f=y(l,m)>=e*y(l,u)}const _=new M(v,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:D(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new H({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:D(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_interpolateIntersection({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(h(s,a),o.isValid){const e=B,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,n=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,n,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==n)return V(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=this._getEffectiveElevationInfo(n,o),{absoluteZ:a,elevation:u}=E(n.x,n.y,n.z,this.view.spatialReference,this.view,s),c=n.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=I();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=t(i),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(h(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,n,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=n&&V(this.analysis,n.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=this._getEffectiveElevationInfo(o,i),{absoluteZ:c,elevation:d}=E(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=t(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add((()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:P(e.target.position,this.view.spatialReference)})),(({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)}),d)])}_connectComputationToObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver})),(({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())}),d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId})),(({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)}),d)}_connectComputationToCamera(e){return this._updatingHandles.add((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()}))}_connectComputationToSlicePlane(e){return this._updatingHandles.add((()=>this.view.slicePlane),(()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()}))}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=P(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=P(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(O(n,o,J,this.view.spatialReference),null!=s&&j(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&j(J,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&R(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:n})=>t(e,n)))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:I(),originalObserver:I(),originalTarget:I()}};return s([this._updatingHandles.add((()=>e.inputPoints),(()=>{t=u(t),t=o((async e=>{await c(this._frameTask.schedule((()=>this._computeResult(n)),e))}))}),{initial:!0,equals:()=>!1}),a((()=>t=u(t)))])}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some((t=>t.target===e))||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex((t=>t.target===e));this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add((()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:P(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null})),(({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)}),d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange((()=>this._computations),(e=>this._onComputationCollectionChange(e)),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange((()=>this.analysis.targets),(e=>this._onTargetCollectionChange(e)),{initial:!0,final:!0}),this._updatingHandles.add((()=>this.analysisViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)}))])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=B;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>Z}_getEffectiveElevationInfo(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};e([p({constructOnly:!0})],U.prototype,"analysis",void 0),e([p({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],U.prototype,"view",void 0),e([p()],U.prototype,"updating",null),e([p()],U.prototype,"priority",null),e([p()],U.prototype,"updateOnCameraChange",void 0),e([p()],U.prototype,"_computations",null),e([p()],U.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([p()],U.prototype,"_observerGroundOffsetRenderSpace",void 0),e([p()],U.prototype,"_effectiveObserverElevationMode",void 0),e([p()],U.prototype,"_observerFeatureId",void 0),e([p()],U.prototype,"_screenPixelSize",null),e([p({readOnly:!0})],U.prototype,"_updatingHandles",void 0),e([p()],U.prototype,"_frameTask",void 0),e([p()],U.prototype,"_isCameraDirty",null),U=e([g("esri.views.3d.analysis.LineOfSight.LineOfSightController")],U);const Z=.1,B=I(),q=A(),J=S(),K=.05;export{U as LineOfSightController};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{getFeatureId as t}from"../../../../analysis/featureReferenceUtils.js";import n from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{initial as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h,q as m,f as v,n as f,h as _,g as b,o as y,z as C}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as P}from"../../../../geometry/projection.js";import{projectBoundingRect as O}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as S,containsPointObject as j,intersectsSegment as R}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as w,create as A}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as E}from"../../../../support/elevationInfoUtils.js";import{LineOfSightAnalysisResult as H}from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as V}from"../support/projectionUtils.js";import{StoreResults as x}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as D,hasLod as N,getIntersectedFeatureBSRadius as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as k}from"../../../support/Scheduler.js";import M from"../../../../geometry/Point.js";let U=class extends(i.EventedMixin(n)){constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new T,this._frameTask=z,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(k.LINE_OF_SIGHT_TOOL):z,this._intersector=new L({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;h(s,i),h(a,r);this._canCompute(t)?this._computeIntersection(e):this._interpolateIntersection(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_updateAdjustedPointsFromFeatures(e){const n=this.view,{sceneIntersectionHelper:o}=n,{inputPoints:i}=e,{observerAdjusted:r,observerFeatureId:s,targetFeatureId:a,targetAdjusted:l}=i;if(null==s&&null==a)return;const u=m(r,l),c=this._intersector.intersector,d=w(i.observer,i.target,B);c.options.store=x.ALL,o.intersectToolIntersectorRay(d,c);let p=null,g=null,h=null,v=null;for(const m of c.results.all){const e=D(m,this.view);if(null==e||null==m.distanceInRenderSpace)continue;const o=t(e);null!=o&&(null!=s&&o===s&&(null==p&&(p=this._getFeatureDistanceThreshold(m,n,u)),m.distanceInRenderSpace<p&&(h=m)),null!=a&&o===a&&(null==g&&(g=this._getFeatureDistanceThreshold(m,n,u)),null==v&&m.distanceInRenderSpace<u&&u-m.distanceInRenderSpace<g&&(v=m)))}null!=h&&h.getIntersectionPoint(r)&&(i.observerSurfaceNormal=h.getTransformedNormal(I())),null!=v&&v.getIntersectionPoint(l)&&(i.targetSurfaceNormal=v.getTransformedNormal(I()))}_getFeatureDistanceThreshold(e,t,n){if(N(e)){const o=G(e,t);if(null!=o)return Math.min(o*K,n)}return 1e-5*n}_adjustStartEndPositions(e){const t=this._screenPixelSize,n=this.view,{inputPoints:o}=e,{observer:i,observerSurfaceNormal:r,target:s,targetSurfaceNormal:a,observerAdjusted:l,targetAdjusted:u}=o,c=q;h(l,i),h(u,s),this._updateAdjustedPointsFromFeatures(e),null!=r?h(c,r):v(c,u,l);const d=t;f(c,c),_(c,c,Math.min(d,1)),b(l,l,c),null!=a?h(c,a):v(c,l,u);const p=n.state.camera.computeScreenPixelSizeAt(u);f(c,c),_(c,c,Math.min(p,1)),b(u,u,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=w(c,d,B);r.options.store=x.MIN,o.intersectToolIntersectorRay(p,r);const g=r.results.min,m=s.intersection,v=q;let f=!0;if(null!=g&&g.getIntersectionPoint(m)){h(t.originalIntersection,m),h(t.originalObserver,c),h(t.originalTarget,d),i.fromRenderCoords(m,v,n.spatialReference);const e=1-y(d,u)/y(c,u);f=y(l,m)>=e*y(l,u)}const _=new M(v,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:D(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new H({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:D(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_interpolateIntersection({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(h(s,a),o.isValid){const e=q,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,n=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,n,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==n)return V(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=this._getEffectiveElevationInfo(n,o),{absoluteZ:a,elevation:u}=E(n.x,n.y,n.z,this.view.spatialReference,this.view,s),c=n.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=I();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=t(i),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(h(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,n,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=n&&V(this.analysis,n.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=this._getEffectiveElevationInfo(o,i),{absoluteZ:c,elevation:d}=E(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=t(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add((()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:P(e.target.position,this.view.spatialReference)})),(({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)}),d)])}_connectComputationToObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver})),(({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())}),d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId})),(({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)}),d)}_connectComputationToCamera(e){return this._updatingHandles.add((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()}))}_connectComputationToSlicePlane(e){return this._updatingHandles.add((()=>this.view.slicePlane),(()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()}))}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=P(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=P(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(O(n,o,J,this.view.spatialReference),null!=s&&j(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&j(J,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&R(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:n})=>t(e,n)))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:I(),originalObserver:I(),originalTarget:I()}};return s([this._updatingHandles.add((()=>e.inputPoints),(()=>{t=u(t),t=o((async e=>{await c(this._frameTask.schedule((()=>this._computeResult(n)),e))}))}),{initial:!0,equals:()=>!1}),a((()=>t=u(t)))])}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some((t=>t.target===e))||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex((t=>t.target===e));this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add((()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:P(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null})),(({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)}),d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange((()=>this._computations),(e=>this._onComputationCollectionChange(e)),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange((()=>this.analysis.targets),(e=>this._onTargetCollectionChange(e)),{initial:!0,final:!0}),this._updatingHandles.add((()=>this.analysisViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)}))])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=q;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>Z}_getEffectiveElevationInfo(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};e([p({constructOnly:!0})],U.prototype,"analysis",void 0),e([p({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],U.prototype,"view",void 0),e([p()],U.prototype,"updating",null),e([p()],U.prototype,"priority",null),e([p()],U.prototype,"updateOnCameraChange",void 0),e([p()],U.prototype,"_computations",null),e([p()],U.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([p()],U.prototype,"_observerGroundOffsetRenderSpace",void 0),e([p()],U.prototype,"_effectiveObserverElevationMode",void 0),e([p()],U.prototype,"_observerFeatureId",void 0),e([p()],U.prototype,"_screenPixelSize",null),e([p({readOnly:!0})],U.prototype,"_updatingHandles",void 0),e([p()],U.prototype,"_frameTask",void 0),e([p()],U.prototype,"_isCameraDirty",null),U=e([g("esri.views.3d.analysis.LineOfSight.LineOfSightController")],U);const Z=.1,q=I(),B=A(),J=S(),K=.05;export{U as LineOfSightController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import o from"../../../../core/Accessor.js";import{equals as t}from"../../../../core/arrayUtils.js";import{clone as s}from"../../../../core/lang.js";import{equalsMaybe as i}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{F as n}from"../../../../chunks/vec32.js";import{clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as a}from"../../../../geometry/support/ray.js";var m;let y=m=class extends o{constructor(r){super(r)}clone(){return new m({type:this.type,id:s(this.id),mapPoint:s(this.mapPoint),renderPoint:c(this.renderPoint),normal:s(this.normal),ray:s(this.ray),graphic:this.graphic})}equals(r){return this.type===r.type&&this.id===r.id&&i(this.mapPoint,r.mapPoint)&&n(this.renderPoint,r.renderPoint)&&t(this.normal,r.normal)&&a(this.ray,r.ray)&&this.graphic===r.graphic}};r([e()],y.prototype,"type",void 0),r([e({constructOnly:!0})],y.prototype,"id",void 0),r([e({constructOnly:!0})],y.prototype,"mapPoint",void 0),r([e({constructOnly:!0})],y.prototype,"renderPoint",void 0),r([e({constructOnly:!0})],y.prototype,"normal",void 0),r([e({constructOnly:!0})],y.prototype,"graphic",void 0),r([e({constructOnly:!0})],y.prototype,"ray",void 0),y=m=r([p("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],y);export{y as LineOfSightIntersectionResult};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import o from"../../../../core/Accessor.js";import{equals as t}from"../../../../core/arrayUtils.js";import{clone as s}from"../../../../core/lang.js";import{equalsMaybe as i}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as n}from"../../../../chunks/vec32.js";import{clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as a}from"../../../../geometry/support/ray.js";var m;let y=m=class extends o{constructor(r){super(r)}clone(){return new m({type:this.type,id:s(this.id),mapPoint:s(this.mapPoint),renderPoint:c(this.renderPoint),normal:s(this.normal),ray:s(this.ray),graphic:this.graphic})}equals(r){return this.type===r.type&&this.id===r.id&&i(this.mapPoint,r.mapPoint)&&n(this.renderPoint,r.renderPoint)&&t(this.normal,r.normal)&&a(this.ray,r.ray)&&this.graphic===r.graphic}};r([e()],y.prototype,"type",void 0),r([e({constructOnly:!0})],y.prototype,"id",void 0),r([e({constructOnly:!0})],y.prototype,"mapPoint",void 0),r([e({constructOnly:!0})],y.prototype,"renderPoint",void 0),r([e({constructOnly:!0})],y.prototype,"normal",void 0),r([e({constructOnly:!0})],y.prototype,"graphic",void 0),r([e({constructOnly:!0})],y.prototype,"ray",void 0),y=m=r([p("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],y);export{y as LineOfSightIntersectionResult};