@arcgis/core 6.0.0-next.53 → 6.0.0-next.55

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 (300) hide show
  1. package/WebScene.js +2 -2
  2. package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/featureset/support/sqlUtils.js +1 -1
  8. package/arcade/validation/arcadeValidator.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
  13. package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 14259910f44c08fd5bbd.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
  16. package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
  17. package/assets/esri/core/workers/chunks/{e507dfc4788295d9c244.js → 249a687ce1b6d0815242.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
  21. package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → 4401b3f8ebb658abe789.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
  25. package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
  26. package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e83806797979138fd22a.js → 844c593754b2692257f4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{2d3e977f3b75474d7ebc.js → 846248697c398468d8e6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{032733b863426c5bde00.js → 9e508f930086d2ef5f22.js} +3 -3
  31. package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{817bf487df056da1e6ec.js → a116dd204921e7464944.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
  38. package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → be0b8bb4f09aae6ff5de.js} +1 -1
  41. package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
  42. package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → e61082f56c08abe54b3a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
  47. package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
  48. package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
  50. package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
  51. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  52. package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
  53. package/chunks/CypherParser.js +1 -1
  54. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  55. package/chunks/MultiPathImpl.js +1 -1
  56. package/chunks/OperatorGeodesicBuffer.js +1 -1
  57. package/chunks/UnitFactory.js +1 -1
  58. package/chunks/blosc-wasm.js +2 -0
  59. package/chunks/cameraUtilsSpherical.js +1 -1
  60. package/chunks/parquet.js +1 -1
  61. package/chunks/text.js +1 -1
  62. package/config.js +1 -1
  63. package/core/sql/SqlInterval.js +1 -1
  64. package/core/urlUtils.js +1 -1
  65. package/geometry/geometryEngine.js +1 -1
  66. package/geometry/operators/gx/operatorOffset.js +1 -1
  67. package/geometry/support/Ellipsoid.js +1 -1
  68. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  69. package/geometry/support/geodesicConstants.js +1 -1
  70. package/geometry/support/meshUtils/primitives.js +1 -1
  71. package/kernel.js +1 -1
  72. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  73. package/layers/VoxelWasmPerSceneView.js +1 -1
  74. package/layers/effects/parser.js +1 -1
  75. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  76. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  77. package/layers/graphics/data/QueryEngineResult.js +1 -1
  78. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  79. package/layers/parquet.js +1 -1
  80. package/layers/raster/datasets/ZarrRaster.js +1 -1
  81. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  82. package/layers/raster/formats/RasterCodec.js +1 -1
  83. package/layers/raster/formats/blosc.js +2 -0
  84. package/layers/support/BuildingFilter.js +1 -1
  85. package/layers/support/IntegratedMeshSemantics.js +1 -1
  86. package/layers/support/fieldUtils.d.ts +23 -87
  87. package/layers/support/fieldUtils.js +1 -1
  88. package/layers/support/layersMapping.js +1 -1
  89. package/layers/video/VideoController.js +1 -1
  90. package/legend/ActiveLayerInfo.js +1 -1
  91. package/libs/ajv/ajv.bundle-wrapper.js +1 -1
  92. package/package.json +4 -4
  93. package/renderers/types.d.ts +1 -1
  94. package/rest/knowledgeGraphService.js +1 -1
  95. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  96. package/smartMapping/statistics/support/attributeDensity.js +1 -1
  97. package/smartMapping/support/adapters/support/utils.js +1 -1
  98. package/support/tests/serviceMockDependencies.js +1 -1
  99. package/symbols/cim/CIMEffects.js +1 -1
  100. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  101. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  102. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  103. package/symbols/cim/rasterizingUtils.js +1 -1
  104. package/views/2d/PaddedViewState.js +1 -1
  105. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  106. package/views/2d/engine/vectorTiles/constants.js +1 -1
  107. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
  108. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  109. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  110. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  113. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  114. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  115. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  116. package/views/2d/layers/ParquetLayerView2D.js +1 -1
  117. package/views/2d/layers/features/Processor.js +1 -1
  118. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  119. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  121. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  122. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  123. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  124. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  125. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  128. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  129. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  130. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  131. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
  132. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  133. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  134. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  135. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  136. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
  137. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  138. package/views/3d/camera/constraintUtils.js +1 -1
  139. package/views/3d/camera/intersectionUtils.js +1 -1
  140. package/views/3d/environment/EnvironmentView.js +1 -1
  141. package/views/3d/focusAreaUtils.js +1 -1
  142. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  143. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  144. package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
  145. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  146. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  147. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  148. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  149. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  150. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  151. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  152. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  153. package/views/3d/layers/I3SMeshView3D.js +1 -1
  154. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  155. package/views/3d/layers/TiledLayerView3D.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
  164. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  165. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  166. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  167. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  168. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  169. package/views/3d/layers/i3s/I3SNode.js +1 -1
  170. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  171. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  172. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  173. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  174. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  175. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  176. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  177. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  178. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
  179. package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
  180. package/views/3d/layers/support/uvUtils.js +1 -1
  181. package/views/3d/state/Constraints.js +1 -1
  182. package/views/3d/state/ConstraintsManager.js +1 -1
  183. package/views/3d/state/NearFarHeuristic.js +1 -1
  184. package/views/3d/state/ViewState.js +1 -1
  185. package/views/3d/state/ViewStateManager.js +1 -1
  186. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  187. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  188. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  189. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  190. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  191. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  192. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  193. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  194. package/views/3d/state/utils/navigationUtils.js +1 -1
  195. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  196. package/views/3d/support/RenderCoordsHelper.js +1 -1
  197. package/views/3d/support/SweptSphereVolume.js +1 -1
  198. package/views/3d/support/cameraUtils.js +1 -1
  199. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  200. package/views/3d/support/engineContent/line.js +1 -1
  201. package/views/3d/support/engineContent/marker.js +1 -1
  202. package/views/3d/support/hitTest.js +1 -1
  203. package/views/3d/support/orientedBoundingBox.js +1 -1
  204. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  205. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  206. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  207. package/views/3d/support/sunUtils.js +1 -1
  208. package/views/3d/terrain/ExtentHelper.js +1 -1
  209. package/views/3d/terrain/OverlayManager.js +1 -1
  210. package/views/3d/terrain/OverlayRenderer.js +1 -1
  211. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/Tile.js +1 -1
  215. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  216. package/views/3d/terrain/terrainUtils.js +1 -1
  217. package/views/3d/webgl/RenderCamera.js +1 -1
  218. package/views/3d/webgl-engine/Stage.js +1 -1
  219. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  220. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  222. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  223. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  225. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  228. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  229. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  230. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  231. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  232. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  233. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  234. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  235. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  236. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  237. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  238. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  239. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  240. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  241. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  242. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  243. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  244. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  245. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  246. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  247. package/views/MapView.d.ts +1 -0
  248. package/views/SceneView.js +1 -1
  249. package/views/View2D.js +1 -1
  250. package/views/ViewingMode.js +1 -1
  251. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  252. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  253. package/views/draw/DrawAction.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/DrawTool.js +1 -1
  256. package/views/draw/SegmentDrawAction.js +1 -1
  257. package/views/draw/support/Reshape.js +1 -1
  258. package/views/draw/support/helpMessageUtils.js +1 -1
  259. package/views/draw/support/managers/EditSessionManager.js +1 -1
  260. package/views/interactive/dragEventPipeline.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
  264. package/views/layers/support/editableLayerViews.js +1 -1
  265. package/views/overlay/TextOverlayItem.js +1 -1
  266. package/views/support/DefaultsFromMap.js +1 -1
  267. package/views/support/Scheduler.js +1 -1
  268. package/views/support/spatialReferenceSupport.js +1 -1
  269. package/views/webgl/ShaderTranspiler.js +2 -2
  270. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  271. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  272. package/widgets/BatchAttributeForm.js +1 -1
  273. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  274. package/widgets/Editor/workflowUtils.js +1 -1
  275. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  276. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  277. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  278. package/widgets/FeatureForm.js +1 -1
  279. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  280. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  281. package/widgets/Measurement.js +1 -1
  282. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  283. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  284. package/widgets/Search/support/layerSearchUtils.js +1 -1
  285. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  286. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  287. package/widgets/UtilityNetworkAssociations.js +1 -1
  288. package/widgets/Weather/WeatherViewModel.js +1 -1
  289. package/widgets/Weather/css.js +1 -1
  290. package/widgets/Weather.js +1 -1
  291. package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
  292. package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
  293. package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
  294. package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
  295. package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
  296. package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
  297. package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
  298. package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
  299. package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
  300. package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{EventedAccessor as o}from"../../../../core/Evented.js";import s from"../../../../core/Handles.js";import{handlesGroup as c,makeHandle as l}from"../../../../core/handleUtils.js";import{copy as u,subtract as d,normalize as f,scale as p,add as m,dist as h,sub as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../core/Logger.js";import{abortMaybe as y}from"../../../../core/maybe.js";import{ignoreAbortErrors as b}from"../../../../core/promiseUtils.js";import{initial as x,on as S}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Point.js";import{projectOrLoad as T}from"../../../../geometry/projectionUtils.js";import{intersectsSegment as E}from"../../../../geometry/support/aaBoundingBox.js";import{empty as D,intersectsSegment as O}from"../../../../geometry/support/aaBoundingRect.js";import{create as k,fromPoints as A}from"../../../../geometry/support/ray.js";import{getInfo as j}from"../../../../geometry/support/spatialReferenceUtils.js";import{zValueInAbsoluteHeightMode as M}from"../../../../support/elevationInfoUtils.js";import{ImmediateTask as N,TaskPriority as P}from"../../../support/Scheduler.js";import{projectElevationUpdateExtent as F,containsElevationUpdatePoint as I}from"../../support/elevationUpdateExtentUtils.js";import{toGraphic as L}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import R from"../LineOfSightAnalysisResult.js";import{logFailedGeometryProjectionError as z}from"../support/projectionUtils.js";import{LineOfSightComputation as B}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as V}from"./LineOfSightRayIntersector.js";let H=class extends o{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode=`absolute-height`,this._observerFeatureId=null,this._updatingHandles=new C,this._frameTask=N,this._computationHandles=new s,this._externalObserverUpdate=!0}initialize(){let e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(P.LINE_OF_SIGHT_TOOL):N,this._intersector=new V({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){let t=e.computation,{inputPoints:n,computationResult:r}=t,{observerAdjusted:i,targetAdjusted:a}=n,{start:o,end:s}=r;u(o,i),u(s,a),this._canCompute(t)?this._computeIntersection(e):G(e),t.notifyResultChanged(),this.emit(`result-changed`,{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){let{view:n}=this,{inputPoints:r}=e,{observer:i,target:a,observerAdjusted:o,targetAdjusted:s}=r;u(o,i),u(s,a),t(n,this._intersector.intersector,r);let{observerSurfaceNormal:c,targetSurfaceNormal:l}=r,h=this._screenPixelSize,g=q;c==null?d(g,s,o):u(g,c);let _=h;f(g,g),p(g,g,Math.min(_,1)),m(o,o,g),l==null?d(g,o,s):u(g,l);let v=n.state.camera.computeScreenPixelSizeAt(s);f(g,g),p(g,g,Math.min(v,1)),m(s,s,g)}_computeIntersection({computation:e,interpolationInfo:t}){let{view:n}=this,{sceneIntersectionHelper:r,renderCoordsHelper:i}=n;if(r==null)return;let a=this._intersector.intersector,{computationResult:o,inputPoints:s}=e,{observer:c,target:l}=s,{start:d,end:f}=o,p=A(d,f,J);a.options.store=0,r.intersectToolIntersectorRay(p,a);let m=a.results.min,g=o.intersection,_=q,v=m!=null&&m.getIntersectionPoint(g),y=!0;if(v){u(t.originalIntersection,g),u(t.originalObserver,d),u(t.originalTarget,f),i.fromRenderCoords(g,_,n.spatialReference);let e=1-h(f,l)/h(d,l);y=h(c,g)>=e*h(c,l)}let b=new w({x:_[0],y:_[1],z:_[2],m:_[3],spatialReference:n.spatialReference});{let{result:t,target:r}=e;t==null?e.result=new R({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:y?null:L(m,n),intersectedLocation:y?null:b,visible:y}):(t.target=r,t.intersectedGraphic=y?null:L(m,n),t.intersectedLocation=y?null:b,t.visible=y)}o.isValid=s.isValid=!0,o.isTargetVisible=y}_canCompute(e){let t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(t==null||e.elevationAlignedTargetLocation==null||n==null)return!1;let{observerAdjusted:r,targetAdjusted:i}=e.inputPoints,a=n.intersectsPoint(r),o=n.intersectsPoint(i);return a&&o}_onObserverPositionChange(e,t,r,i,a){if(this._externalObserverUpdate=a,e==null){this.analysisViewData.elevationAlignedObserver=null,this._observerFeatureId=null;return}if(t==null){z(this.analysis,e.spatialReference,v.getLogger(this)),this.analysisViewData.elevationAlignedObserver=null;return}let o=U(t,r),{absoluteZ:s,elevation:c}=M(t.x,t.y,t.z,this.view.spatialReference,this.view,o),l=t.clone();l.z=s,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=l;let u=_();this.view.renderCoordsHelper.toRenderCoords(l,u),this._elevationAlignedObserverPositionRenderSpace=u,this._observerGroundOffsetRenderSpace=s-c,this._observerFeatureId=n(i),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i){let{inputPoints:a}=e;switch(u(a.observer,t),a.observerFeatureId=i,a.observerSurfaceNormal=null,r){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(a.observer,n,a.observer);a.observerFeatureId??(a.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,r,i,a,o=!0){let s=e.inputPoints;if(o&&(s.isValid=!1),r==null){t!=null&&z(this.analysis,t.spatialReference,v.getLogger(this)),e.elevationAlignedTargetLocation=null,e.notifyInputPointsChanged();return}let c=U(r,i),{absoluteZ:l,elevation:u}=M(r.x,r.y,r.z,this.view.spatialReference,this.view,c),d=r.clone();switch(d.z=l,e.elevationAlignedTargetLocation=d,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,s.target),s.targetFeatureId=n(a),s.targetSurfaceNormal=null,c.mode){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(s.target,l-u,s.target);s.targetFeatureId??(s.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return c([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfoDependency:W(e.target.elevationInfo),targetFeatureInfo:e.target.feature,projectedTargetPosition:T(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetFeatureInfo:n,projectedTargetPosition:r})=>{r.pending==null?this._onTargetPositionChange(e,t,r.geometry,e.target.elevationInfo,n):this._updatingHandles.consumePromise(r.pending)},x)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},x)}_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:r,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i)},x)}_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.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){let t=(n,r)=>{let i=this.analysis.observer,a=e.target,o=null,s=null,c=null,l=null,u=null,d=null;if(i?.position!=null){let e=T(i.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}o=e.geometry,s=i.elevationInfo,c=i.feature}if(a.position!=null){let e=T(a.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}l=e.geometry,u=a.elevationInfo,d=a.feature}if(o==null&&l==null)return;F(n,r,Y,this.view.spatialReference),o!=null&&I(Y,o.x,o.y,this.view.spatialReference)&&this._onObserverPositionChange(i==null?null:i.position,o,s,c,!1),l!=null&&I(Y,l.x,l.y,this.view.spatialReference)&&this._onTargetPositionChange(e,a.position,l,u,d,!1);let f=!1,p=this.view.state.viewingMode===1?j(this.view.spatialReference)?.valid:null;if(o!=null&&l!=null&&p!=null){let e=p[1]-p[0];if(X.x=l.x+Math.round((o.x-l.x)/e)*e,X.y=l.y,l=X,Y[2]-Y[0]>=e)Y[0]=Math.min(Y[0],o.x,l.x),Y[2]=Math.max(Y[2],o.x,l.x);else{let t=Math.round((o.x+l.x-Y[0]-Y[2])/(2*e))*e;t!==0&&(f=O(Y,o,l),Y[0]+=t,Y[2]+=t)}}o!=null&&l!=null&&(f||O(Y,o,l))&&e.notifyInputPointsChanged()};return this.view.elevationProvider.on(`elevation-change`,({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null,n={computation:e,interpolationInfo:{originalIntersection:_(),originalObserver:_(),originalTarget:_()}};return c([this._updatingHandles.add(()=>e.inputPoints,()=>{t=y(t),t=a(async e=>{await b(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),l(()=>t=y(t))])}_connectComputationToContent(e){return S(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,`request-update`,t=>{let n=t?.renderBounds,{observerAdjusted:r,targetAdjusted:i}=e.inputPoints;(n==null||E(n,r,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){let 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),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(let e of t)this._disconnectComputation(e);for(let t of e)this._connectComputation(t)}_onTargetCollectionChange({added:e,removed:t}){for(let e of t)this._removeTarget(e);for(let t of e)this._addTarget(t)}_onCursorTargetChange(e,t){t!=null&&this._removeTarget(t),e!=null&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new B({target:e}))}_removeTarget(e){let t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return c([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer==null?null:this.analysis.observer.position,projectedObserverPosition:T(this.analysis.observer==null?null:this.analysis.observer.position,this.view.spatialReference),observerElevationInfoDependency:W(this.analysis.observer?.elevationInfo),observerFeatureInfo:this.analysis.observer==null?null:this.analysis.observer.feature}),({observerPosition:e,projectedObserverPosition:t,observerFeatureInfo:n})=>{t.pending==null?this._onObserverPositionChange(e,t.geometry,this.analysis.observer?.elevationInfo,n,!0):this._updatingHandles.consumePromise(t.pending)},x)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return c([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(){let e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(e==null)return!1;let r=q;n.toRenderCoords(e,r);let i=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>K}};e([r({constructOnly:!0})],H.prototype,`analysis`,void 0),e([r({constructOnly:!0})],H.prototype,`analysisViewData`,void 0),e([r({constructOnly:!0})],H.prototype,`view`,void 0),e([r()],H.prototype,`updating`,null),e([r()],H.prototype,`priority`,null),e([r()],H.prototype,`updateOnCameraChange`,void 0),e([r()],H.prototype,`_computations`,null),e([r()],H.prototype,`_elevationAlignedObserverPositionRenderSpace`,null),e([r()],H.prototype,`_observerGroundOffsetRenderSpace`,void 0),e([r()],H.prototype,`_effectiveObserverElevationMode`,void 0),e([r()],H.prototype,`_observerFeatureId`,void 0),e([r()],H.prototype,`_screenPixelSize`,null),e([r({readOnly:!0})],H.prototype,`_updatingHandles`,void 0),e([r()],H.prototype,`_frameTask`,void 0),e([r()],H.prototype,`_isCameraDirty`,null),H=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightController`)],H);function U(e,t){return e.hasZ?t??{mode:`absolute-height`,offset:0}:{mode:`on-the-ground`,offset:0}}function W(e){return{mode:e?.mode,offset:e?.offset,unit:e?.unit}}function G({computation:e,interpolationInfo:t}){let{computationResult:n,inputPoints:r}=e,{start:i,end:a,intersection:o}=n,{originalIntersection:s,originalObserver:c,originalTarget:l}=t;if(u(o,s),r.isValid){let e=q,t=h(c,s)/h(c,l);g(e,i,c),p(e,e,1-t),m(o,o,e),g(e,a,l),p(e,e,t),m(o,o,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}const K=.1,q=_(),J=k(),Y=D(),X=new w;export{H as LineOfSightController};
2
+ import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{EventedAccessor as o}from"../../../../core/Evented.js";import s from"../../../../core/Handles.js";import{handlesGroup as c,makeHandle as l}from"../../../../core/handleUtils.js";import{copy as u,subtract as d,normalize as f,scale as p,add as m,dist as h,sub as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../core/Logger.js";import{abortMaybe as y}from"../../../../core/maybe.js";import{ignoreAbortErrors as b}from"../../../../core/promiseUtils.js";import{initial as x,on as S}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Point.js";import{projectOrLoad as T}from"../../../../geometry/projectionUtils.js";import{intersectsSegment as E}from"../../../../geometry/support/aaBoundingBox.js";import{empty as D,intersectsSegment as O}from"../../../../geometry/support/aaBoundingRect.js";import{create as k,fromPoints as A}from"../../../../geometry/support/ray.js";import{getInfo as j}from"../../../../geometry/support/spatialReferenceUtils.js";import{zValueInAbsoluteHeightMode as M}from"../../../../support/elevationInfoUtils.js";import{ImmediateTask as N,TaskPriority as P}from"../../../support/Scheduler.js";import{projectElevationUpdateExtent as F,containsElevationUpdatePoint as I}from"../../support/elevationUpdateExtentUtils.js";import{toGraphic as L}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import R from"../LineOfSightAnalysisResult.js";import{logFailedGeometryProjectionError as z}from"../support/projectionUtils.js";import{LineOfSightComputation as B}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as V}from"./LineOfSightRayIntersector.js";let H=class extends o{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode=`absolute-height`,this._observerFeatureId=null,this._updatingHandles=new C,this._frameTask=N,this._computationHandles=new s,this._externalObserverUpdate=!0}initialize(){let e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(P.LINE_OF_SIGHT_TOOL):N,this._intersector=new V({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){let t=e.computation,{inputPoints:n,computationResult:r}=t,{observerAdjusted:i,targetAdjusted:a}=n,{start:o,end:s}=r;u(o,i),u(s,a),this._canCompute(t)?this._computeIntersection(e):G(e),t.notifyResultChanged(),this.emit(`result-changed`,{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){let{view:n}=this,{inputPoints:r}=e,{observer:i,target:a,observerAdjusted:o,targetAdjusted:s}=r;u(o,i),u(s,a),t(n,this._intersector.intersector,r);let{observerSurfaceNormal:c,targetSurfaceNormal:l}=r,h=this._screenPixelSize,g=q;c==null?d(g,s,o):u(g,c);let _=h;f(g,g),p(g,g,Math.min(_,1)),m(o,o,g),l==null?d(g,o,s):u(g,l);let v=n.state.camera.computeScreenPixelSizeAt(s);f(g,g),p(g,g,Math.min(v,1)),m(s,s,g)}_computeIntersection({computation:e,interpolationInfo:t}){let{view:n}=this,{sceneIntersectionHelper:r,renderCoordsHelper:i}=n;if(r==null)return;let a=this._intersector.intersector,{computationResult:o,inputPoints:s}=e,{observer:c,target:l}=s,{start:d,end:f}=o,p=A(d,f,J);a.options.store=0,r.intersectToolIntersectorRay(p,a);let m=a.results.min,g=o.intersection,_=q,v=m!=null&&m.getIntersectionPoint(g),y=!0;if(v){u(t.originalIntersection,g),u(t.originalObserver,d),u(t.originalTarget,f),i.fromRenderCoords(g,_,n.spatialReference);let e=1-h(f,l)/h(d,l);y=h(c,g)>=e*h(c,l)}let b=new w({x:_[0],y:_[1],z:_[2],m:_[3],spatialReference:n.spatialReference});{let{result:t,target:r}=e;t==null?e.result=new R({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:y?null:L(m,n),intersectedLocation:y?null:b,visible:y}):(t.target=r,t.intersectedGraphic=y?null:L(m,n),t.intersectedLocation=y?null:b,t.visible=y)}o.isValid=s.isValid=!0,o.isTargetVisible=y}_canCompute(e){let t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(t==null||e.elevationAlignedTargetLocation==null||n==null)return!1;let{observerAdjusted:r,targetAdjusted:i}=e.inputPoints,a=n.intersectsPoint(r),o=n.intersectsPoint(i);return a&&o}_onObserverPositionChange(e,t,r,i,a){if(this._externalObserverUpdate=a,e==null){this.analysisViewData.elevationAlignedObserver=null,this._observerFeatureId=null;return}if(t==null){z(this.analysis,e.spatialReference,v.getLogger(this)),this.analysisViewData.elevationAlignedObserver=null;return}let o=U(t,r),{absoluteZ:s,elevation:c}=M(t.x,t.y,t.z,this.view.spatialReference,this.view,o),l=t.clone();l.z=s,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=l;let u=_();this.view.renderCoordsHelper.toRenderCoords(l,u),this._elevationAlignedObserverPositionRenderSpace=u,this._observerGroundOffsetRenderSpace=s-c,this._observerFeatureId=n(i),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i){let{inputPoints:a}=e;switch(u(a.observer,t),a.observerFeatureId=i,a.observerSurfaceNormal=null,r){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(a.observer,n,a.observer);a.observerFeatureId??(a.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,r,i,a,o=!0){let s=e.inputPoints;if(o&&(s.isValid=!1),r==null){t!=null&&z(this.analysis,t.spatialReference,v.getLogger(this)),e.elevationAlignedTargetLocation=null,e.notifyInputPointsChanged();return}let c=U(r,i),{absoluteZ:l,elevation:u}=M(r.x,r.y,r.z,this.view.spatialReference,this.view,c),d=r.clone();switch(d.z=l,e.elevationAlignedTargetLocation=d,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,s.target),s.targetFeatureId=n(a),s.targetSurfaceNormal=null,c.mode){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(s.target,l-u,s.target);s.targetFeatureId??(s.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=P.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return c([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfoDependency:W(e.target.elevationInfo),targetFeatureInfo:e.target.feature,projectedTargetPosition:T(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetFeatureInfo:n,projectedTargetPosition:r})=>{r.pending==null?this._onTargetPositionChange(e,t,r.geometry,e.target.elevationInfo,n):this._updatingHandles.consumePromise(r.pending)},x)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},x)}_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:r,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i)},x)}_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.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){let t=(n,r)=>{let i=this.analysis.observer,a=e.target,o=null,s=null,c=null,l=null,u=null,d=null;if(i?.position!=null){let e=T(i.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}o=e.geometry,s=i.elevationInfo,c=i.feature}if(a.position!=null){let e=T(a.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}l=e.geometry,u=a.elevationInfo,d=a.feature}if(o==null&&l==null)return;F(n,r,Y,this.view.spatialReference),o!=null&&I(Y,o.x,o.y,this.view.spatialReference)&&this._onObserverPositionChange(i==null?null:i.position,o,s,c,!1),l!=null&&I(Y,l.x,l.y,this.view.spatialReference)&&this._onTargetPositionChange(e,a.position,l,u,d,!1);let f=!1,p=this.view.state.isGlobal?j(this.view.spatialReference)?.valid:null;if(o!=null&&l!=null&&p!=null){let e=p[1]-p[0];if(X.x=l.x+Math.round((o.x-l.x)/e)*e,X.y=l.y,l=X,Y[2]-Y[0]>=e)Y[0]=Math.min(Y[0],o.x,l.x),Y[2]=Math.max(Y[2],o.x,l.x);else{let t=Math.round((o.x+l.x-Y[0]-Y[2])/(2*e))*e;t!==0&&(f=O(Y,o,l),Y[0]+=t,Y[2]+=t)}}o!=null&&l!=null&&(f||O(Y,o,l))&&e.notifyInputPointsChanged()};return this.view.elevationProvider.on(`elevation-change`,({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null,n={computation:e,interpolationInfo:{originalIntersection:_(),originalObserver:_(),originalTarget:_()}};return c([this._updatingHandles.add(()=>e.inputPoints,()=>{t=y(t),t=a(async e=>{await b(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),l(()=>t=y(t))])}_connectComputationToContent(e){return S(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,`request-update`,t=>{let n=t?.renderBounds,{observerAdjusted:r,targetAdjusted:i}=e.inputPoints;(n==null||E(n,r,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){let 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),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(let e of t)this._disconnectComputation(e);for(let t of e)this._connectComputation(t)}_onTargetCollectionChange({added:e,removed:t}){for(let e of t)this._removeTarget(e);for(let t of e)this._addTarget(t)}_onCursorTargetChange(e,t){t!=null&&this._removeTarget(t),e!=null&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new B({target:e}))}_removeTarget(e){let t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return c([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer==null?null:this.analysis.observer.position,projectedObserverPosition:T(this.analysis.observer==null?null:this.analysis.observer.position,this.view.spatialReference),observerElevationInfoDependency:W(this.analysis.observer?.elevationInfo),observerFeatureInfo:this.analysis.observer==null?null:this.analysis.observer.feature}),({observerPosition:e,projectedObserverPosition:t,observerFeatureInfo:n})=>{t.pending==null?this._onObserverPositionChange(e,t.geometry,this.analysis.observer?.elevationInfo,n,!0):this._updatingHandles.consumePromise(t.pending)},x)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return c([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(){let e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(e==null)return!1;let r=q;n.toRenderCoords(e,r);let i=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>K}};e([r({constructOnly:!0})],H.prototype,`analysis`,void 0),e([r({constructOnly:!0})],H.prototype,`analysisViewData`,void 0),e([r({constructOnly:!0})],H.prototype,`view`,void 0),e([r()],H.prototype,`updating`,null),e([r()],H.prototype,`priority`,null),e([r()],H.prototype,`updateOnCameraChange`,void 0),e([r()],H.prototype,`_computations`,null),e([r()],H.prototype,`_elevationAlignedObserverPositionRenderSpace`,null),e([r()],H.prototype,`_observerGroundOffsetRenderSpace`,void 0),e([r()],H.prototype,`_effectiveObserverElevationMode`,void 0),e([r()],H.prototype,`_observerFeatureId`,void 0),e([r()],H.prototype,`_screenPixelSize`,null),e([r({readOnly:!0})],H.prototype,`_updatingHandles`,void 0),e([r()],H.prototype,`_frameTask`,void 0),e([r()],H.prototype,`_isCameraDirty`,null),H=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightController`)],H);function U(e,t){return e.hasZ?t??{mode:`absolute-height`,offset:0}:{mode:`on-the-ground`,offset:0}}function W(e){return{mode:e?.mode,offset:e?.offset,unit:e?.unit}}function G({computation:e,interpolationInfo:t}){let{computationResult:n,inputPoints:r}=e,{start:i,end:a,intersection:o}=n,{originalIntersection:s,originalObserver:c,originalTarget:l}=t;if(u(o,s),r.isValid){let e=q,t=h(c,s)/h(c,l);g(e,i,c),p(e,e,1-t),m(o,o,e),g(e,a,l),p(e,e,t),m(o,o,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}const K=.1,q=_(),J=k(),Y=D(),X=new w;export{H as LineOfSightController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{getGeometryEffectiveElevationInfo as s}from"../../../../support/elevationInfoUtils.js";import{EditGeometryOperations as c}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{convertLineOfSightElevationMode as l,snapshotLineOfSightObserverState as u,snapshotLineOfSightTargetState as d,restoreLineOfSightObserverState as f,restoreLineOfSightTargetState as p,updateLineOfSightItemFromAuthoredPoint as m}from"./LineOfSightAuthoringUtils.js";const h=Symbol(`line-of-sight-item-operations`);let g=class extends r{constructor(e){super(e),this._operations=null,this._dragIntersectionContext=null,this._syncSource=null}initialize(){this.addHandles([a(()=>{let{elevationInfo:e,feature:t,position:n}=this.item;return{elevationInfo:e,elevationMode:e?.mode,elevationOffset:e?.offset,elevationUnit:e?.unit,feature:t,position:n,positionCoordinates:n?.toArray(),spatialReference:n?.spatialReference}},()=>this._syncOperationsFromItem(),o),a(()=>{let{origin:e}=this;return{origin:e,originCoordinates:e?.toArray(),spatialReference:e?.spatialReference}},()=>this.emit(`committed`),o)])}destroy(){this.removeHandles(h),this._operations=i(this._operations),this._dragIntersectionContext=null}get operations(){return this._operations}get elevationInfo(){let{position:e,elevationInfo:t}=this.item;return s(e,t)}get visible(){return this.analysisViewData.visible&&this.origin!=null}get isDraped(){return this.elevationInfo.mode===`on-the-ground`}get origin(){return this.item.type===`observer`?this.analysisViewData.elevationAlignedObserver:this.analysisViewData.computations.find(e=>e.target===this.item)?.elevationAlignedTargetLocation??null}get updating(){return!1}toMap(e){return this.intersector.getScreenPointIntersection(e)?.mapPoint}createUndoRecord(){let e=this._snapshotState(),t=null;return{undo:()=>{t=this._snapshotState(),this._restoreSnapshot(e)},redo:()=>{t!=null&&(e=this._snapshotState(),this._restoreSnapshot(t))}}}setElevationMode(e){let{position:t,elevationInfo:n}=this.item;if(t==null||e===this.elevationInfo.mode)return null;let r=l({view:this.view,point:t,sourceElevationInfo:n,mode:e,preserveZ:!0}),i=this.createUndoRecord();this._syncSource=`operations`;try{this.item.elevationInfo=r.elevationInfo,this.item.position=r.position}finally{this._syncSource=null}return this._syncOperationsFromItem(!1),i}updateDragIntersection(e){this._dragIntersectionContext=e.action===`cancel`?null:{dragging:e.action!==`end`,intersection:this.intersector.getScreenPointIntersection(e.screenPoint)}}_snapshotState(){let{item:e}=this;return e.type===`observer`?u(e):d(e)}_restoreSnapshot(e){let{item:t}=this;t.type===`observer`?f(e,t):p(e,t),this.destroyed||(this._syncOperationsFromItem(),this.emit(`committed`))}_replaceOperations(e){this.removeHandles(h),this._operations=i(this._operations),this._operations=e,e!=null&&this.addHandles(e.data.on(`change`,()=>this._operationsGeometryChanged()),h)}_syncOperationsFromItem(e=!0){let{position:t}=this.item,n=this._operations;if(this._syncSource!==`operations`){this._syncSource=`item`;try{if(t==null){if(n==null)return;this._replaceOperations(null)}else!n?.data.geometry?.equals(t)&&!n?.trySetGeometry(t)&&this._replaceOperations(c.fromGeometry(t,this.view.state.viewingMode));e?this._emitModifiedExternally():this.emit(`committed`)}finally{this._syncSource=null}}}_operationsGeometryChanged(){let e=this._operations?.data.geometry;if(this._syncSource===`item`||e?.type!==`point`)return;let t=this._dragIntersectionContext;this._syncSource=`operations`;try{t==null?this.item.position=e:m(this.view,this.item,this.intersector,e,{elevationInfo:this.item.elevationInfo,preservedIntersection:t.intersection})}finally{this._syncSource=null}t!=null&&!t.dragging&&(this._dragIntersectionContext=null),this.emit(`committed`)}_emitModifiedExternally(){this.emit(`modified-externally`),this.emit(`committed`)}};e([t({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([t({constructOnly:!0})],g.prototype,`intersector`,void 0),e([t({constructOnly:!0})],g.prototype,`item`,void 0),e([t({constructOnly:!0})],g.prototype,`view`,void 0),e([t()],g.prototype,`_operations`,void 0),g=e([n(`esri.views.3d.analysis.LineOfSight.LineOfSightItemManipulatedObject3D`)],g);export{g as LineOfSightItemManipulatedObject3D};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{getGeometryEffectiveElevationInfo as s}from"../../../../support/elevationInfoUtils.js";import{EditGeometryOperations as c}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{convertLineOfSightElevationMode as l,snapshotLineOfSightObserverState as u,snapshotLineOfSightTargetState as d,restoreLineOfSightObserverState as f,restoreLineOfSightTargetState as p,updateLineOfSightItemFromAuthoredPoint as m}from"./LineOfSightAuthoringUtils.js";const h=Symbol(`line-of-sight-item-operations`);let g=class extends r{constructor(e){super(e),this._operations=null,this._dragIntersectionContext=null,this._syncSource=null}initialize(){this.addHandles([a(()=>{let{elevationInfo:e,feature:t,position:n}=this.item;return{elevationInfo:e,elevationMode:e?.mode,elevationOffset:e?.offset,elevationUnit:e?.unit,feature:t,position:n,positionCoordinates:n?.toArray(),spatialReference:n?.spatialReference}},()=>this._syncOperationsFromItem(),o),a(()=>{let{origin:e}=this;return{origin:e,originCoordinates:e?.toArray(),spatialReference:e?.spatialReference}},()=>this.emit(`committed`),o)])}destroy(){this.removeHandles(h),this._operations=i(this._operations),this._dragIntersectionContext=null}get operations(){return this._operations}get elevationInfo(){let{position:e,elevationInfo:t}=this.item;return s(e,t)}get visible(){return this.analysisViewData.visible&&this.origin!=null}get isDraped(){return this.elevationInfo.mode===`on-the-ground`}get origin(){return this.item.type===`observer`?this.analysisViewData.elevationAlignedObserver:this.analysisViewData.computations.find(e=>e.target===this.item)?.elevationAlignedTargetLocation??null}get updating(){return!1}toMap(e){return this.intersector.getScreenPointIntersection(e)?.mapPoint}createUndoRecord(){let e=this._snapshotState(),t=null;return{undo:()=>{t=this._snapshotState(),this._restoreSnapshot(e)},redo:()=>{t!=null&&(e=this._snapshotState(),this._restoreSnapshot(t))}}}setElevationMode(e){let{position:t,elevationInfo:n}=this.item;if(t==null||e===this.elevationInfo.mode)return null;let r=l({view:this.view,point:t,sourceElevationInfo:n,mode:e,preserveZ:!0}),i=this.createUndoRecord();this._syncSource=`operations`;try{this.item.elevationInfo=r.elevationInfo,this.item.position=r.position}finally{this._syncSource=null}return this._syncOperationsFromItem(!1),i}updateDragIntersection(e){this._dragIntersectionContext=e.action===`cancel`?null:{dragging:e.action!==`end`,intersection:this.intersector.getScreenPointIntersection(e.screenPoint)}}_snapshotState(){let{item:e}=this;return e.type===`observer`?u(e):d(e)}_restoreSnapshot(e){let{item:t}=this;t.type===`observer`?f(e,t):p(e,t),this.destroyed||(this._syncOperationsFromItem(),this.emit(`committed`))}_replaceOperations(e){this.removeHandles(h),this._operations=i(this._operations),this._operations=e,e!=null&&this.addHandles(e.data.on(`change`,()=>this._operationsGeometryChanged()),h)}_syncOperationsFromItem(e=!0){let{position:t}=this.item,n=this._operations;if(this._syncSource!==`operations`){this._syncSource=`item`;try{if(t==null){if(n==null)return;this._replaceOperations(null)}else!n?.data.geometry?.equals(t)&&!n?.trySetGeometry(t)&&this._replaceOperations(c.fromGeometry(t,this.view.state.isGlobal));e?this._emitModifiedExternally():this.emit(`committed`)}finally{this._syncSource=null}}}_operationsGeometryChanged(){let e=this._operations?.data.geometry;if(this._syncSource===`item`||e?.type!==`point`)return;let t=this._dragIntersectionContext;this._syncSource=`operations`;try{t==null?this.item.position=e:m(this.view,this.item,this.intersector,e,{elevationInfo:this.item.elevationInfo,preservedIntersection:t.intersection})}finally{this._syncSource=null}t!=null&&!t.dragging&&(this._dragIntersectionContext=null),this.emit(`committed`)}_emitModifiedExternally(){this.emit(`modified-externally`),this.emit(`committed`)}};e([t({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([t({constructOnly:!0})],g.prototype,`intersector`,void 0),e([t({constructOnly:!0})],g.prototype,`item`,void 0),e([t({constructOnly:!0})],g.prototype,`view`,void 0),e([t()],g.prototype,`_operations`,void 0),g=e([n(`esri.views.3d.analysis.LineOfSight.LineOfSightItemManipulatedObject3D`)],g);export{g as LineOfSightItemManipulatedObject3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i,normalize as a,scaleAndAdd as o,scale as s,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,clone as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{screenPointObjectToArray as f}from"../../../../core/screenUtils.js";import p from"../../../../geometry/Point.js";import{create as m,fromPoints as h,copy as g}from"../../../../geometry/support/ray.js";import{sv2d as _}from"../../../../geometry/support/vectorStacks.js";import{IntegratedMeshSemantics as v}from"../../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayerView as y}from"../../../support/layerViewUtils.js";import{isGaussianSplatIntersectorResult as b}from"../../layers/i3s/Intersector.js";import{fromScreen as x}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as S,isIntegratedMeshIntersectorResult as C}from"../../terrain/Intersector.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as T}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as E}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{LineOfSightIntersectionResult as D,lineOfSightIntersectionContextGaussianSplat as O,lineOfSightIntersectionContextGround as k,LineOfSightIntersectionContextGraphic as A}from"./LineOfSightIntersectionResult.js";let j=class extends t{constructor(e){super(e)}initialize(){this.intersector=new w(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}get _integratedMeshLayerViews(){return this.view.allLayerViews.items.filter(y)}get _terrainIntersectionOptionsLayerUids(){return new Set([E,...this._integratedMeshLayerViews.filter(e=>v.shouldIntersectAsGround(e.layer)).map(e=>e.uid)])}getScreenPointIntersection(e){let t=f(e,_.get()),n=x(this.view.state.camera,t,I);return this._getRayIntersection(n)}getMapPointIntersection(e){let t=l(e.x,e.y,e.z??0);if(!this.view.renderCoordsHelper.toRenderCoords(t,e.spatialReference,t))return null;let n=this.view.state.camera.eye;return h(n,t,I),this._getRayIntersection(I)}_getRayIntersection(e,t){let{view:n,intersector:r}=this;if(e==null||n.sceneIntersectionHelper==null)return null;r.options.store=0,n.sceneIntersectionHelper.intersectToolIntersectorRay(e,r,t);let i=r.results.min;if(i.target==null)return null;let a=d();if(!i.getIntersectionPoint(a)||t?.maxDistance!=null&&!i.withinDistance(t.maxDistance))return null;let o=n.renderCoordsHelper.fromRenderCoords(a,new p({spatialReference:n.spatialReference}));if(b(i))return new D({context:O,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:u(i.target.outwardDirection),ray:g(e)});let s=u(i.normal);if(S(i))return new D({context:k,id:i.target.lij.slice(),mapPoint:o,renderPoint:a,normal:s,ray:g(e)});if(C(n,i))return new D({context:k,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)});let c=T(i,n);if(c!=null){let{layer:t}=c,n=c.getObjectId()??c.uid;return new D({context:new A(c),id:`${t?.uid}/${n}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}let l=`layerViewUid`in i.target?`${i.target.layerViewUid}`:``;return new D({context:null,id:l,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}updateFromGroundIntersection(e,t,n){let r=M,l=N,d=P;i(l,e),this.view.renderCoordsHelper.worldUpAtPosition(l,d),a(d,d);let f=this.view.groundView?.visibleElevationRange,p=f?Math.abs(f.maxElevation-f.minElevation):100,m=(t>=0?1:-1)*(p+Math.abs(t)),g=m*.001;o(r,l,d,m-g),o(l,l,d,g),h(r,l,I);let _=this._getRayIntersection(I,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:m});if(_!=null){let e=F;return s(e,d,t),c(n,_.renderPoint,e),u(_.normal)}return i(n,e),null}};e([n()],j.prototype,`view`,void 0),e([n()],j.prototype,`intersector`,void 0),e([n()],j.prototype,`_integratedMeshLayerViews`,null),e([n()],j.prototype,`_terrainIntersectionOptionsLayerUids`,null),j=e([r(`esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector`)],j);const M=d(),N=d(),P=d(),F=d(),I=m();export{j as LineOfSightRayIntersector};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as i,normalize as a,scaleAndAdd as o,scale as s,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,clone as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{screenPointObjectToArray as f}from"../../../../core/screenUtils.js";import p from"../../../../geometry/Point.js";import{create as m,fromPoints as h,copy as g}from"../../../../geometry/support/ray.js";import{sv2d as _}from"../../../../geometry/support/vectorStacks.js";import{IntegratedMeshSemantics as v}from"../../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayerView as y}from"../../../support/layerViewUtils.js";import{isGaussianSplatIntersectorResult as b}from"../../layers/i3s/Intersector.js";import{fromScreen as x}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as S,isIntegratedMeshIntersectorResult as C}from"../../terrain/Intersector.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as T}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as E}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{LineOfSightIntersectionResult as D,lineOfSightIntersectionContextGaussianSplat as O,lineOfSightIntersectionContextGround as k,LineOfSightIntersectionContextGraphic as A}from"./LineOfSightIntersectionResult.js";let j=class extends t{constructor(e){super(e)}initialize(){this.intersector=new w(this.view.state.isGlobal),this.intersector.options.hud=!1,this.intersector.options.store=0}get _integratedMeshLayerViews(){return this.view.allLayerViews.items.filter(y)}get _terrainIntersectionOptionsLayerUids(){return new Set([E,...this._integratedMeshLayerViews.filter(e=>v.shouldIntersectAsGround(e.layer)).map(e=>e.uid)])}getScreenPointIntersection(e){let t=f(e,_.get()),n=x(this.view.state.camera,t,I);return this._getRayIntersection(n)}getMapPointIntersection(e){let t=l(e.x,e.y,e.z??0);if(!this.view.renderCoordsHelper.toRenderCoords(t,e.spatialReference,t))return null;let n=this.view.state.camera.eye;return h(n,t,I),this._getRayIntersection(I)}_getRayIntersection(e,t){let{view:n,intersector:r}=this;if(e==null||n.sceneIntersectionHelper==null)return null;r.options.store=0,n.sceneIntersectionHelper.intersectToolIntersectorRay(e,r,t);let i=r.results.min;if(i.target==null)return null;let a=d();if(!i.getIntersectionPoint(a)||t?.maxDistance!=null&&!i.withinDistance(t.maxDistance))return null;let o=n.renderCoordsHelper.fromRenderCoords(a,new p({spatialReference:n.spatialReference}));if(b(i))return new D({context:O,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:u(i.target.outwardDirection),ray:g(e)});let s=u(i.normal);if(S(i))return new D({context:k,id:i.target.lij.slice(),mapPoint:o,renderPoint:a,normal:s,ray:g(e)});if(C(n,i))return new D({context:k,id:`${i.target.layerViewUid}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)});let c=T(i,n);if(c!=null){let{layer:t}=c,n=c.getObjectId()??c.uid;return new D({context:new A(c),id:`${t?.uid}/${n}`,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}let l=`layerViewUid`in i.target?`${i.target.layerViewUid}`:``;return new D({context:null,id:l,mapPoint:o,renderPoint:a,normal:s,ray:g(e)})}updateFromGroundIntersection(e,t,n){let r=M,l=N,d=P;i(l,e),this.view.renderCoordsHelper.worldUpAtPosition(l,d),a(d,d);let f=this.view.groundView?.visibleElevationRange,p=f?Math.abs(f.maxElevation-f.minElevation):100,m=(t>=0?1:-1)*(p+Math.abs(t)),g=m*.001;o(r,l,d,m-g),o(l,l,d,g),h(r,l,I);let _=this._getRayIntersection(I,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:m});if(_!=null){let e=F;return s(e,d,t),c(n,_.renderPoint,e),u(_.normal)}return i(n,e),null}};e([n()],j.prototype,`view`,void 0),e([n()],j.prototype,`intersector`,void 0),e([n()],j.prototype,`_integratedMeshLayerViews`,null),e([n()],j.prototype,`_terrainIntersectionOptionsLayerUids`,null),j=e([r(`esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector`)],j);const M=d(),N=d(),P=d(),F=d(),I=m();export{j as LineOfSightRayIntersector};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{isSome as r,equals as i}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import l from"../../../core/Logger.js";import{abortMaybe as u,destroyMaybe as d}from"../../../core/maybe.js";import{after as f,throwIfAborted as p,isPromiseLike as m}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as g}from"../../../core/reactiveUtils.js";import{createScreenPointArray as _,createRenderScreenPointArray as v}from"../../../core/screenUtils.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{convertTime as b,getDateTimeUTC as x}from"../../../core/timeUtils.js";import{containsExecute as S}from"../../../geometry/operators/containsOperator.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{equals as w}from"../../../geometry/support/boundedPlane.js";import{getSunlightIntervals as T}from"../../../time/daylightUtils.js";import{breadthFirstBinaryPartitioning as E}from"../../../widgets/support/traversalUtils.js";import{polygonToVolume as D}from"../focusAreaUtils.js";import{ElevationContext as O}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as k}from"../support/earthUtils.js";import{computeDirectionsOverTime as A}from"../support/sunUtils.js";import{maxColorRampSize as j}from"../webgl-engine/shaders/colorRampParameters.js";import M from"./AnalysisView3D.js";import{registerAnalysisView as N,hideOtherAnalysisViews as P}from"./ShadowCast/analysisViewRegister.js";import F from"./ShadowCast/ShadowCastError.js";import{ShadowCastTooltip as I}from"./ShadowCast/ShadowCastTooltip.js";let L=class extends M{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new y,this._visibleOverride=null,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([N(this.view,this),h(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{u(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=a(async e=>{await f(W,e),p(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),h(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t},n)=>{t&&P(this.view,this),(t||n?.visible)&&e?.setParameters({shadowCast:{enabled:t}})},g),h(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{z(e,n,t)},g),h(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{z(e,r,{lightDirections:t,lightDirectionsContext:n})},g),h(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{z(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),h(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{z(e,t,{analysisVolume:n})},g)]),this.interactive=!0,this._tooltip=new I({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&z(this._renderer,!0,{enabled:!1}),this._tooltip=d(this._tooltip),this._stopPreviewingTask=u(this._stopPreviewingTask),this._updatingHandles=d(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){let e=(this.parent?.visible&&!this.parent.suspended)??!0;return(this._visibleOverride??e)&&this.error==null}set visible(e){this._visibleOverride=e}get error(){let e=this._sunlightIntervals;switch(e.state){case`ready`:break;case`unavailable`:return new F(e.state,`The camera's geographic reference position is not available.`);default:return new F(e.state,`The selected date, time zone, or daylight calculation could not be resolved.`)}let{startTimeOfDay:t,endTimeOfDay:n}=this.analysis;if(!Number.isFinite(t)||!Number.isFinite(n)||t<0||n>b(1,`days`,`milliseconds`)||n<t)return new F(`invalid`,`The selected time range must be ordered and within the calendar day.`);let r=this._startDateTimeUTC.getTime(),i=this._endDateTimeUTC.getTime();if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return new F(`invalid`,`The selected time range could not be resolved to ordered UTC instants.`);let{intervals:a}=e;return a.length?a.some(e=>r>=e.start&&i<=e.end)?null:a.length>1?new F(`split-daylight`,`Daylight crosses midnight in the selected time zone and the selected time range includes nighttime.`):new F(`outside-daylight`,`The selected time range includes nighttime at the current camera location.`):new F(`no-daylight`,`No daylight is expected at the current camera location on the selected date.`)}get _sunlightIntervals(){let{date:e}=this.analysis,t=this._timeZone;return T({date:e,timeZone:t,utcOffset:t==null?this._effectiveUtcOffset:0,position:this._referencePosition})}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _timeZone(){return this.analysis.timeZoneMode===`region`?this.view.timeZone:null}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:k(e[0],!1)}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t}=this.analysis,n=this._timeZone,r=x({date:t,millisecondsSinceMidnight:e,timeZone:n,utcOffset:n==null?this._effectiveUtcOffset:0});if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(G-1)):G}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this.error==null?this._calculateLightDirections(this._interval):[]}get _lightDirectionsContext(){return this.error==null?this._calculateLightDirections(this._intervalContext):[]}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?K:this._referencePosition;if(n==null)return[];let r=A(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,G),i=r.length;q.length=0;let a=E(0,i,q),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=D(e,this.view,J);return t==null?(this._previousVolume=null,null):m(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return l.getLogger(this).error(new o(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?U/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(V)}get _previewDependencies(){if(this.error!=null)return null;let{view:e}=this,t=e.slice.plane,n=this._shadowLayerViews,i=n.map(e=>e.layer).filter(r),a=n.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=n.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(_(e.x,e.y),v()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);p(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return p(t),a!=null&&S(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>j&&l.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return B(e)}};e([t({readOnly:!0,type:[`shadow-cast-view-3d`]})],L.prototype,`type`,void 0),e([t({constructOnly:!0,nonNullable:!0})],L.prototype,`analysis`,void 0),e([t({readOnly:!0})],L.prototype,`updating`,null),e([t()],L.prototype,`visible`,null),e([t()],L.prototype,`error`,null),e([t()],L.prototype,`_visibleOverride`,void 0),e([t()],L.prototype,`_sunlightIntervals`,null),e([t()],L.prototype,`_stopPreviewingTask`,void 0),e([t()],L.prototype,`_updatedRecently`,void 0),e([t()],L.prototype,`_tooltip`,void 0),e([t()],L.prototype,`_sceneUpdating`,null),e([t()],L.prototype,`_timeZone`,null),e([t()],L.prototype,`_effectiveUtcOffset`,null),e([t()],L.prototype,`_utcOffsetAuto`,null),e([t()],L.prototype,`_startDateTimeUTC`,null),e([t()],L.prototype,`_endDateTimeUTC`,null),e([t()],L.prototype,`_referencePosition`,null),e([t()],L.prototype,`_interval`,null),e([t()],L.prototype,`_intervalContext`,null),e([t()],L.prototype,`_totalDurationSampleCount`,null),e([t()],L.prototype,`_totalDuration`,null),e([t()],L.prototype,`_lightDirections`,null),e([t()],L.prototype,`_lightDirectionsContext`,null),e([t()],L.prototype,`_analysisVolume`,null),e([t()],L.prototype,`_visualizationParameters`,null),e([t()],L.prototype,`_minDurationVisualizationParameters`,null),e([t()],L.prototype,`_minDurationContextVisualizationParameters`,null),e([t()],L.prototype,`_durationVisualizationParameters`,null),e([t()],L.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([t()],L.prototype,`_discreteVisualizationParameters`,null),e([t()],L.prototype,`_shadowLayerViews`,null),e([t()],L.prototype,`_previewDependencies`,null),e([t()],L.prototype,`_renderer`,null),L=e([n(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],L);const R=L;function z(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function B(e){let t=e.toUnitRGBA();return[[0,c(t[0],t[1],t[2],0)],[1,t]]}function V(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:case`sketch-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function H(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=w(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=i(e.layerVisibilities,t.layerVisibilities),s=i(e.layerOpacities,t.layerOpacities),c=i(e.filters,t.filters),l=i(e.definitionExpressions,t.definitionExpressions);return n&&r&&a&&o&&s&&c&&l}const U=b(1,`hours`,`milliseconds`),W=500,G=255,K=s(),q=[],J=new O;export{R as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{isSome as r,equals as i}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import l from"../../../core/Logger.js";import{abortMaybe as u,destroyMaybe as d}from"../../../core/maybe.js";import{after as f,throwIfAborted as p,isPromiseLike as m}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as g}from"../../../core/reactiveUtils.js";import{createScreenPointArray as _,createRenderScreenPointArray as v}from"../../../core/screenUtils.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{convertTime as b,getDateTimeUTC as x}from"../../../core/timeUtils.js";import{containsExecute as S}from"../../../geometry/operators/containsOperator.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{equals as w}from"../../../geometry/support/boundedPlane.js";import{getSunlightIntervals as T}from"../../../time/daylightUtils.js";import{breadthFirstBinaryPartitioning as E}from"../../../widgets/support/traversalUtils.js";import{polygonToVolume as D}from"../focusAreaUtils.js";import{ElevationContext as O}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as k}from"../support/earthUtils.js";import{computeDirectionsOverTime as A}from"../support/sunUtils.js";import{maxColorRampSize as j}from"../webgl-engine/shaders/colorRampParameters.js";import M from"./AnalysisView3D.js";import{registerAnalysisView as N,hideOtherAnalysisViews as P}from"./ShadowCast/analysisViewRegister.js";import F from"./ShadowCast/ShadowCastError.js";import{ShadowCastTooltip as I}from"./ShadowCast/ShadowCastTooltip.js";let L=class extends M{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new y,this._visibleOverride=null,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([N(this.view,this),h(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{u(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=a(async e=>{await f(W,e),p(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>H(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),h(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t},n)=>{t&&P(this.view,this),(t||n?.visible)&&e?.setParameters({shadowCast:{enabled:t}})},g),h(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{z(e,n,t)},g),h(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{z(e,r,{lightDirections:t,lightDirectionsContext:n})},g),h(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{z(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),h(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{z(e,t,{analysisVolume:n})},g)]),this.interactive=!0,this._tooltip=new I({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&z(this._renderer,!0,{enabled:!1}),this._tooltip=d(this._tooltip),this._stopPreviewingTask=u(this._stopPreviewingTask),this._updatingHandles=d(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){let e=(this.parent?.visible&&!this.parent.suspended)??!0;return(this._visibleOverride??e)&&this.error==null}set visible(e){this._visibleOverride=e}get error(){let e=this._sunlightIntervals;switch(e.state){case`ready`:break;case`unavailable`:return new F(e.state,`The camera's geographic reference position is not available.`);default:return new F(e.state,`The selected date, time zone, or daylight calculation could not be resolved.`)}let{startTimeOfDay:t,endTimeOfDay:n}=this.analysis;if(!Number.isFinite(t)||!Number.isFinite(n)||t<0||n>b(1,`days`,`milliseconds`)||n<t)return new F(`invalid`,`The selected time range must be ordered and within the calendar day.`);let r=this._startDateTimeUTC.getTime(),i=this._endDateTimeUTC.getTime();if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return new F(`invalid`,`The selected time range could not be resolved to ordered UTC instants.`);let{intervals:a}=e;return a.length?a.some(e=>r>=e.start&&i<=e.end)?null:a.length>1?new F(`split-daylight`,`Daylight crosses midnight in the selected time zone and the selected time range includes nighttime.`):new F(`outside-daylight`,`The selected time range includes nighttime at the current camera location.`):new F(`no-daylight`,`No daylight is expected at the current camera location on the selected date.`)}get _sunlightIntervals(){let{date:e}=this.analysis,t=this._timeZone;return T({date:e,timeZone:t,utcOffset:t==null?this._effectiveUtcOffset:0,position:this._referencePosition})}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _timeZone(){return this.analysis.timeZoneMode===`region`?this.view.timeZone:null}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:k(e[0],!1)}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t}=this.analysis,n=this._timeZone,r=x({date:t,millisecondsSinceMidnight:e,timeZone:n,utcOffset:n==null?this._effectiveUtcOffset:0});if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(G-1)):G}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this.error==null?this._calculateLightDirections(this._interval):[]}get _lightDirectionsContext(){return this.error==null?this._calculateLightDirections(this._intervalContext):[]}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?K:this._referencePosition;if(n==null)return[];let r=A(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.isGlobal,G),i=r.length;q.length=0;let a=E(0,i,q),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=D(e,this.view,J);return t==null?(this._previousVolume=null,null):m(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return l.getLogger(this).error(new o(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?U/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(V)}get _previewDependencies(){if(this.error!=null)return null;let{view:e}=this,t=e.slice.plane,n=this._shadowLayerViews,i=n.map(e=>e.layer).filter(r),a=n.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=n.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(_(e.x,e.y),v()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);p(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return p(t),a!=null&&S(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>j&&l.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return B(e)}};e([t({readOnly:!0,type:[`shadow-cast-view-3d`]})],L.prototype,`type`,void 0),e([t({constructOnly:!0,nonNullable:!0})],L.prototype,`analysis`,void 0),e([t({readOnly:!0})],L.prototype,`updating`,null),e([t()],L.prototype,`visible`,null),e([t()],L.prototype,`error`,null),e([t()],L.prototype,`_visibleOverride`,void 0),e([t()],L.prototype,`_sunlightIntervals`,null),e([t()],L.prototype,`_stopPreviewingTask`,void 0),e([t()],L.prototype,`_updatedRecently`,void 0),e([t()],L.prototype,`_tooltip`,void 0),e([t()],L.prototype,`_sceneUpdating`,null),e([t()],L.prototype,`_timeZone`,null),e([t()],L.prototype,`_effectiveUtcOffset`,null),e([t()],L.prototype,`_utcOffsetAuto`,null),e([t()],L.prototype,`_startDateTimeUTC`,null),e([t()],L.prototype,`_endDateTimeUTC`,null),e([t()],L.prototype,`_referencePosition`,null),e([t()],L.prototype,`_interval`,null),e([t()],L.prototype,`_intervalContext`,null),e([t()],L.prototype,`_totalDurationSampleCount`,null),e([t()],L.prototype,`_totalDuration`,null),e([t()],L.prototype,`_lightDirections`,null),e([t()],L.prototype,`_lightDirectionsContext`,null),e([t()],L.prototype,`_analysisVolume`,null),e([t()],L.prototype,`_visualizationParameters`,null),e([t()],L.prototype,`_minDurationVisualizationParameters`,null),e([t()],L.prototype,`_minDurationContextVisualizationParameters`,null),e([t()],L.prototype,`_durationVisualizationParameters`,null),e([t()],L.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([t()],L.prototype,`_discreteVisualizationParameters`,null),e([t()],L.prototype,`_shadowLayerViews`,null),e([t()],L.prototype,`_previewDependencies`,null),e([t()],L.prototype,`_renderer`,null),L=e([n(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],L);const R=L;function z(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function B(e){let t=e.toUnitRGBA();return[[0,c(t[0],t[1],t[2],0)],[1,t]]}function V(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:case`group`:return!1;case`graphics-3d`:case`sketch-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function H(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=w(e.slicePlane,t.slicePlane),r=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=i(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=i(e.layerVisibilities,t.layerVisibilities),s=i(e.layerOpacities,t.layerOpacities),c=i(e.filters,t.filters),l=i(e.definitionExpressions,t.definitionExpressions);return n&&r&&a&&o&&s&&c&&l}const U=b(1,`hours`,`milliseconds`),W=500,G=255,K=s(),q=[],J=new O;export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{clock as i}from"../../../../core/clock.js";import{fromRotation as a,fromScaling as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as c,length as l,copy as u,scale as d,add as f,transformMat4 as p,normalize as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as v,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{destroyMaybe as b,removeMaybe as x}from"../../../../core/maybe.js";import{watch as S,sync as ee,when as te,syncAndInitial as ne}from"../../../../core/reactiveUtils.js";import{addFrameTask as re}from"../../../../core/scheduling.js";import{createScreenPoint as ie,screenPointObjectToArray as ae}from"../../../../core/screenUtils.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{create as w,copy as T,normal as E,fromValues as D}from"../../../../geometry/support/boundedPlane.js";import{signedDistance as O,create as k,intersectRay as A,getNormal as j}from"../../../../geometry/support/plane.js";import{create as oe}from"../../../../geometry/support/ray.js";import{sv3d as M,sm4d as N,sv2d as se}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as ce}from"../../../../graphic/getSliceableContainer.js";import{AnalysisToolBase as le}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as P}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as F}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as I}from"../../../support/screenUtils.js";import{screenToRenderPlane as L}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as R}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as z}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as B}from"../../interactive/manipulators/ShiftManipulator.js";import{calculateInputRotationTransform as V}from"../../interactive/manipulatorUtils.js";import{fromScreenNormalized as H}from"../../support/geometryUtils/ray.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as W}from"../images/Factory.js";import{getOutlineColor as ue,planeColor as de}from"./settings.js";import{pointerMoveTimerMs as fe,planePreviewOutlineWidth as pe,forceVerticalModifier as G,forceHorizontalModifier as K,previewFadeDurationSeconds as me,previewFadeDotThreshold as he,initialDepthOffsetFrac as ge}from"./sliceToolConfig.js";import{createGridVisualElement as _e,createOutlineVisualElement as ve,planeToShape as ye,createRotatePlane as q,resizePlane as be,calculatePlaneHalfSize as xe,createPlane as Se,DidPointerMoveRecentlyFlag as J,calculateBoundedPlaneTranslateRotate as Y,updateShiftRestartHandle as Ce,updateRotateHeadingHandle as X,updateRotateTiltHandle as we,updateResizeHandle as Te,createShiftPlane as Ee}from"./sliceToolUtils.js";var Z;let Q=class extends le{static{Z=this}constructor(e){super(e),this._clock=i,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=fe,this._prevPointerMoveTimeout=null,this._updatingHandles=new C,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=w(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=ie(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=F(e.view.state.viewingMode)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&T(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new B(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new z(this.view,(e,t)=>U(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new z(this.view,(e,t)=>W(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new R(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=_e(this.view),this._previewPlaneOutlineVisualElement=ve(this.view),this._previewPlaneOutlineVisualElement.width=pe,this.addHandles(S(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),ee)),this.addHandles([te(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},ne),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=b(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=b(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(I(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=I(e),r=w();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(T(r,this._startPlane),this.analysis.shape=ye(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(I(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?ce(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===G||e.key===K)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===G||e.key===K)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.view.state.camera,e.screenPoint,$);T(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(c(E(this.analysisViewData.plane),t.ray.direction)/l(t.ray.direction)))/.001,1),r=-O(this._startPlane.plane,t.renderEnd),i=-O(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=u(M.get(),this._startPlane.origin),n=u(M.get(),E(this._startPlane));d(n,n,-e.depth),f(n,n,t);let r=D(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,w());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.analysisViewData.plane,this.view.renderCoordsHelper,1,k()),n=H(this.view.state.camera,e.screenPoint,$),r=_();A(t,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.analysisViewData.plane,this.view.renderCoordsHelper,2,k()),n=H(this.view.state.camera,e.screenPoint,$),r=_();A(t,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=j(e.rotatePlane),r=V(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=a(N.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=p(M.get(),this._startPlane.basis1,t),r=p(M.get(),this._startPlane.basis2,t),i=D(this.analysisViewData.plane.origin,n,r,w());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=H(this.view.state.camera,e.screenPoint,$),r=M.get();A(this.analysisViewData.plane.plane,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:g(r)})}_createResizeDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=T(this.analysisViewData.plane,w());t.next(L(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=be(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,T(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??w();if(n=n==null?null:T(n,Ae),this._pickPlane(e,!0,t,r)){let e=he,t=!1;n!=null&&(t=c(j(n.plane),j(r.plane))<e||c(m(M.get(),n.basis1),m(M.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=re({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(me*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=x(this._frameTask)}_pickMinResult(e){let t=ae(e,se.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=M.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(M.get()),s=this.view.state.camera;c(o,s.viewForward)>0&&d(o,o,-1);let l=xe(a,s),u=(t?1:-1)*l*ge,p=d(M.get(),o,u);f(p,p,a);let m=this.analysis.tiltEnabled?3:0,h=n[G]?2:n[K]?1:m;return Se(p,o,l,l,s,h,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=x(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=J,this.rotateHeadingManipulator.state|=J,this.rotateTiltManipulator.state|=J,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~J,this.rotateHeadingManipulator.state&=~J,this.rotateTiltManipulator.state&=~J},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=Y(e,N.get());Ce(this.shiftManipulator,t,e,this.view.state.camera),X(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),we(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>Te(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=Y(e,N.get()),n=h(M.get(),l(e.basis1),l(e.basis2),1),r=o(N.get(),n),i=s(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=ue(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=v(de);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=y}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([n()],Q.prototype,`_clock`,void 0),e([n({constructOnly:!0})],Q.prototype,`view`,void 0),e([n()],Q.prototype,`analysisViewData`,void 0),e([n({readOnly:!0})],Q.prototype,`state`,null),e([n({readOnly:!0})],Q.prototype,`cursor`,null),e([n()],Q.prototype,`analysis`,null),e([n()],Q.prototype,`multiTouchEnabled`,void 0),e([n()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([n()],Q.prototype,`updating`,null),e([n()],Q.prototype,`_mode`,void 0),e([n()],Q.prototype,`mode`,null),e([n({value:null})],Q.prototype,`inputState`,null),e([n()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([r(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Ee(t,E(n),e.direction,k()),i=_();return A(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=w(),$=oe();export{De as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{clock as i}from"../../../../core/clock.js";import{fromRotation as a,fromScaling as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as c,length as l,copy as u,scale as d,add as f,transformMat4 as p,normalize as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as g,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as v,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{destroyMaybe as b,removeMaybe as x}from"../../../../core/maybe.js";import{watch as S,sync as ee,when as te,syncAndInitial as ne}from"../../../../core/reactiveUtils.js";import{addFrameTask as re}from"../../../../core/scheduling.js";import{createScreenPoint as ie,screenPointObjectToArray as ae}from"../../../../core/screenUtils.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{create as w,copy as T,normal as E,fromValues as D}from"../../../../geometry/support/boundedPlane.js";import{signedDistance as O,create as k,intersectRay as A,getNormal as j}from"../../../../geometry/support/plane.js";import{create as oe}from"../../../../geometry/support/ray.js";import{sv3d as M,sm4d as N,sv2d as se}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as ce}from"../../../../graphic/getSliceableContainer.js";import{AnalysisToolBase as le}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as P}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as F}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as I}from"../../../support/screenUtils.js";import{screenToRenderPlane as L}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as R}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as z}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as B}from"../../interactive/manipulators/ShiftManipulator.js";import{calculateInputRotationTransform as V}from"../../interactive/manipulatorUtils.js";import{fromScreenNormalized as H}from"../../support/geometryUtils/ray.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as W}from"../images/Factory.js";import{getOutlineColor as ue,planeColor as de}from"./settings.js";import{pointerMoveTimerMs as fe,planePreviewOutlineWidth as pe,forceVerticalModifier as G,forceHorizontalModifier as K,previewFadeDurationSeconds as me,previewFadeDotThreshold as he,initialDepthOffsetFrac as ge}from"./sliceToolConfig.js";import{createGridVisualElement as _e,createOutlineVisualElement as ve,planeToShape as ye,createRotatePlane as q,resizePlane as be,calculatePlaneHalfSize as xe,createPlane as Se,DidPointerMoveRecentlyFlag as J,calculateBoundedPlaneTranslateRotate as Y,updateShiftRestartHandle as Ce,updateRotateHeadingHandle as X,updateRotateTiltHandle as we,updateResizeHandle as Te,createShiftPlane as Ee}from"./sliceToolUtils.js";var Z;let Q=class extends le{static{Z=this}constructor(e){super(e),this._clock=i,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=fe,this._prevPointerMoveTimeout=null,this._updatingHandles=new C,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=w(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=ie(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=F(e.view.state.isGlobal)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&T(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new B(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new z(this.view,(e,t)=>U(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new z(this.view,(e,t)=>W(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new R(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=_e(this.view),this._previewPlaneOutlineVisualElement=ve(this.view),this._previewPlaneOutlineVisualElement.width=pe,this.addHandles(S(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),ee)),this.addHandles([te(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},ne),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=b(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=b(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(I(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=I(e),r=w();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(T(r,this._startPlane),this.analysis.shape=ye(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(I(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?ce(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===G||e.key===K)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===G||e.key===K)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.view.state.camera,e.screenPoint,$);T(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(c(E(this.analysisViewData.plane),t.ray.direction)/l(t.ray.direction)))/.001,1),r=-O(this._startPlane.plane,t.renderEnd),i=-O(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=u(M.get(),this._startPlane.origin),n=u(M.get(),E(this._startPlane));d(n,n,-e.depth),f(n,n,t);let r=D(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,w());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.analysisViewData.plane,this.view.renderCoordsHelper,1,k()),n=H(this.view.state.camera,e.screenPoint,$),r=_();A(t,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.analysisViewData.plane,this.view.renderCoordsHelper,2,k()),n=H(this.view.state.camera,e.screenPoint,$),r=_();A(t,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:T(this.analysisViewData.plane,w());t.next(L(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=j(e.rotatePlane),r=V(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=a(N.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=p(M.get(),this._startPlane.basis1,t),r=p(M.get(),this._startPlane.basis2,t),i=D(this.analysisViewData.plane.origin,n,r,w());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=H(this.view.state.camera,e.screenPoint,$),r=M.get();A(this.analysisViewData.plane.plane,n,r)&&(T(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:g(r)})}_createResizeDragPipeline(e){return P(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=T(this.analysisViewData.plane,w());t.next(L(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=be(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,T(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??w();if(n=n==null?null:T(n,Ae),this._pickPlane(e,!0,t,r)){let e=he,t=!1;n!=null&&(t=c(j(n.plane),j(r.plane))<e||c(m(M.get(),n.basis1),m(M.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=re({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(me*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=x(this._frameTask)}_pickMinResult(e){let t=ae(e,se.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=M.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(M.get()),s=this.view.state.camera;c(o,s.viewForward)>0&&d(o,o,-1);let l=xe(a,s),u=(t?1:-1)*l*ge,p=d(M.get(),o,u);f(p,p,a);let m=this.analysis.tiltEnabled?3:0,h=n[G]?2:n[K]?1:m;return Se(p,o,l,l,s,h,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=x(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=J,this.rotateHeadingManipulator.state|=J,this.rotateTiltManipulator.state|=J,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~J,this.rotateHeadingManipulator.state&=~J,this.rotateTiltManipulator.state&=~J},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=Y(e,N.get());Ce(this.shiftManipulator,t,e,this.view.state.camera),X(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),we(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>Te(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=Y(e,N.get()),n=h(M.get(),l(e.basis1),l(e.basis2),1),r=o(N.get(),n),i=s(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=ue(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=v(de);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=y}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([n()],Q.prototype,`_clock`,void 0),e([n({constructOnly:!0})],Q.prototype,`view`,void 0),e([n()],Q.prototype,`analysisViewData`,void 0),e([n({readOnly:!0})],Q.prototype,`state`,null),e([n({readOnly:!0})],Q.prototype,`cursor`,null),e([n()],Q.prototype,`analysis`,null),e([n()],Q.prototype,`multiTouchEnabled`,void 0),e([n()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([n()],Q.prototype,`updating`,null),e([n()],Q.prototype,`_mode`,void 0),e([n()],Q.prototype,`mode`,null),e([n({value:null})],Q.prototype,`inputState`,null),e([n()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([r(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Ee(t,E(n),e.direction,k()),i=_();return A(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=w(),$=oe();export{De as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{tryProject as s}from"../../../../geometry/projectionUtils.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import l from"../../../../symbols/support/ElevationInfo.js";import{EditGeometryOperations as u}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{viewingModeFromString as d}from"../../../ViewingMode.js";const f=Symbol(`observerOperations`);let p=class extends r{constructor(e){super(e),this._operations=null}initialize(){this.addHandles(a(()=>this.subTool.observer,e=>this._syncObserver(e),o))}destroy(){this.removeHandles(f),this._operations=i(this._operations)}get operations(){return this._operations}get elevationInfo(){return this.subTool.viewshedComputedData?.effectiveElevationInfo??c}get visible(){return this.subTool.analysisViewData.visible&&(this.subTool.viewshedComputedData?.valid??!1)}get isDraped(){return this.elevationInfo.mode===`on-the-ground`}get origin(){return this.subTool.observer}get updating(){return!1}toMap(e){return this.view.toMap(e)}setElevationMode(e){let t=this.subTool.viewshed;if(!t?.observer||e===this.elevationInfo.mode)return;let n=t.elevationInfo?.clone()??new l;n.mode=e,t.elevationInfo=n,this.emit(`committed`)}_syncObserver(e){let t=e==null?null:s(e,this.view.spatialReference);if(t==null){this.removeHandles(f),this._operations=i(this._operations),this.emit(`committed`);return}let n=this._operations?.data.geometry;if(n?.type===`point`&&n.equals(t))return;if(this._operations?.trySetGeometry(t)){this.emit(`modified-externally`),this.emit(`committed`);return}this.removeHandles(f),this._operations=i(this._operations);let r=u.fromGeometry(t,d(this.view.viewingMode));this._operations=r,this.addHandles(r.data.on(`change`,()=>{let e=r.data.geometry;e.type===`point`&&(this.subTool.observer=e,this.emit(`committed`))}),f),this.emit(`committed`)}};e([t({constructOnly:!0})],p.prototype,`view`,void 0),e([t({constructOnly:!0})],p.prototype,`subTool`,void 0),p=e([n(`esri.views.3d.analysis.Viewshed.ViewshedObserverManipulatedObject3D`)],p);export{p as ViewshedObserverManipulatedObject3D};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{tryProject as s}from"../../../../geometry/projectionUtils.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import l from"../../../../symbols/support/ElevationInfo.js";import{EditGeometryOperations as u}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{isGlobalFromString as d}from"../../../ViewingMode.js";const f=Symbol(`observerOperations`);let p=class extends r{constructor(e){super(e),this._operations=null}initialize(){this.addHandles(a(()=>this.subTool.observer,e=>this._syncObserver(e),o))}destroy(){this.removeHandles(f),this._operations=i(this._operations)}get operations(){return this._operations}get elevationInfo(){return this.subTool.viewshedComputedData?.effectiveElevationInfo??c}get visible(){return this.subTool.analysisViewData.visible&&(this.subTool.viewshedComputedData?.valid??!1)}get isDraped(){return this.elevationInfo.mode===`on-the-ground`}get origin(){return this.subTool.observer}get updating(){return!1}toMap(e){return this.view.toMap(e)}setElevationMode(e){let t=this.subTool.viewshed;if(!t?.observer||e===this.elevationInfo.mode)return;let n=t.elevationInfo?.clone()??new l;n.mode=e,t.elevationInfo=n,this.emit(`committed`)}_syncObserver(e){let t=e==null?null:s(e,this.view.spatialReference);if(t==null){this.removeHandles(f),this._operations=i(this._operations),this.emit(`committed`);return}let n=this._operations?.data.geometry;if(n?.type===`point`&&n.equals(t))return;if(this._operations?.trySetGeometry(t)){this.emit(`modified-externally`),this.emit(`committed`);return}this.removeHandles(f),this._operations=i(this._operations);let r=u.fromGeometry(t,d(this.view.viewingMode));this._operations=r,this.addHandles(r.data.on(`change`,()=>{let e=r.data.geometry;e.type===`point`&&(this.subTool.observer=e,this.emit(`committed`))}),f),this.emit(`committed`)}};e([t({constructOnly:!0})],p.prototype,`view`,void 0),e([t({constructOnly:!0})],p.prototype,`subTool`,void 0),p=e([n(`esri.views.3d.analysis.Viewshed.ViewshedObserverManipulatedObject3D`)],p);export{p as ViewshedObserverManipulatedObject3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{createCoordinateHelper as a}from"../../../interactive/coordinateHelper.js";import{EditGeometry as o}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as s}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as c}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as l}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingVisualizer3D as u}from"../../interactive/SnappingVisualizer3D.js";let d=class extends t{constructor(e){super(e),this._updatingHandles=new i}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}destroy(){this._updatingHandles.destroy()}createObserverMoveSnappingPipeline(e,t,n,r=!1){if(e!==0)return null;let i=new c({elevationInfo:n,pointer:t,editGeometryOperations:new s(new o(`point`,a(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new u});return l({snappingContext:i,snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:r})}};e([n({constructOnly:!0})],d.prototype,`view`,void 0),e([n({constructOnly:!0})],d.prototype,`snappingManager`,void 0),e([n()],d.prototype,`updating`,null),d=e([r(`esri.views.3d.analysis.Viewshed.ViewshedSnappingController`)],d);export{d as ViewshedSnappingController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{createCoordinateHelper as a}from"../../../interactive/coordinateHelper.js";import{EditGeometry as o}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as s}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as c}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as l}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingVisualizer3D as u}from"../../interactive/SnappingVisualizer3D.js";let d=class extends t{constructor(e){super(e),this._updatingHandles=new i}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}destroy(){this._updatingHandles.destroy()}createObserverMoveSnappingPipeline(e,t,n,r=!1){if(e!==0)return null;let i=new c({elevationInfo:n,pointer:t,editGeometryOperations:new s(new o(`point`,a(!0,!1,this.view.spatialReference)),this.view.state.isGlobal),visualizer:new u});return l({snappingContext:i,snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:r})}};e([n({constructOnly:!0})],d.prototype,`view`,void 0),e([n({constructOnly:!0})],d.prototype,`snappingManager`,void 0),e([n()],d.prototype,`updating`,null),d=e([r(`esri.views.3d.analysis.Viewshed.ViewshedSnappingController`)],d);export{d as ViewshedSnappingController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{acquireForFeaturePlacement as c}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as l}from"../../../interactive/snapping/snappingUtils.js";import{newToolIntersector as u}from"../../../interactive/ToolIntersector.js";import{detachToolFromView as d}from"./toolLifecycleUtils.js";import{ViewshedEditTool as f}from"./ViewshedEditTool.js";import{ViewshedPlacementController as p}from"./ViewshedPlacementController.js";let m=class extends t{constructor(e){super(e),this._editTool=null,this._updatingHandles=new s}initialize(){let{view:e}=this,t=u(e.state.viewingMode);this._snappingManagerResult=c(e),this.addHandles(this._snappingManagerResult),this._placementController=new p({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e,callbacks:{cancelTool:()=>{e.activeTool!=null&&(e.activeTool=null)},findViewshedComputedData:e=>this._findViewshedComputedData(e),setSelectedViewshed:e=>{this.analysisViewData.selectedViewshed=e}}}),l(this),this.addHandles([a(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:n,interactive:r})=>{r?n==null?this._editTool||(this._editTool=new f({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e}),e.tools.add(this._editTool)):this._destroyEditTool():(this._placementController.cancelPlaceOperation(),this._destroyEditTool())},o),this._updatingHandles.add(()=>e.activeTool,e=>{e!=null&&e!==this._editTool&&this._placementController.creationState==null&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),i(this._placementController),this._updatingHandles.destroy()}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._updatingHandles.updating||this._placementController.updating||!!this._editTool?.updating}get creating(){return this._placementController.creationState!=null}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}async place(e,t){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(e,t),e===`single`)return{}}_findViewshedComputedData(e){return this.analysisViewData.viewshedComputedDataHandles?.find(t=>t.viewshedComputedData.viewshed===e)?.viewshedComputedData}_destroyEditTool(){let e=this._editTool;this._editTool=null,e!=null&&(d(this.view,e),i(e))}get test(){}};e([n({constructOnly:!0})],m.prototype,`view`,void 0),e([n({constructOnly:!0})],m.prototype,`analysis`,void 0),e([n({constructOnly:!0})],m.prototype,`analysisViewData`,void 0),e([n()],m.prototype,`_placementController`,void 0),e([n()],m.prototype,`_editTool`,void 0),e([n()],m.prototype,`_snappingManagerResult`,void 0),e([n()],m.prototype,`selectedViewshedComputedData`,null),e([n()],m.prototype,`stagedViewshed`,null),e([n()],m.prototype,`active`,null),e([n()],m.prototype,`updating`,null),e([n()],m.prototype,`creating`,null),e([n()],m.prototype,`snappingOptions`,null),m=e([r(`esri.views.3d.analysis.Viewshed.ViewshedTool`)],m);const h=m;export{h as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{acquireForFeaturePlacement as c}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as l}from"../../../interactive/snapping/snappingUtils.js";import{newToolIntersector as u}from"../../../interactive/ToolIntersector.js";import{detachToolFromView as d}from"./toolLifecycleUtils.js";import{ViewshedEditTool as f}from"./ViewshedEditTool.js";import{ViewshedPlacementController as p}from"./ViewshedPlacementController.js";let m=class extends t{constructor(e){super(e),this._editTool=null,this._updatingHandles=new s}initialize(){let{view:e}=this,t=u(e.state.isGlobal);this._snappingManagerResult=c(e),this.addHandles(this._snappingManagerResult),this._placementController=new p({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e,callbacks:{cancelTool:()=>{e.activeTool!=null&&(e.activeTool=null)},findViewshedComputedData:e=>this._findViewshedComputedData(e),setSelectedViewshed:e=>{this.analysisViewData.selectedViewshed=e}}}),l(this),this.addHandles([a(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:n,interactive:r})=>{r?n==null?this._editTool||(this._editTool=new f({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e}),e.tools.add(this._editTool)):this._destroyEditTool():(this._placementController.cancelPlaceOperation(),this._destroyEditTool())},o),this._updatingHandles.add(()=>e.activeTool,e=>{e!=null&&e!==this._editTool&&this._placementController.creationState==null&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),i(this._placementController),this._updatingHandles.destroy()}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._updatingHandles.updating||this._placementController.updating||!!this._editTool?.updating}get creating(){return this._placementController.creationState!=null}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}async place(e,t){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(e,t),e===`single`)return{}}_findViewshedComputedData(e){return this.analysisViewData.viewshedComputedDataHandles?.find(t=>t.viewshedComputedData.viewshed===e)?.viewshedComputedData}_destroyEditTool(){let e=this._editTool;this._editTool=null,e!=null&&(d(this.view,e),i(e))}get test(){}};e([n({constructOnly:!0})],m.prototype,`view`,void 0),e([n({constructOnly:!0})],m.prototype,`analysis`,void 0),e([n({constructOnly:!0})],m.prototype,`analysisViewData`,void 0),e([n()],m.prototype,`_placementController`,void 0),e([n()],m.prototype,`_editTool`,void 0),e([n()],m.prototype,`_snappingManagerResult`,void 0),e([n()],m.prototype,`selectedViewshedComputedData`,null),e([n()],m.prototype,`stagedViewshed`,null),e([n()],m.prototype,`active`,null),e([n()],m.prototype,`updating`,null),e([n()],m.prototype,`creating`,null),e([n()],m.prototype,`snappingOptions`,null),m=e([r(`esri.views.3d.analysis.Viewshed.ViewshedTool`)],m);const h=m;export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as n}from"../../../analysis/featureReferenceUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import"../../../core/has.js";import{copy as a,exactEquals as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../core/Logger.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{abortMaybe as u,destroyMaybe as d}from"../../../core/maybe.js";import{watch as f,initial as p,when as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{canProjectWithoutEngine as g,isLoaded as _}from"../../../geometry/projectionUtils.js";import{createElevationUpdateHandle as v}from"../support/elevationUpdateUtils.js";import{Intersector as y}from"../webgl-engine/lib/Intersector.js";import{Viewshed as b}from"../webgl-engine/lib/Viewshed.js";import x from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as S}from"./support/projectionUtils.js";import{registerAnalysisView as C,unselectViewshedInOtherAnalysisViews as w}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as T}from"./Viewshed/ViewshedComputedData.js";import E from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as D}from"./Viewshed/ViewshedVisualization.js";let O=class extends x{constructor(e){super(e),this.type=`viewshed-view-3d`,this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){let t=e!=null&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){let e=this.view;this.addHandles(C(e,this)),this._viewshedRenderNode=new b({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new y(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=l(()=>this.analysis.viewsheds,t=>{let n=new T({view:e,viewshed:t}),r=Symbol();return this.addHandles([f(()=>({valid:n.valid,canProject:g(n.observer?.spatialReference,this.view.spatialReference)||_()}),({valid:e,canProject:t},r)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(n):r?.valid&&r?.canProject&&this._removeViewshedsFromRenderer(n),t||S(this.analysis,n.observer.spatialReference,c.getLogger(this)))},p),v({view:e,geometry:()=>n.observer,onElevationChanges:()=>n.onElevationChange()}),f(()=>[e.state.camera,e.slice.plane,n.elevationAlignedObserverRenderSpace,n.elevationAlignedTargetRenderSpace,n.verticalFieldOfView,n.horizontalFieldOfView,n.feature],()=>{this._updateObserverFromFeature(e,n)},p)],r),{viewshedComputedData:n,remove:()=>{this.selectedViewshed===n.viewshed&&(this.selectedViewshed=null),this.removeHandles(r),this._removeViewshedsFromRenderer(n),n.destroy()}}}),this._visualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new E({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([f(()=>this.visible,e=>{let t=this.viewshedComputedDataHandles;if(t==null)return;e||(this.selectedViewshed=null);let n=t.items.values().map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(n):this._removeViewshedsFromRenderer(n)}),m(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=u(this.userOperation),this._tool=d(this._tool),this._visualization=d(this._visualization);let e=this.viewshedComputedDataHandles;e!=null&&this._removeViewshedsFromRenderer(e.items.map(e=>e.viewshedComputedData))}async createViewsheds(e){return this._tool.place(`multiple`,e)}place(e){return this._tool.place(`single`,e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,r){let i=r.elevationAlignedObserverRenderSpace,c=r.elevationAlignedTargetRenderSpace,l=a(s(),i),u={observer:i,observerSurfaceNormal:null,observerAdjusted:l,observerFeatureId:t(r.feature),target:c,targetSurfaceNormal:null,targetAdjusted:a(s(),c),targetFeatureId:null};n(e,this._intersector,u,e=>Math.min(e,.05*r.farDistanceRenderSpace)),r.observerRenderSpaceOverride=o(l,i)?null:l}_unselectOtherViewsheds(e){e!=null&&w(this.view,this)}get test(){}};e([r({readOnly:!0})],O.prototype,`type`,void 0),e([r({constructOnly:!0,nonNullable:!0})],O.prototype,`analysis`,void 0),e([r()],O.prototype,`_tool`,void 0),e([r()],O.prototype,`toolActive`,null),e([r()],O.prototype,`toolCreating`,null),e([r()],O.prototype,`stagedViewshed`,null),e([r()],O.prototype,`_selectedViewshed`,void 0),e([r()],O.prototype,`selectedViewshed`,null),e([r()],O.prototype,`selectedViewshedComputedData`,null),e([r()],O.prototype,`viewshedComputedDataHandles`,void 0),e([r()],O.prototype,`userOperation`,void 0),e([r()],O.prototype,`updating`,null),e([r()],O.prototype,`_visualization`,void 0),e([r()],O.prototype,`_viewshedRenderNode`,void 0),O=e([i(`esri.views.3d.analysis.ViewshedAnalysisView3D`)],O);const k=O;export{k as default};
2
+ import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as n}from"../../../analysis/featureReferenceUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import"../../../core/has.js";import{copy as a,exactEquals as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../core/Logger.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{abortMaybe as u,destroyMaybe as d}from"../../../core/maybe.js";import{watch as f,initial as p,when as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{canProjectWithoutEngine as g,isLoaded as _}from"../../../geometry/projectionUtils.js";import{createElevationUpdateHandle as v}from"../support/elevationUpdateUtils.js";import{Intersector as y}from"../webgl-engine/lib/Intersector.js";import{Viewshed as b}from"../webgl-engine/lib/Viewshed.js";import x from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as S}from"./support/projectionUtils.js";import{registerAnalysisView as C,unselectViewshedInOtherAnalysisViews as w}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as T}from"./Viewshed/ViewshedComputedData.js";import E from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as D}from"./Viewshed/ViewshedVisualization.js";let O=class extends x{constructor(e){super(e),this.type=`viewshed-view-3d`,this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){let t=e!=null&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){let e=this.view;this.addHandles(C(e,this)),this._viewshedRenderNode=new b({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new y(this.view.state.isGlobal),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=l(()=>this.analysis.viewsheds,t=>{let n=new T({view:e,viewshed:t}),r=Symbol();return this.addHandles([f(()=>({valid:n.valid,canProject:g(n.observer?.spatialReference,this.view.spatialReference)||_()}),({valid:e,canProject:t},r)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(n):r?.valid&&r?.canProject&&this._removeViewshedsFromRenderer(n),t||S(this.analysis,n.observer.spatialReference,c.getLogger(this)))},p),v({view:e,geometry:()=>n.observer,onElevationChanges:()=>n.onElevationChange()}),f(()=>[e.state.camera,e.slice.plane,n.elevationAlignedObserverRenderSpace,n.elevationAlignedTargetRenderSpace,n.verticalFieldOfView,n.horizontalFieldOfView,n.feature],()=>{this._updateObserverFromFeature(e,n)},p)],r),{viewshedComputedData:n,remove:()=>{this.selectedViewshed===n.viewshed&&(this.selectedViewshed=null),this.removeHandles(r),this._removeViewshedsFromRenderer(n),n.destroy()}}}),this._visualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new E({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([f(()=>this.visible,e=>{let t=this.viewshedComputedDataHandles;if(t==null)return;e||(this.selectedViewshed=null);let n=t.items.values().map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(n):this._removeViewshedsFromRenderer(n)}),m(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=u(this.userOperation),this._tool=d(this._tool),this._visualization=d(this._visualization);let e=this.viewshedComputedDataHandles;e!=null&&this._removeViewshedsFromRenderer(e.items.map(e=>e.viewshedComputedData))}async createViewsheds(e){return this._tool.place(`multiple`,e)}place(e){return this._tool.place(`single`,e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,r){let i=r.elevationAlignedObserverRenderSpace,c=r.elevationAlignedTargetRenderSpace,l=a(s(),i),u={observer:i,observerSurfaceNormal:null,observerAdjusted:l,observerFeatureId:t(r.feature),target:c,targetSurfaceNormal:null,targetAdjusted:a(s(),c),targetFeatureId:null};n(e,this._intersector,u,e=>Math.min(e,.05*r.farDistanceRenderSpace)),r.observerRenderSpaceOverride=o(l,i)?null:l}_unselectOtherViewsheds(e){e!=null&&w(this.view,this)}get test(){}};e([r({readOnly:!0})],O.prototype,`type`,void 0),e([r({constructOnly:!0,nonNullable:!0})],O.prototype,`analysis`,void 0),e([r()],O.prototype,`_tool`,void 0),e([r()],O.prototype,`toolActive`,null),e([r()],O.prototype,`toolCreating`,null),e([r()],O.prototype,`stagedViewshed`,null),e([r()],O.prototype,`_selectedViewshed`,void 0),e([r()],O.prototype,`selectedViewshed`,null),e([r()],O.prototype,`selectedViewshedComputedData`,null),e([r()],O.prototype,`viewshedComputedDataHandles`,void 0),e([r()],O.prototype,`userOperation`,void 0),e([r()],O.prototype,`updating`,null),e([r()],O.prototype,`_visualization`,void 0),e([r()],O.prototype,`_viewshedRenderNode`,void 0),O=e([i(`esri.views.3d.analysis.ViewshedAnalysisView3D`)],O);const k=O;export{k as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromExtent as c,width as l,height as u,expand as d}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as f}from"../../../../geometry/support/coordinateSystem.js";import{euclideanDirectDistance as p}from"../../../support/euclideanLengthMeasurementUtils.js";let m=class extends n{constructor(e){super(e)}get localOriginRenderSpace(){let{extent:e,localOrigin:t,renderCoordsHelper:n}=this,r=o();return n.toRenderCoords(t,e.spatialReference,r),r}get cameraPositionRenderSpace(){let{localOriginRenderSpace:e,renderCoordsHelper:t}=this,n=o(),r=1/t.unitInMeters;return t.setAltitude(n,v*r,e),n}get boundingRect(){let{extent:e,renderCoordsHelper:t}=this,n=s();return t.viewingMode===2?c(e,n):(this._expandBoundingRect(e.xmin,e.ymin,n),this._expandBoundingRect(e.xmax,e.ymin,n),this._expandBoundingRect(e.xmin,e.ymax,n),this._expandBoundingRect(e.xmax,e.ymax,n)),n}get dimensions(){let e,t,{viewingMode:n,spatialReference:r}=this.renderCoordsHelper;return n===2&&r.isWebMercator?{width:e,height:t}=h(this.extent):(e=l(this.boundingRect),t=u(this.boundingRect)),{width:e,height:t}}get cameraDimensions(){let{boundingRect:e}=this;return{width:l(e),height:u(e)}}get cameraNearFar(){let{renderCoordsHelper:{unitInMeters:e}}=this,t=1/e;return{near:y*t,far:b*t}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,o())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,o())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,o())}_expandBoundingRect(e,t,n){let{extent:r,eastVector:i,northVector:o,upVector:s,renderCoordsHelper:c}=this,l=r.center.z??0;a(g,e,t,l),c.toRenderCoords(g,r.spatialReference,g),f(g,i,o,s,_),d(n,_,n)}};e([r()],m.prototype,`renderCoordsHelper`,void 0),e([r()],m.prototype,`extent`,void 0),e([r()],m.prototype,`localOrigin`,void 0),e([r()],m.prototype,`localOriginRenderSpace`,null),e([r()],m.prototype,`cameraPositionRenderSpace`,null),e([r()],m.prototype,`boundingRect`,null),e([r()],m.prototype,`dimensions`,null),e([r()],m.prototype,`cameraDimensions`,null),e([r()],m.prototype,`upVector`,null),e([r()],m.prototype,`northVector`,null),e([r()],m.prototype,`eastVector`,null),m=e([i(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation`)],m);function h(e){let t=p([e.xmin,e.ymin,0],[e.xmax,e.ymin,0],e.spatialReference),n=p([e.xmin,e.ymin,0],[e.xmin,e.ymax,0],e.spatialReference);return{width:t?.value??0,height:n?.value??0}}const g=o(),_=o(),v=t.maxTargetElevation,y=0,b=t.targetElevationRange+100;export{m as VolumeMeasurementCutFillComputation};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromExtent as c,width as l,height as u,expand as d}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as f}from"../../../../geometry/support/coordinateSystem.js";import{euclideanDirectDistance as p}from"../../../support/euclideanLengthMeasurementUtils.js";let m=class extends n{constructor(e){super(e)}get localOriginRenderSpace(){let{extent:e,localOrigin:t,renderCoordsHelper:n}=this,r=o();return n.toRenderCoords(t,e.spatialReference,r),r}get cameraPositionRenderSpace(){let{localOriginRenderSpace:e,renderCoordsHelper:t}=this,n=o(),r=1/t.unitInMeters;return t.setAltitude(n,v*r,e),n}get boundingRect(){let{extent:e,renderCoordsHelper:t}=this,n=s();return t.isGlobal?(this._expandBoundingRect(e.xmin,e.ymin,n),this._expandBoundingRect(e.xmax,e.ymin,n),this._expandBoundingRect(e.xmin,e.ymax,n),this._expandBoundingRect(e.xmax,e.ymax,n)):c(e,n),n}get dimensions(){let e,t,{isGlobal:n,spatialReference:r}=this.renderCoordsHelper;return!n&&r.isWebMercator?{width:e,height:t}=h(this.extent):(e=l(this.boundingRect),t=u(this.boundingRect)),{width:e,height:t}}get cameraDimensions(){let{boundingRect:e}=this;return{width:l(e),height:u(e)}}get cameraNearFar(){let{renderCoordsHelper:{unitInMeters:e}}=this,t=1/e;return{near:y*t,far:b*t}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,o())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,o())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,o())}_expandBoundingRect(e,t,n){let{extent:r,eastVector:i,northVector:o,upVector:s,renderCoordsHelper:c}=this,l=r.center.z??0;a(g,e,t,l),c.toRenderCoords(g,r.spatialReference,g),f(g,i,o,s,_),d(n,_,n)}};e([r()],m.prototype,`renderCoordsHelper`,void 0),e([r()],m.prototype,`extent`,void 0),e([r()],m.prototype,`localOrigin`,void 0),e([r()],m.prototype,`localOriginRenderSpace`,null),e([r()],m.prototype,`cameraPositionRenderSpace`,null),e([r()],m.prototype,`boundingRect`,null),e([r()],m.prototype,`dimensions`,null),e([r()],m.prototype,`cameraDimensions`,null),e([r()],m.prototype,`upVector`,null),e([r()],m.prototype,`northVector`,null),e([r()],m.prototype,`eastVector`,null),m=e([i(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation`)],m);function h(e){let t=p([e.xmin,e.ymin,0],[e.xmax,e.ymin,0],e.spatialReference),n=p([e.xmin,e.ymin,0],[e.xmin,e.ymax,0],e.spatialReference);return{width:t?.value??0,height:n?.value??0}}const g=o(),_=o(),v=t.maxTargetElevation,y=0,b=t.targetElevationRange+100;export{m as VolumeMeasurementCutFillComputation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../../core/arrayUtils.js";import{cyclicalPI as o}from"../../../../core/Cyclical.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as c,normalize as l,subtract as u,cross as d,dot as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{destroyMaybe as h}from"../../../../core/maybe.js";import{isPromiseLike as g}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as _,formatDecimal as v}from"../../../../core/quantityFormatUtils.js";import{initial as y}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{adaptiveVolumeUnit as x}from"../../../../core/units.js";import{computeTranslationToOriginAndRotation as S}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{t as C}from"../../../../chunks/vec3.js";import{angleAroundAxis as w}from"../../../../geometry/support/vector.js";import{onLocaleChange as T,substitute as E,fetchMessageBundle as D}from"../../../../intl.js";import O from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as k}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as j}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as N}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as P}from"../../layers/graphics/extrudePolygon.js";import{polygonToRenderInfoElevationAligned as F}from"../../support/renderInfoUtils/polygon.js";import{CutFill as I,VolumeGeometry as L}from"../../webgl-engine/lib/CutFill.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let z=class extends n{get visible(){return this.viewData.visible&&this.viewData.elevationAlignedGeometry!=null&&this.viewData.targetGeometry!=null}get inView(){return this.viewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){let{error:e}=this.viewData;return e?[`unsupported-coordinate-system`,`unsupported-layer-transparency`].includes(e.name):!1}get _extrusionHeights(){let{renderCoordsHelper:e}=this.view,{depthExtremaPositions:n,targetGeometry:r}=this.viewData,{targetElevationRange:i}=t;if(!r||!n)return{cut:i,fill:-i};let a=-1/0;for(let e of r.rings)for(let t of e)a=Math.max(a,t[2]);let o=e.getAltitude(n.fill);return{cut:i,fill:Math.min(o-a,0)-1}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new b,this._elevationContext=N.fromElevationInfo(new O({mode:`absolute-height`})),this._projectionLines=[]}initialize(){let{view:e}=this,n={view:e,isDecoration:!0},r=t,i={...n,width:r.geometryOutlineWidth};this._elevationAlignedGeometry=new j({...i,isDraped:!0,color:r.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new j(i);let a={...n,attached:!0,width:r.projectionLineWidth,renderOccluded:4,polygonOffset:3},o={...a,stipplePattern:R(r.projectionLineStippleSize)},s=r.cutProjectionLineColor.toUnitRGBA(),c=r.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new A({...a,color:s}),this._occludedCutProjectionLines=new A({...o,color:s}),this._fillProjectionLines=new A({...a,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new A({...o,color:c});let l={...n,attached:!0};this._cutVolumeLabel=new k({...l,distance:r.labelDistance}),this._fillVolumeLabel=new k({...l,distance:-r.labelDistance}),this._visualization=new I({view:e,cutColor:r.cutColor,fillColor:r.fillColor,borderColor:r.geometryOutlineColor}),this.addHandles([this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},y),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:n})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&n===`cut-fill`,this._visualization.measureType=n},y),this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:n})=>this._updateProjectionLines(e,t,n),y),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.viewData.result}),({interactive:e,accentColor:t,hasResult:n})=>{this._updateColors(e,t,n)},y),this._updatingHandles.add(()=>[this.viewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),y),this._updatingHandles.add(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),y),this._updatingHandles.add(()=>{let{messages:e,unitsMessages:t,visible:n,viewData:r}=this;return{depthExtremaPositions:r.depthExtremaPositions,effectiveDisplayUnits:r.effectiveDisplayUnits,messages:e,unitsMessages:t,result:r.result,visible:n&&!!r.result}},e=>this._updateLabels(e)),this._updatingHandles.add(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),y),T(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=h(this._elevationAlignedGeometry),this._targetGeometry=h(this._targetGeometry),this._cutProjectionLines=h(this._cutProjectionLines),this._occludedCutProjectionLines=h(this._occludedCutProjectionLines),this._fillProjectionLines=h(this._fillProjectionLines),this._occludedFillProjectionLines=h(this._occludedFillProjectionLines),this._cutVolumeLabel=h(this._cutVolumeLabel),this._fillVolumeLabel=h(this._fillVolumeLabel),this._visualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,n){if(this._cutProjectionLines.visible=n,this._occludedCutProjectionLines.visible=n,this._fillProjectionLines.visible=n,this._occludedFillProjectionLines.visible=n,!e||!t)return;let{renderCoordsHelper:r}=this.view,i=[],o=[],s=[],l=[],u=[],d=e.spatialReference;for(let n=0;n<e.rings.length;n++){let f=e.rings[n],m=f.length>1&&a(f[0],f[f.length-1]),h=f.length-+!!m,g=[];for(let e=0;e<h;++e){let i=f[e],a=c(p(),i[0],i[1],i[2]);r.toRenderCoords(a,d,a);let o=t.rings[n][e],s=c(p(),o[0],o[1],o[2]);r.toRenderCoords(s,d,s);let l=new M(a,s);g.push(l)}let _=this.view.state.camera;for(let e=0;e<g.length;++e){let r=g[e],a=g[e===0?g.length-1:e-1],c=g[e===g.length-1?0:e+1],d=f[e],p=t.rings[n][e],m=d[2]>p[2],h=new V(r,a,c,m);i.push(h),h.updateOccluded(_);let v=h.isOccluded;m?(v?s:o).push(r):(v?u:l).push(r)}}this._projectionLines=i,this._cutProjectionLines.setGeometryFromSegments(o),this._occludedCutProjectionLines.setGeometryFromSegments(s),this._fillProjectionLines.setGeometryFromSegments(l),this._occludedFillProjectionLines.setGeometryFromSegments(u)}_updateProjectionLineOcclusion(e){let t=[],n=[],r=[],i=[],a=!1,o=!1;for(let s of this._projectionLines){s.updateOccluded(e)&&(a||=s.isCut,o||=!s.isCut);let c=s.isOccluded;(s.isCut?c?n:t:c?i:r).push(s.segment)}o&&(this._fillProjectionLines.setGeometryFromSegments(r),this._occludedFillProjectionLines.setGeometryFromSegments(i)),a&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(n))}_updateColors(e,n,r){let{geometryOutlineColor:i,cutColor:a,fillColor:o,cutColorMuted:s,fillColorMuted:c,cutProjectionLineColor:l,fillProjectionLineColor:u}=t;if(this._visualization.cutColor=r?a:s,this._visualization.fillColor=r?o:c,e){let e=n.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._visualization.borderColor=n}else{this._targetGeometry.color=i.toUnitRGBA();let e=(r?l:s).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;let t=(r?u:c).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._visualization.borderColor=i}}_updateLabels(e){let{effectiveDisplayUnits:t,depthExtremaPositions:n,messages:r,unitsMessages:i,result:a,visible:o}=e;if(this._cutVolumeLabel.visible=o,this._fillVolumeLabel.visible=o,this._cutVolumeLabel.geometry=n?{type:`point`,point:n.cut}:null,this._fillVolumeLabel.geometry=n?{type:`point`,point:n.fill}:null,a==null||r==null||i==null){this._cutVolumeLabel.text=`-`,this._fillVolumeLabel.text=`-`;return}let s=t.volume,c=E(r.labels.cut,{volume:B(i,a.cutVolume,s)}),l=E(r.labels.fill,{volume:B(i,a.fillVolume,s)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=l}_updateCutFillVisibility(e){e?this._visualization.enable():this._visualization.disable()}get _polygonRenderInfo(){let{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:n}=this.viewData;if(n==null)return null;let r=F(n,t,e,this._elevationContext,{outlineOutput:`tessellated-indices`});return g(r)?(this._updatingHandles.consumePromise(r),null):r}_updateCutFillGeometry(){let{view:e,viewData:t,inView:n}=this,{renderCoordsHelper:r}=e,{targetGeometry:i}=t,{cut:a,fill:o}=this._extrusionHeights;if(!i?.extent||!n)return;let{center:s}=i.extent,c=m(s.x,s.y,0),l=p();r.toRenderCoords(c,i.spatialReference,l);let u=this._getExtrudedVolume(a,c,l),d=this._getExtrudedVolume(o,c,l);u!=null&&d!=null&&this._visualization.updateGeometries(u,d,l)}_getExtrudedVolume(e,t,n){let{renderCoordsHelper:r,spatialReference:i}=this.view,a=p(),o=r.viewingMode===1;r.worldUpAtPosition(n,a);let c=P(this._polygonRenderInfo,{height:e,worldUp:a,spherical:o,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(c==null)return null;let l=s(),u=s();if(S(i,t,l,r.spatialReference),u[12]=-l[12],u[13]=-l[13],u[14]=-l[14],C(c.vertices,c.vertices,u),this.analysis.measureType===`stockpile`)for(let e=0;e<c.normals.length;e+=3)c.normals[e]=a[0],c.normals[e+1]=a[1],c.normals[e+2]=a[2];return new L(c.vertices,c.bottomIndices,c.indices,c.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await D(`esri/core/t9n/Units`),this.messages=await D(`esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis`)}finally{this.loadingMessages=!1}}};e([r({constructOnly:!0})],z.prototype,`view`,void 0),e([r({constructOnly:!0})],z.prototype,`analysis`,void 0),e([r({constructOnly:!0})],z.prototype,`viewData`,void 0),e([r()],z.prototype,`unitsMessages`,void 0),e([r()],z.prototype,`messages`,void 0),e([r()],z.prototype,`loadingMessages`,void 0),e([r({readOnly:!0})],z.prototype,`_updatingHandles`,void 0),e([r({readOnly:!0})],z.prototype,`visible`,null),e([r()],z.prototype,`inView`,null),e([r()],z.prototype,`updating`,null),e([r()],z.prototype,`hasUnsupportedError`,null),e([r()],z.prototype,`_extrusionHeights`,null),e([r()],z.prototype,`_polygonRenderInfo`,null),z=e([i(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementVisualization`)],z);function B(e,t,n){if(!t||!e)return null;let r=x(t.value,t.unit,n),i=_(r);return v(e,t,r,i)}class V{constructor(e,t,n,r){this.segment=e,this.previous=t,this.next=n,this.isCut=r,this._isOccluded=!1,this._n1=p(),this._n2=p();let i=l(H,u(H,e.endRenderSpace,e.startRenderSpace));l(this._n1,d(this._n1,i,l(U,u(U,t.startRenderSpace,e.startRenderSpace)))),l(this._n2,d(this._n2,i,l(U,u(U,e.startRenderSpace,n.startRenderSpace)))),this._isConvex=o.normalize(w(this._n1,this._n2,i))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){u(H,this.segment.startRenderSpace,e.eye);let t=f(this._n1,H)<0,n=f(this._n2,H)<0,r=this._isOccluded;return this._isOccluded=this._isConvex?t&&n:t||n,this._isOccluded!==r}}const H=p(),U=p();export{z as VolumeMeasurementVisualization};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import n from"../../../../core/Accessor.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../../core/arrayUtils.js";import{cyclicalPI as o}from"../../../../core/Cyclical.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as c,normalize as l,subtract as u,cross as d,dot as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{destroyMaybe as h}from"../../../../core/maybe.js";import{isPromiseLike as g}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as _,formatDecimal as v}from"../../../../core/quantityFormatUtils.js";import{initial as y}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{adaptiveVolumeUnit as x}from"../../../../core/units.js";import{computeTranslationToOriginAndRotation as S}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{t as C}from"../../../../chunks/vec3.js";import{angleAroundAxis as w}from"../../../../geometry/support/vector.js";import{onLocaleChange as T,substitute as E,fetchMessageBundle as D}from"../../../../intl.js";import O from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as k}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as j}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as N}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as P}from"../../layers/graphics/extrudePolygon.js";import{polygonToRenderInfoElevationAligned as F}from"../../support/renderInfoUtils/polygon.js";import{CutFill as I,VolumeGeometry as L}from"../../webgl-engine/lib/CutFill.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let z=class extends n{get visible(){return this.viewData.visible&&this.viewData.elevationAlignedGeometry!=null&&this.viewData.targetGeometry!=null}get inView(){return this.viewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){let{error:e}=this.viewData;return e?[`unsupported-coordinate-system`,`unsupported-layer-transparency`].includes(e.name):!1}get _extrusionHeights(){let{renderCoordsHelper:e}=this.view,{depthExtremaPositions:n,targetGeometry:r}=this.viewData,{targetElevationRange:i}=t;if(!r||!n)return{cut:i,fill:-i};let a=-1/0;for(let e of r.rings)for(let t of e)a=Math.max(a,t[2]);let o=e.getAltitude(n.fill);return{cut:i,fill:Math.min(o-a,0)-1}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new b,this._elevationContext=N.fromElevationInfo(new O({mode:`absolute-height`})),this._projectionLines=[]}initialize(){let{view:e}=this,n={view:e,isDecoration:!0},r=t,i={...n,width:r.geometryOutlineWidth};this._elevationAlignedGeometry=new j({...i,isDraped:!0,color:r.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new j(i);let a={...n,attached:!0,width:r.projectionLineWidth,renderOccluded:4,polygonOffset:3},o={...a,stipplePattern:R(r.projectionLineStippleSize)},s=r.cutProjectionLineColor.toUnitRGBA(),c=r.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new A({...a,color:s}),this._occludedCutProjectionLines=new A({...o,color:s}),this._fillProjectionLines=new A({...a,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new A({...o,color:c});let l={...n,attached:!0};this._cutVolumeLabel=new k({...l,distance:r.labelDistance}),this._fillVolumeLabel=new k({...l,distance:-r.labelDistance}),this._visualization=new I({view:e,cutColor:r.cutColor,fillColor:r.fillColor,borderColor:r.geometryOutlineColor}),this.addHandles([this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},y),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:n})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&n===`cut-fill`,this._visualization.measureType=n},y),this._updatingHandles.add(()=>({elevationAlignedGeometry:this.viewData.elevationAlignedGeometry,targetGeometry:this.viewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:n})=>this._updateProjectionLines(e,t,n),y),this._updatingHandles.add(()=>({interactive:this.viewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.viewData.result}),({interactive:e,accentColor:t,hasResult:n})=>{this._updateColors(e,t,n)},y),this._updatingHandles.add(()=>[this.viewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),y),this._updatingHandles.add(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),y),this._updatingHandles.add(()=>{let{messages:e,unitsMessages:t,visible:n,viewData:r}=this;return{depthExtremaPositions:r.depthExtremaPositions,effectiveDisplayUnits:r.effectiveDisplayUnits,messages:e,unitsMessages:t,result:r.result,visible:n&&!!r.result}},e=>this._updateLabels(e)),this._updatingHandles.add(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),y),T(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=h(this._elevationAlignedGeometry),this._targetGeometry=h(this._targetGeometry),this._cutProjectionLines=h(this._cutProjectionLines),this._occludedCutProjectionLines=h(this._occludedCutProjectionLines),this._fillProjectionLines=h(this._fillProjectionLines),this._occludedFillProjectionLines=h(this._occludedFillProjectionLines),this._cutVolumeLabel=h(this._cutVolumeLabel),this._fillVolumeLabel=h(this._fillVolumeLabel),this._visualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,n){if(this._cutProjectionLines.visible=n,this._occludedCutProjectionLines.visible=n,this._fillProjectionLines.visible=n,this._occludedFillProjectionLines.visible=n,!e||!t)return;let{renderCoordsHelper:r}=this.view,i=[],o=[],s=[],l=[],u=[],d=e.spatialReference;for(let n=0;n<e.rings.length;n++){let f=e.rings[n],m=f.length>1&&a(f[0],f[f.length-1]),h=f.length-+!!m,g=[];for(let e=0;e<h;++e){let i=f[e],a=c(p(),i[0],i[1],i[2]);r.toRenderCoords(a,d,a);let o=t.rings[n][e],s=c(p(),o[0],o[1],o[2]);r.toRenderCoords(s,d,s);let l=new M(a,s);g.push(l)}let _=this.view.state.camera;for(let e=0;e<g.length;++e){let r=g[e],a=g[e===0?g.length-1:e-1],c=g[e===g.length-1?0:e+1],d=f[e],p=t.rings[n][e],m=d[2]>p[2],h=new V(r,a,c,m);i.push(h),h.updateOccluded(_);let v=h.isOccluded;m?(v?s:o).push(r):(v?u:l).push(r)}}this._projectionLines=i,this._cutProjectionLines.setGeometryFromSegments(o),this._occludedCutProjectionLines.setGeometryFromSegments(s),this._fillProjectionLines.setGeometryFromSegments(l),this._occludedFillProjectionLines.setGeometryFromSegments(u)}_updateProjectionLineOcclusion(e){let t=[],n=[],r=[],i=[],a=!1,o=!1;for(let s of this._projectionLines){s.updateOccluded(e)&&(a||=s.isCut,o||=!s.isCut);let c=s.isOccluded;(s.isCut?c?n:t:c?i:r).push(s.segment)}o&&(this._fillProjectionLines.setGeometryFromSegments(r),this._occludedFillProjectionLines.setGeometryFromSegments(i)),a&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(n))}_updateColors(e,n,r){let{geometryOutlineColor:i,cutColor:a,fillColor:o,cutColorMuted:s,fillColorMuted:c,cutProjectionLineColor:l,fillProjectionLineColor:u}=t;if(this._visualization.cutColor=r?a:s,this._visualization.fillColor=r?o:c,e){let e=n.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._visualization.borderColor=n}else{this._targetGeometry.color=i.toUnitRGBA();let e=(r?l:s).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;let t=(r?u:c).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._visualization.borderColor=i}}_updateLabels(e){let{effectiveDisplayUnits:t,depthExtremaPositions:n,messages:r,unitsMessages:i,result:a,visible:o}=e;if(this._cutVolumeLabel.visible=o,this._fillVolumeLabel.visible=o,this._cutVolumeLabel.geometry=n?{type:`point`,point:n.cut}:null,this._fillVolumeLabel.geometry=n?{type:`point`,point:n.fill}:null,a==null||r==null||i==null){this._cutVolumeLabel.text=`-`,this._fillVolumeLabel.text=`-`;return}let s=t.volume,c=E(r.labels.cut,{volume:B(i,a.cutVolume,s)}),l=E(r.labels.fill,{volume:B(i,a.fillVolume,s)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=l}_updateCutFillVisibility(e){e?this._visualization.enable():this._visualization.disable()}get _polygonRenderInfo(){let{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:n}=this.viewData;if(n==null)return null;let r=F(n,t,e,this._elevationContext,{outlineOutput:`tessellated-indices`});return g(r)?(this._updatingHandles.consumePromise(r),null):r}_updateCutFillGeometry(){let{view:e,viewData:t,inView:n}=this,{renderCoordsHelper:r}=e,{targetGeometry:i}=t,{cut:a,fill:o}=this._extrusionHeights;if(!i?.extent||!n)return;let{center:s}=i.extent,c=m(s.x,s.y,0),l=p();r.toRenderCoords(c,i.spatialReference,l);let u=this._getExtrudedVolume(a,c,l),d=this._getExtrudedVolume(o,c,l);u!=null&&d!=null&&this._visualization.updateGeometries(u,d,l)}_getExtrudedVolume(e,t,n){let{renderCoordsHelper:r,spatialReference:i}=this.view,a=p(),o=r.isGlobal;r.worldUpAtPosition(n,a);let c=P(this._polygonRenderInfo,{height:e,worldUp:a,spherical:o,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(c==null)return null;let l=s(),u=s();if(S(i,t,l,r.spatialReference),u[12]=-l[12],u[13]=-l[13],u[14]=-l[14],C(c.vertices,c.vertices,u),this.analysis.measureType===`stockpile`)for(let e=0;e<c.normals.length;e+=3)c.normals[e]=a[0],c.normals[e+1]=a[1],c.normals[e+2]=a[2];return new L(c.vertices,c.bottomIndices,c.indices,c.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await D(`esri/core/t9n/Units`),this.messages=await D(`esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis`)}finally{this.loadingMessages=!1}}};e([r({constructOnly:!0})],z.prototype,`view`,void 0),e([r({constructOnly:!0})],z.prototype,`analysis`,void 0),e([r({constructOnly:!0})],z.prototype,`viewData`,void 0),e([r()],z.prototype,`unitsMessages`,void 0),e([r()],z.prototype,`messages`,void 0),e([r()],z.prototype,`loadingMessages`,void 0),e([r({readOnly:!0})],z.prototype,`_updatingHandles`,void 0),e([r({readOnly:!0})],z.prototype,`visible`,null),e([r()],z.prototype,`inView`,null),e([r()],z.prototype,`updating`,null),e([r()],z.prototype,`hasUnsupportedError`,null),e([r()],z.prototype,`_extrusionHeights`,null),e([r()],z.prototype,`_polygonRenderInfo`,null),z=e([i(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementVisualization`)],z);function B(e,t,n){if(!t||!e)return null;let r=x(t.value,t.unit,n),i=_(r);return v(e,t,r,i)}class V{constructor(e,t,n,r){this.segment=e,this.previous=t,this.next=n,this.isCut=r,this._isOccluded=!1,this._n1=p(),this._n2=p();let i=l(H,u(H,e.endRenderSpace,e.startRenderSpace));l(this._n1,d(this._n1,i,l(U,u(U,t.startRenderSpace,e.startRenderSpace)))),l(this._n2,d(this._n2,i,l(U,u(U,e.startRenderSpace,n.startRenderSpace)))),this._isConvex=o.normalize(w(this._n1,this._n2,i))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){u(H,this.segment.startRenderSpace,e.eye);let t=f(this._n1,H)<0,n=f(this._n2,H)<0,r=this._isOccluded;return this._isOccluded=this._isConvex?t&&n:t||n,this._isOccluded!==r}}const H=p(),U=p();export{z as VolumeMeasurementVisualization};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{transpose as e}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{length as n,distance as r,lerp as i,copy as a,subtract as o,transformMat3 as s,scale as c,cross as l,dot as u,add as d,normalize as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,clone as m,UNIT_Y as h,UNIT_X as g,UNIT_Z as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as v}from"../../../../core/mathUtils.js";import{angle as y,slerp as b}from"../../support/mathUtils.js";class x{get pitch(){return this._pitch}get yaw(){return this._yaw}get distance(){return this._distance}get fov(){return this._fov}get size(){return this._size}constructor(e){this.viewingMode=e,this.center=p(),this._pitch=0,this._yaw=0,this._distance=0,this.direction=m(j),this._fov=55,this._size=1}pixelsPerPanAtZoom(e){return this._size/2/(this._zoomToPanScale*e)}zoomAtPixelsPerPan(e){return this._size/2/(this._zoomToPanScale*e)}pixelsPerRotate(){let e=Math.max(Math.cos(Math.abs(this._pitch)),.5);return this._size/2/e}compareTo(e,t){if(this.viewingMode===1){let r=(n(this.center)+n(e.center))/2;t.pan=y(this.center,e.center)*r}else t.pan=r(this.center,e.center);let i=Math.abs(e._yaw-this._yaw);i>=Math.PI&&(i=2*Math.PI-i);let a=Math.abs(e._pitch-this._pitch);t.rotate=Math.max(i,a),t.fov=e.fov-this.fov,t.sourceZoom=this._distance,t.targetZoom=e._distance}interpolate(e,t,n){this.viewingMode===1?b(e.center,t.center,n.pan,this.center):i(this.center,e.center,t.center,n.pan),this._distance=isFinite(t.distance)?v(e.distance,t.distance+n.zoomOffset,n.zoom):e.distance,this._pitch=v(e.pitch,t.pitch,n.rotate);let r=e._yaw,a=t._yaw;Math.abs(a-r)>=Math.PI&&(r+=(r<a?1:-1)*2*Math.PI),this._yaw=v(r,a,n.rotate),this._fov=v(e.fov,t.fov,n.fov)}copyFrom(e){a(this.center,e.center),this._pitch=e.pitch,this._yaw=e.yaw,this._distance=e.distance,a(this.direction,e.direction),this._size=e.size,this._fov=e.fov,this._zoomToPanScale=Math.atan(.5*this._fov),this.viewingMode=e.viewingMode}copyFromRenderCamera(e){let t=this._lookAtOrientation(e.center,N);a(this.center,e.center),o(D,e.center,e.eye),s(D,D,t),s(O,e.up,t),this._distance=n(D),this._distance!==0&&(D[0]/=this._distance,D[1]/=this._distance,D[2]/=this._distance),this._pitch=S(D),this._yaw=C(D,O),this._size=Math.sqrt(e.width*e.width+e.height*e.height),this._fov=e.fov,this._zoomToPanScale=Math.atan(.5*this._fov)}copyToRenderCamera(t){let n=this._lookAtOrientation(this.center,N);e(n,n),this._axisAngleVec3(M,this._pitch-Math.PI/2,j,D),this._axisAngleVec3(A,this._yaw,D,D),this._axisAngleVec3(M,this._pitch-Math.PI/2,A,O),this._axisAngleVec3(A,this._yaw,O,O),c(D,D,this._distance),s(D,D,n),s(O,O,n),t.center=this.center,t.eye=o(D,this.center,D),t.up=O,t.fov=this._fov}_axisAngleVec3(e,t,n,r){let i=Math.cos(t),a=Math.sin(t);return c(w,n,i),l(T,e,n),c(T,T,a),c(E,e,(1-i)*u(e,n)),d(r,d(r,w,T),E)}_lookAtOrientation(e,n=t()){return this._upAtLookAt(e,E),l(w,this.direction,E),f(w,w),w[0]===0&&w[1]===0&&w[2]===0&&a(w,M),l(T,E,w),f(T,T),n[0]=w[0],n[1]=T[0],n[2]=E[0],n[3]=w[1],n[4]=T[1],n[5]=E[1],n[6]=w[2],n[7]=T[2],n[8]=E[2],n}_upAtLookAt(e,t){return this.viewingMode===2?a(t,A):f(t,e)}}function S(e){return Math.PI-y(A,e)}function C(e,t){let n=k;return Math.abs(t[2])<.5?(a(n,t),e[2]>0&&c(n,n,-1)):a(n,e),l(T,n,A),f(T,T),y(M,T,A)}const w=p(),T=p(),E=p(),D=p(),O=p(),k=p(),A=_,j=h,M=g,N=t();export{x as Camera};
2
+ import{transpose as e}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{length as n,distance as r,lerp as i,copy as a,subtract as o,transformMat3 as s,scale as c,cross as l,dot as u,add as d,normalize as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,clone as m,UNIT_Y as h,UNIT_X as g,UNIT_Z as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as v}from"../../../../core/mathUtils.js";import{angle as y,slerp as b}from"../../support/mathUtils.js";class x{get pitch(){return this._pitch}get yaw(){return this._yaw}get distance(){return this._distance}get fov(){return this._fov}get size(){return this._size}constructor(e){this.isGlobal=e,this.center=p(),this._pitch=0,this._yaw=0,this._distance=0,this.direction=m(j),this._fov=55,this._size=1}pixelsPerPanAtZoom(e){return this._size/2/(this._zoomToPanScale*e)}zoomAtPixelsPerPan(e){return this._size/2/(this._zoomToPanScale*e)}pixelsPerRotate(){let e=Math.max(Math.cos(Math.abs(this._pitch)),.5);return this._size/2/e}compareTo(e,t){if(this.isGlobal){let r=(n(this.center)+n(e.center))/2;t.pan=y(this.center,e.center)*r}else t.pan=r(this.center,e.center);let i=Math.abs(e._yaw-this._yaw);i>=Math.PI&&(i=2*Math.PI-i);let a=Math.abs(e._pitch-this._pitch);t.rotate=Math.max(i,a),t.fov=e.fov-this.fov,t.sourceZoom=this._distance,t.targetZoom=e._distance}interpolate(e,t,n){this.isGlobal?b(e.center,t.center,n.pan,this.center):i(this.center,e.center,t.center,n.pan),this._distance=isFinite(t.distance)?v(e.distance,t.distance+n.zoomOffset,n.zoom):e.distance,this._pitch=v(e.pitch,t.pitch,n.rotate);let r=e._yaw,a=t._yaw;Math.abs(a-r)>=Math.PI&&(r+=(r<a?1:-1)*2*Math.PI),this._yaw=v(r,a,n.rotate),this._fov=v(e.fov,t.fov,n.fov)}copyFrom(e){a(this.center,e.center),this._pitch=e.pitch,this._yaw=e.yaw,this._distance=e.distance,a(this.direction,e.direction),this._size=e.size,this._fov=e.fov,this._zoomToPanScale=Math.atan(.5*this._fov),this.isGlobal=e.isGlobal}copyFromRenderCamera(e){let t=this._lookAtOrientation(e.center,N);a(this.center,e.center),o(D,e.center,e.eye),s(D,D,t),s(O,e.up,t),this._distance=n(D),this._distance!==0&&(D[0]/=this._distance,D[1]/=this._distance,D[2]/=this._distance),this._pitch=S(D),this._yaw=C(D,O),this._size=Math.sqrt(e.width*e.width+e.height*e.height),this._fov=e.fov,this._zoomToPanScale=Math.atan(.5*this._fov)}copyToRenderCamera(t){let n=this._lookAtOrientation(this.center,N);e(n,n),this._axisAngleVec3(M,this._pitch-Math.PI/2,j,D),this._axisAngleVec3(A,this._yaw,D,D),this._axisAngleVec3(M,this._pitch-Math.PI/2,A,O),this._axisAngleVec3(A,this._yaw,O,O),c(D,D,this._distance),s(D,D,n),s(O,O,n),t.center=this.center,t.eye=o(D,this.center,D),t.up=O,t.fov=this._fov}_axisAngleVec3(e,t,n,r){let i=Math.cos(t),a=Math.sin(t);return c(w,n,i),l(T,e,n),c(T,T,a),c(E,e,(1-i)*u(e,n)),d(r,d(r,w,T),E)}_lookAtOrientation(e,n=t()){return this._upAtLookAt(e,E),l(w,this.direction,E),f(w,w),w[0]===0&&w[1]===0&&w[2]===0&&a(w,M),l(T,E,w),f(T,T),n[0]=w[0],n[1]=T[0],n[2]=E[0],n[3]=w[1],n[4]=T[1],n[5]=E[1],n[6]=w[2],n[7]=T[2],n[8]=E[2],n}_upAtLookAt(e,t){return this.isGlobal?f(t,e):a(t,A)}}function S(e){return Math.PI-y(A,e)}function C(e,t){let n=k;return Math.abs(t[2])<.5?(a(n,t),e[2]>0&&c(n,n,-1)):a(n,e),l(T,n,A),f(T,T),y(M,T,A)}const w=p(),T=p(),E=p(),D=p(),O=p(),k=p(),A=_,j=h,M=g,N=t();export{x as Camera};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{add as e,subtract as t}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inOutCubic as i}from"../../animation/easing.js";import{applyAltitudeConstraint as a,getAltitudeConstraintError as o}from"./constraintUtils/altitude.js";import{hasConstraintType as s}from"./constraintUtils/common.js";import{ConstraintOptions as c}from"./constraintUtils/ConstraintOptions.js";import{applyDistanceConstraint as l,getDistanceConstraintError as u}from"./constraintUtils/distance.js";import{applySurfaceCollisionConstraint as d}from"./constraintUtils/surfaceCollision.js";import{applyTiltConstraint as f,getTiltConstraintError as p}from"./constraintUtils/tilt.js";function m(e,t,n=x,r=t,i=null){r!==t&&r.copyFrom(t),r.computeUp(e.state.viewingMode);let a=!1;for(let t=0;t<S;t++){let t=0;for(let i of b)if(s(n.selection,i.type)){let o=Math.abs(i.error(e,r,n));i.apply(e,r,n)&&(a=!0,t+=o)}if(t===0)break}i?.copyFrom(r);let o=s(n.selection,8),c=h(n.interactionType,e);return o&&d(e,null,r,c)&&(a=!0),a&&r.computeUp(e.state.viewingMode),a}function h(e,t){switch(e){case 4:case 6:return 1;case 5:return t.state.isGlobal?2:1;default:return 0}}function g(e){let t=Math.min(1,e/150);return i(t)}function _(e,t,n){return p(e,t,n)*t.distance}const v=r();function y(r,i,a){let o=n(i.eye);m(r,i,a),i.center=e(v,i.center,t(v,i.eye,o))}const b=[{type:1,error:_,apply:f},{type:2,error:o,apply:a},{type:4,error:u,apply:l}],x=new c,S=5;export{m as applyAll,y as applyConstraintsAndUpdateCenterRenderCamera,g as pixelDistanceToInteractionFactor};
2
+ import{add as e,subtract as t}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as n,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inOutCubic as i}from"../../animation/easing.js";import{applyAltitudeConstraint as a,getAltitudeConstraintError as o}from"./constraintUtils/altitude.js";import{hasConstraintType as s}from"./constraintUtils/common.js";import{ConstraintOptions as c}from"./constraintUtils/ConstraintOptions.js";import{applyDistanceConstraint as l,getDistanceConstraintError as u}from"./constraintUtils/distance.js";import{applySurfaceCollisionConstraint as d}from"./constraintUtils/surfaceCollision.js";import{applyTiltConstraint as f,getTiltConstraintError as p}from"./constraintUtils/tilt.js";function m(e,t,n=x,r=t,i=null){r!==t&&r.copyFrom(t),r.computeUp(e.state.isGlobal);let a=!1;for(let t=0;t<S;t++){let t=0;for(let i of b)if(s(n.selection,i.type)){let o=Math.abs(i.error(e,r,n));i.apply(e,r,n)&&(a=!0,t+=o)}if(t===0)break}i?.copyFrom(r);let o=s(n.selection,8),c=h(n.interactionType,e);return o&&d(e,null,r,c)&&(a=!0),a&&r.computeUp(e.state.isGlobal),a}function h(e,t){switch(e){case 4:case 6:return 1;case 5:return t.state.isGlobal?2:1;default:return 0}}function g(e){let t=Math.min(1,e/150);return i(t)}function _(e,t,n){return p(e,t,n)*t.distance}const v=r();function y(r,i,a){let o=n(i.eye);m(r,i,a),i.center=e(v,i.center,t(v,i.eye,o))}const b=[{type:1,error:_,apply:f},{type:2,error:o,apply:a},{type:4,error:u,apply:l}],x=new c,S=5;export{m as applyAll,y as applyConstraintsAndUpdateCenterRenderCamera,g as pixelDistanceToInteractionFactor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{copy as e,squaredDistance as t,scale as n,subtract as r,add as i,length as a,dot as o,distance as s}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as u}from"../../../geometry/support/aaBoundingRect.js";import{scaleToDistanceAt as d}from"../support/cameraScaleUtils.js";import{Intersector as f}from"../webgl-engine/lib/Intersector.js";function p(e,t,n,r){return e.renderCoordsHelper.fromRenderCoords(t.eye,S,r)!=null&&u(n,S)}function m(e,t){return e.elevationProvider?e.elevationProvider.getElevation(t[0],t[1],t[2],e.renderCoordsHelper.spatialReference,`ground`)??0:0}function h(a,o,s,c,l){let u=a.state.camera.clone();if(o&&s&&c&&(u.eye=o,u.center=s,u.up=c),l){let e=d(a,u,l);i(C,u.eye,n(C,u.viewForward,e))}else v(a,u.ray,C)||e(C,u.center);let f=a.state.constraints,p=f.minimumPoiDistance;if(t(u.eye,C)<p){let t=f.collision.enabled;e(w,u.viewForward),n(w,w,p),t?u.eye=r(S,C,w):i(C,u.eye,w);let o=a.renderCoordsHelper,s=o.getAltitude(u.eye),c=f.collision.elevationMargin;t&&s<c&&(r(w,C,u.eye),u.eye=o.setAltitude(S,c,u.eye),i(C,u.eye,w))}return u.center=C,u}function g(e,t,n){let{origin:r,direction:i}=t;if(a(r)<e)return!0;let c=-o(i,r)/a(i);return c<0||c>=s(n,r)}function _(e,n,r){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;let i=m(e,n),a=e.stateManager.constraintsManager.nearFarHeuristic.computeFarDistance(n,i,e.stage.renderer.sceneDepthRange.value.far),o=a*a;return t(n,r)>o}function v(e,t,n){let r=b[e.viewingMode];r||(r=new f(e.state.viewingMode),r.options.backfacesTerrain=!e.state.isGlobal,r.options.invisibleTerrain=!0,b[e.viewingMode]=r);let{isGlobal:i}=e.state,a=i?l(e.spatialReference).radius:0;return e.sceneIntersectionHelper.intersectRay(t,r,n)&&!_(e,t.origin,n)&&(!i||g(a,r.ray,n))?!0:!e.renderCoordsHelper.intersectManifold(t,0,n)||_(e,t.origin,n)||i&&!g(a,r.ray,n)?i?y(t,n,a):!1:!0}function y(e,t,r){let s=o(e.origin,e.origin)-r*r,c=s>0?Math.sqrt(s)/3:1;return n(t,e.direction,c/a(e.direction)),i(t,t,e.origin),!0}let b={};function x(){b={}}const S=c(),C=c(),w=c();export{h as cameraOnContentAlongViewDirection,x as cleanupIntersectionUtils,p as eyeWithinExtent,m as surfaceElevationBelowRenderLocation};
2
+ import{copy as e,squaredDistance as t,scale as n,subtract as r,add as i,length as a,dot as o,distance as s}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as u}from"../../../geometry/support/aaBoundingRect.js";import{scaleToDistanceAt as d}from"../support/cameraScaleUtils.js";import{Intersector as f}from"../webgl-engine/lib/Intersector.js";function p(e,t,n,r){return e.renderCoordsHelper.fromRenderCoords(t.eye,S,r)!=null&&u(n,S)}function m(e,t){return e.elevationProvider?e.elevationProvider.getElevation(t[0],t[1],t[2],e.renderCoordsHelper.spatialReference,`ground`)??0:0}function h(a,o,s,c,l){let u=a.state.camera.clone();if(o&&s&&c&&(u.eye=o,u.center=s,u.up=c),l){let e=d(a,u,l);i(C,u.eye,n(C,u.viewForward,e))}else v(a,u.ray,C)||e(C,u.center);let f=a.state.constraints,p=f.minimumPoiDistance;if(t(u.eye,C)<p){let t=f.collision.enabled;e(w,u.viewForward),n(w,w,p),t?u.eye=r(S,C,w):i(C,u.eye,w);let o=a.renderCoordsHelper,s=o.getAltitude(u.eye),c=f.collision.elevationMargin;t&&s<c&&(r(w,C,u.eye),u.eye=o.setAltitude(S,c,u.eye),i(C,u.eye,w))}return u.center=C,u}function g(e,t,n){let{origin:r,direction:i}=t;if(a(r)<e)return!0;let c=-o(i,r)/a(i);return c<0||c>=s(n,r)}function _(e,n,r){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;let i=m(e,n),a=e.stateManager.constraintsManager.nearFarHeuristic.computeFarDistance(n,i,e.stage.renderer.sceneDepthRange.value.far),o=a*a;return t(n,r)>o}function v(e,t,n){let r=b[e.viewingMode];r||(r=new f(e.state.isGlobal),r.options.backfacesTerrain=!e.state.isGlobal,r.options.invisibleTerrain=!0,b[e.viewingMode]=r);let{isGlobal:i}=e.state,a=i?l(e.spatialReference).radius:0;return e.sceneIntersectionHelper.intersectRay(t,r,n)&&!_(e,t.origin,n)&&(!i||g(a,r.ray,n))?!0:!e.renderCoordsHelper.intersectManifold(t,0,n)||_(e,t.origin,n)||i&&!g(a,r.ray,n)?i?y(t,n,a):!1:!0}function y(e,t,r){let s=o(e.origin,e.origin)-r*r,c=s>0?Math.sqrt(s)/3:1;return n(t,e.direction,c/a(e.direction)),i(t,t,e.origin),!0}let b={};function x(){b={}}const S=c(),C=c(),w=c();export{h as cameraOnContentAlongViewDirection,x as cleanupIntersectionUtils,p as eyeWithinExtent,m as surfaceElevationBelowRenderLocation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../core/Evented.js";import{length as i,equals as a,copy as o,scale as s,lerp as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as l,create as u,fromValues as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{watch as f,sync as p,syncAndInitial as m,when as h}from"../../../core/reactiveUtils.js";import{isEarth as g,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{isLoadedOrLoadFor as y}from"../../../geometry/projectionUtils.js";import b from"../../../geometry/SpatialReference.js";import{getGCSForPlanet as x}from"../../../geometry/support/planetGCSUtils.js";import{positionToTimezoneInfo as S}from"../support/earthUtils.js";import{ColorAndIntensity as C,computeShadowsEnabled as w,computeColorAndIntensity as T,computeVirtualLightDirection as E}from"../support/sunUtils.js";import{MainLight as D,AmbientLight as O,FillLight as k}from"../webgl-engine/lighting/Lightsources.js";import{heightLimit as A}from"./weather.js";let j=class extends r{constructor(){super(),this._view=null,this._tmpLightParameters=new C,this._defaultLightParameters=new C,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey=`viewHandles`,this._trackingEnabled=!1,this._mainLight=new D,this._ambientLight=new O,this._moonLight=new k,this.shadowsAvailable=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return this._view?.stage?.renderer?.weatherFader!=null&&this._view.environment.atmosphereEnabled&&this._view.state.isGlobal&&g(this._view.spatialReference)}get _weatherAvailable(){let e=this._view;return e!=null&&this.weatherEnabled&&i(e.state.camera.eye)-_(e.spatialReference).radius<=A}get weather(){return this._weatherAvailable?this._view?.environment.weather:null}_modifyShadowsAvailable(){if(this._view==null)return;let e=this.referencePositionGeographic,t=e==null||w(e[2],this._view.state.viewingMode);this.shadowsAvailable=this._view.environment.lighting.directShadowsEnabled&&t}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){let e=this._view?.stateManager?.camera?.position?.spatialReference??b.WGS84,t=x(e);return y(e,t)}connectView(e){this._view=e,this.addHandles([f(()=>e.environment.lighting,e=>this._updateLightingHandler(e),p),f(()=>e.environment.lighting.type===`virtual`?null:e.environment.lighting.date,e=>this._lightingDateHandler(e),p),f(()=>e.environment.lighting.directShadowsEnabled,()=>this._modifyShadowsAvailable(),p),f(()=>e.spatialReference,()=>this._resetReferencePosition(!0),p),f(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),p),f(()=>this._weatherAvailable,t=>e.environment.setWeatherAvailable(t),m),f(()=>e.viewingMode,()=>this._resetReferencePosition(!0),m),f(()=>e.environment.lighting.type!==`virtual`&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),m),f(()=>e.state.camera,()=>this._cameraHandler(),m),h(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),p)],this._viewHandlesKey),this._modifyShadowsAvailable(),this._updateLighting(),this._cameraHandler(),this.notifyChange(`updating`)}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking(e.type!==`virtual`&&e.cameraTrackingEnabled),this._lightingDateHandler(e.type===`virtual`?null:e.date),this._modifyShadowsAvailable()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this._view)return;let e=this._view.environment.lighting;e?.type!==`virtual`&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this._view)return;let t=this._view.environment.lighting;if(t?.type===`virtual`)this._updateLighting();else if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),this._referencePositionGeographic!=null)){let e=S(this._referencePositionGeographic,this._tmpTz);e!=null&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}_preupdateTracking(e){this._view&&!this._trackingEnabled&&this._view.environment.lighting.type!==`virtual`&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){let t=this._view;if(!t||!t.ready)return;let n=t.stateManager.camera;if(!n)return;let r=n.position,i=r.spatialReference??b.WGS84,s=x(i);if(v(r,P,s,F))this._referencePositionGeographic?a(this._referencePositionGeographic,P)||(o(this._referencePositionGeographic,P),this.notifyChange(`referencePositionGeographic`)):this._referencePositionGeographic=l(P),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e);else{if(this._referencePositionGeographic==null)return;this._referencePositionGeographic=null,this._updateLighting()}}_updateLighting(e,t=0){let n=this._view;if(!n)return;let{lighting:r}=n.environment,i=r.type===`virtual`,a=this._referencePositionGeographic,l=a==null?this._defaultLightParameters:this._tmpLightParameters;if(a){e??=i?null:r.date;let t=this.weather?.type??`disabled`;T(e,a,n.state.viewingMode,t,n.state.camera,l)}else i&&E(n.state.camera,n.state.viewingMode,l.direct.directionToLightSource);let u=this._mainLight,d=l.direct;s(u.intensity,d.color,d.intensity*Math.PI),o(u.direction,d.directionToLightSource),u.specularStrength=l.specularStrength,u.environmentStrength=l.environmentStrength;let f=this._ambientLight;s(f.intensity,l.ambient.color,l.ambient.intensity);let p=this._moonLight;c(p.intensity,M,N,l.globalFactor);let m=(1-.5*l.globalFactor)*(1-.4*l.noonFactor*(1-l.globalFactor));s(p.intensity,p.intensity,m),o(p.direction,d.directionToLightSource),n.stage.renderer.updateLighting([u,f,p],l.noonFactor,l.globalFactor,this.weather?t:0),this._modifyShadowsAvailable()}_autoUpdateTimezone(e,t=null){if(!this._view||this._view.environment.lighting.type===`virtual`||!this._view.environment.lighting.cameraTrackingEnabled||e==null)return!1;let n=this._tmpDate;n.setTime((t||this._view.environment.lighting.date).getTime());let r=S(e,this._tmpTz);if(r==null)return!1;let i=this._view.environment.lighting.positionTimezoneInfo;if(!i.autoUpdated)i=r;else if(i.hours===r.hours&&i.minutes===r.minutes&&i.seconds===r.seconds)return!1;let a=n.getUTCHours()-(r.hours-i.hours),o=n.getUTCMinutes()-(r.minutes-i.minutes),s=n.getUTCSeconds()-(r.seconds-i.seconds);return n.setUTCHours(a),n.setUTCMinutes(o),n.setUTCSeconds(s),!t&&this._view.environment.lighting.autoUpdate(n,r)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}};e([t()],j.prototype,`_view`,void 0),e([t({type:Boolean,readOnly:!0})],j.prototype,`updating`,null),e([t()],j.prototype,`weatherEnabled`,null),e([t()],j.prototype,`_weatherAvailable`,null),e([t()],j.prototype,`shadowsAvailable`,void 0),e([t()],j.prototype,`referencePositionGeographic`,null),e([t()],j.prototype,`_referencePositionGeographic`,void 0),e([t()],j.prototype,`_canProjectCameraPosition`,null),j=e([n(`esri.views.3d.environment.EnvironmentView`)],j);const M=d(.22,.22,.33),N=d(.22,.22,.22),P=u(),F={zConversionDisabled:!0};export{j as EnvironmentView};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../core/Evented.js";import{length as i,equals as a,copy as o,scale as s,lerp as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as l,create as u,fromValues as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{watch as f,sync as p,syncAndInitial as m,when as h}from"../../../core/reactiveUtils.js";import{isEarth as g,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{projectPointToVector as v}from"../../../geometry/projection/projectPointToVector.js";import{isLoadedOrLoadFor as y}from"../../../geometry/projectionUtils.js";import b from"../../../geometry/SpatialReference.js";import{getGCSForPlanet as x}from"../../../geometry/support/planetGCSUtils.js";import{positionToTimezoneInfo as S}from"../support/earthUtils.js";import{ColorAndIntensity as C,areShadowsEnabled as w,computeColorAndIntensity as T,computeVirtualLightDirection as E}from"../support/sunUtils.js";import{MainLight as D,AmbientLight as O,FillLight as k}from"../webgl-engine/lighting/Lightsources.js";import{heightLimit as A}from"./weather.js";let j=class extends r{constructor(){super(),this._view=null,this._tmpLightParameters=new C,this._defaultLightParameters=new C,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey=`viewHandles`,this._trackingEnabled=!1,this._mainLight=new D,this._ambientLight=new O,this._moonLight=new k,this.shadowsAvailable=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return this._view?.stage?.renderer?.weatherFader!=null&&this._view.environment.atmosphereEnabled&&this._view.state.isGlobal&&g(this._view.spatialReference)}get _weatherAvailable(){let e=this._view;return e!=null&&this.weatherEnabled&&i(e.state.camera.eye)-_(e.spatialReference).radius<=A}get weather(){return this._weatherAvailable?this._view?.environment.weather:null}_modifyShadowsAvailable(){if(this._view==null)return;let e=this.referencePositionGeographic,t=e==null||w(e[2],this._view.state.isGlobal);this.shadowsAvailable=this._view.environment.lighting.directShadowsEnabled&&t}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){let e=this._view?.stateManager?.camera?.position?.spatialReference??b.WGS84,t=x(e);return y(e,t)}connectView(e){this._view=e,this.addHandles([f(()=>e.environment.lighting,e=>this._updateLightingHandler(e),p),f(()=>e.environment.lighting.type===`virtual`?null:e.environment.lighting.date,e=>this._lightingDateHandler(e),p),f(()=>e.environment.lighting.directShadowsEnabled,()=>this._modifyShadowsAvailable(),p),f(()=>e.spatialReference,()=>this._resetReferencePosition(!0),p),f(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),p),f(()=>this._weatherAvailable,t=>e.environment.setWeatherAvailable(t),m),f(()=>e.viewingMode,()=>this._resetReferencePosition(!0),m),f(()=>e.environment.lighting.type!==`virtual`&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),m),f(()=>e.state.camera,()=>this._cameraHandler(),m),h(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),p)],this._viewHandlesKey),this._modifyShadowsAvailable(),this._updateLighting(),this._cameraHandler(),this.notifyChange(`updating`)}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking(e.type!==`virtual`&&e.cameraTrackingEnabled),this._lightingDateHandler(e.type===`virtual`?null:e.date),this._modifyShadowsAvailable()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this._view)return;let e=this._view.environment.lighting;e?.type!==`virtual`&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this._view)return;let t=this._view.environment.lighting;if(t?.type===`virtual`)this._updateLighting();else if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),this._referencePositionGeographic!=null)){let e=S(this._referencePositionGeographic,this._tmpTz);e!=null&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}_preupdateTracking(e){this._view&&!this._trackingEnabled&&this._view.environment.lighting.type!==`virtual`&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){let t=this._view;if(!t||!t.ready)return;let n=t.stateManager.camera;if(!n)return;let r=n.position,i=r.spatialReference??b.WGS84,s=x(i);if(v(r,P,s,F))this._referencePositionGeographic?a(this._referencePositionGeographic,P)||(o(this._referencePositionGeographic,P),this.notifyChange(`referencePositionGeographic`)):this._referencePositionGeographic=l(P),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e);else{if(this._referencePositionGeographic==null)return;this._referencePositionGeographic=null,this._updateLighting()}}_updateLighting(e,t=0){let n=this._view;if(!n)return;let{lighting:r}=n.environment,i=r.type===`virtual`,a=this._referencePositionGeographic,l=a==null?this._defaultLightParameters:this._tmpLightParameters;if(a){e??=i?null:r.date;let t=this.weather?.type??`disabled`;T(e,a,n.state.isGlobal,t,n.state.camera,l)}else i&&E(n.state.camera,n.state.isGlobal,l.direct.directionToLightSource);let u=this._mainLight,d=l.direct;s(u.intensity,d.color,d.intensity*Math.PI),o(u.direction,d.directionToLightSource),u.specularStrength=l.specularStrength,u.environmentStrength=l.environmentStrength;let f=this._ambientLight;s(f.intensity,l.ambient.color,l.ambient.intensity);let p=this._moonLight;c(p.intensity,M,N,l.globalFactor);let m=(1-.5*l.globalFactor)*(1-.4*l.noonFactor*(1-l.globalFactor));s(p.intensity,p.intensity,m),o(p.direction,d.directionToLightSource),n.stage.renderer.updateLighting([u,f,p],l.noonFactor,l.globalFactor,this.weather?t:0),this._modifyShadowsAvailable()}_autoUpdateTimezone(e,t=null){if(!this._view||this._view.environment.lighting.type===`virtual`||!this._view.environment.lighting.cameraTrackingEnabled||e==null)return!1;let n=this._tmpDate;n.setTime((t||this._view.environment.lighting.date).getTime());let r=S(e,this._tmpTz);if(r==null)return!1;let i=this._view.environment.lighting.positionTimezoneInfo;if(!i.autoUpdated)i=r;else if(i.hours===r.hours&&i.minutes===r.minutes&&i.seconds===r.seconds)return!1;let a=n.getUTCHours()-(r.hours-i.hours),o=n.getUTCMinutes()-(r.minutes-i.minutes),s=n.getUTCSeconds()-(r.seconds-i.seconds);return n.setUTCHours(a),n.setUTCMinutes(o),n.setUTCSeconds(s),!t&&this._view.environment.lighting.autoUpdate(n,r)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}};e([t()],j.prototype,`_view`,void 0),e([t({type:Boolean,readOnly:!0})],j.prototype,`updating`,null),e([t()],j.prototype,`weatherEnabled`,null),e([t()],j.prototype,`_weatherAvailable`,null),e([t()],j.prototype,`shadowsAvailable`,void 0),e([t()],j.prototype,`referencePositionGeographic`,null),e([t()],j.prototype,`_referencePositionGeographic`,void 0),e([t()],j.prototype,`_canProjectCameraPosition`,null),j=e([n(`esri.views.3d.environment.EnvironmentView`)],j);const M=d(.22,.22,.33),N=d(.22,.22,.22),P=u(),F={zConversionDisabled:!0};export{j as EnvironmentView};