@arcgis/core 4.29.0 → 4.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  12. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  13. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  14. package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +1 -0
  15. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  17. package/assets/esri/core/workers/chunks/8a9387483b19a5ec5b86.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  20. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  21. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  23. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  24. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  26. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  34. package/chunks/Laserlines.glsl.js +3 -3
  35. package/chunks/Precipitation.glsl.js +1 -1
  36. package/chunks/SSAOBlur.glsl.js +2 -2
  37. package/chunks/boundedPlane.js +1 -1
  38. package/chunks/cameraUtilsSpherical.js +1 -1
  39. package/chunks/sphere.js +1 -1
  40. package/chunks/terrainUtilsPlanar.js +1 -1
  41. package/chunks/vec32.js +1 -1
  42. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  43. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  44. package/core/libs/gl-matrix-2/vec3.js +1 -1
  45. package/geohash/geohashUtils.js +1 -1
  46. package/geometry/support/axisAngleDegrees.js +1 -1
  47. package/geometry/support/coordinateSystem.js +1 -1
  48. package/geometry/support/lineSegment.js +1 -1
  49. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  50. package/geometry/support/meshUtils/georeference.js +1 -1
  51. package/geometry/support/meshUtils/merge.js +1 -1
  52. package/geometry/support/meshUtils/rotate.js +1 -1
  53. package/geometry/support/meshUtils/scale.js +1 -1
  54. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  55. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  56. package/geometry/support/plane.js +1 -1
  57. package/geometry/support/ray.js +1 -1
  58. package/geometry/support/triangle.js +1 -1
  59. package/geometry/support/vector.js +1 -1
  60. package/interfaces.d.ts +20 -14
  61. package/kernel.js +1 -1
  62. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  63. package/layers/LinkChartLayer.js +1 -1
  64. package/layers/VoxelWasmPerSceneView.js +1 -1
  65. package/layers/graphics/data/StreamFeatureManager.js +1 -1
  66. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  67. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  68. package/layers/mixins/FeatureReductionLayer.js +1 -1
  69. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  70. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  71. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  72. package/layers/support/layerUtils.js +1 -1
  73. package/layers/video/VideoCameraSensorModel.js +1 -1
  74. package/layers/voxel/VoxelVolume.js +1 -1
  75. package/layers/voxel/voxelPlaneUtils.js +1 -1
  76. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  77. package/package.json +1 -1
  78. package/support/revision.js +1 -1
  79. package/symbols/cim/cimAnalyzer.js +1 -1
  80. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  81. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  84. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  85. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  86. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  87. package/views/2d/layers/features/Processor.js +1 -1
  88. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  89. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  90. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  91. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  92. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  93. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  94. package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
  95. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  96. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  97. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  98. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  99. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  100. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  101. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  102. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  103. package/views/2d/layers/features/support/Tile.js +1 -1
  104. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  105. package/views/2d/tiling/TileKey.js +1 -1
  106. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  107. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  108. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  109. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  110. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  111. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  112. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  113. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  114. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  115. package/views/3d/analysis/support/measurementUtils.js +1 -1
  116. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  117. package/views/3d/camera/constraintUtils/common.js +1 -1
  118. package/views/3d/camera/constraintUtils/distance.js +1 -1
  119. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  120. package/views/3d/camera/intersectionUtils.js +1 -1
  121. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  122. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  123. package/views/3d/environment/Fog.js +1 -1
  124. package/views/3d/environment/MarsAtmosphere.js +1 -1
  125. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  126. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  127. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  128. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  129. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  130. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  131. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  132. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  133. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  134. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  135. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  136. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  137. package/views/3d/layers/I3SMeshView3D.js +1 -1
  138. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  139. package/views/3d/layers/PointCloudWorker.js +1 -1
  140. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  141. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  142. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  143. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  144. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  145. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  146. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  147. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  148. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  149. package/views/3d/layers/support/uvUtils.js +1 -1
  150. package/views/3d/state/Frustum.js +1 -1
  151. package/views/3d/state/NearFarHeuristic.js +1 -1
  152. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  153. package/views/3d/state/controllers/RotateController.js +1 -1
  154. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  155. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  156. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  157. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  158. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  159. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  160. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  161. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  162. package/views/3d/state/utils/navigationUtils.js +1 -1
  163. package/views/3d/state/utils/viewUtils.js +1 -1
  164. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  165. package/views/3d/support/cameraUtils.js +1 -1
  166. package/views/3d/support/cameraUtilsInternal.js +1 -1
  167. package/views/3d/support/intersectionUtils.js +1 -1
  168. package/views/3d/support/mathUtils.js +1 -1
  169. package/views/3d/support/orientedBoundingBox.js +1 -1
  170. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  171. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  172. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  173. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  174. package/views/3d/support/sunUtils.js +1 -1
  175. package/views/3d/support/viewpointUtils.js +1 -1
  176. package/views/3d/terrain/OverlayManager.js +1 -1
  177. package/views/3d/terrain/PatchRenderData.js +1 -1
  178. package/views/3d/terrain/SphericalPatch.js +1 -1
  179. package/views/3d/terrain/TerrainRenderer.js +1 -1
  180. package/views/3d/terrain/Tile.js +1 -1
  181. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  182. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  183. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  184. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  185. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  186. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  187. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  188. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  189. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  190. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  191. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  192. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  193. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  194. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  195. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  196. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  197. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  198. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  199. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  200. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  201. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  202. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  203. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  204. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  207. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  211. package/views/SelectionManager.js +1 -1
  212. package/views/draw/support/createUtils.js +1 -1
  213. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/SegmentLabels.js +1 -1
  216. package/views/interactive/coordinateHelper.js +1 -1
  217. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  218. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  219. package/views/interactive/sketch/constraints.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  224. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  225. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  226. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  227. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  228. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  229. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  230. package/views/layers/FeatureLayerView.js +1 -1
  231. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  232. package/views/support/angularMeasurementUtils.js +1 -1
  233. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  234. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  235. package/views/support/geometry3dUtils.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  238. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  239. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  240. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  241. package/widgets/Features/FeaturesViewModel.js +1 -1
  242. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  243. package/widgets/PanoramicViewer/utils.js +1 -1
  244. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  245. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  246. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  247. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  248. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  249. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  250. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  251. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  252. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  253. package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
  254. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  255. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  256. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  257. package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{getFeatureId as t}from"../../../../analysis/featureReferenceUtils.js";import n from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{initial as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h,p as m,f as v,n as f,h as _,g as b,m as y,y as C}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as P}from"../../../../geometry/projection.js";import{projectBoundingRect as O}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as S,containsPointObject as j,intersectsSegment as R}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as w,create as A}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as E}from"../../../../support/elevationInfoUtils.js";import{LineOfSightAnalysisResult as H}from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as V}from"../support/projectionUtils.js";import{StoreResults as x}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as D,hasLod as N,getIntersectedFeatureBSRadius as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as k}from"../../../support/Scheduler.js";import M from"../../../../geometry/Point.js";let U=class extends(i.EventedMixin(n)){constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new T,this._frameTask=z,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(k.LINE_OF_SIGHT_TOOL):z,this._intersector=new L({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;h(s,i),h(a,r);this._canCompute(t)?this._computeIntersection(e):this._interpolateIntersection(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_updateAdjustedPointsFromFeatures(e){const n=this.view,{sceneIntersectionHelper:o}=n,{inputPoints:i}=e,{observerAdjusted:r,observerFeatureId:s,targetFeatureId:a,targetAdjusted:l}=i;if(null==s&&null==a)return;const u=m(r,l),c=this._intersector.intersector,d=w(i.observer,i.target,q);c.options.store=x.ALL,o.intersectToolIntersectorRay(d,c);let p=null,g=null,h=null,v=null;for(const m of c.results.all){const e=D(m,this.view);if(null==e||null==m.distanceInRenderSpace)continue;const o=t(e);null!=o&&(null!=s&&o===s&&(null==p&&(p=this._getFeatureDistanceThreshold(m,n,u)),m.distanceInRenderSpace<p&&(h=m)),null!=a&&o===a&&(null==g&&(g=this._getFeatureDistanceThreshold(m,n,u)),null==v&&m.distanceInRenderSpace<u&&u-m.distanceInRenderSpace<g&&(v=m)))}null!=h&&h.getIntersectionPoint(r)&&(i.observerSurfaceNormal=h.getTransformedNormal(I())),null!=v&&v.getIntersectionPoint(l)&&(i.targetSurfaceNormal=v.getTransformedNormal(I()))}_getFeatureDistanceThreshold(e,t,n){if(N(e)){const o=G(e,t);if(null!=o)return Math.min(o*K,n)}return 1e-5*n}_adjustStartEndPositions(e){const t=this._screenPixelSize,n=this.view,{inputPoints:o}=e,{observer:i,observerSurfaceNormal:r,target:s,targetSurfaceNormal:a,observerAdjusted:l,targetAdjusted:u}=o,c=B;h(l,i),h(u,s),this._updateAdjustedPointsFromFeatures(e),null!=r?h(c,r):v(c,u,l);const d=t;f(c,c),_(c,c,Math.min(d,1)),b(l,l,c),null!=a?h(c,a):v(c,l,u);const p=n.state.camera.computeScreenPixelSizeAt(u);f(c,c),_(c,c,Math.min(p,1)),b(u,u,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=w(c,d,q);r.options.store=x.MIN,o.intersectToolIntersectorRay(p,r);const g=r.results.min,m=s.intersection,v=B;let f=!0;if(null!=g&&g.getIntersectionPoint(m)){h(t.originalIntersection,m),h(t.originalObserver,c),h(t.originalTarget,d),i.fromRenderCoords(m,v,n.spatialReference);const e=1-y(d,u)/y(c,u);f=y(l,m)>=e*y(l,u)}const _=new M(v,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:D(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new H({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:D(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_interpolateIntersection({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(h(s,a),o.isValid){const e=B,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,n=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,n,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==n)return V(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=this._getEffectiveElevationInfo(n,o),{absoluteZ:a,elevation:u}=E(n.x,n.y,n.z,this.view.spatialReference,this.view,s),c=n.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=I();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=t(i),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(h(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,n,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=n&&V(this.analysis,n.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=this._getEffectiveElevationInfo(o,i),{absoluteZ:c,elevation:d}=E(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=t(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add((()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:P(e.target.position,this.view.spatialReference)})),(({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)}),d)])}_connectComputationToObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver})),(({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())}),d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId})),(({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)}),d)}_connectComputationToCamera(e){return this._updatingHandles.add((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()}))}_connectComputationToSlicePlane(e){return this._updatingHandles.add((()=>this.view.slicePlane),(()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()}))}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=P(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=P(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(O(n,o,J,this.view.spatialReference),null!=s&&j(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&j(J,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&R(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:n})=>t(e,n)))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:I(),originalObserver:I(),originalTarget:I()}};return s([this._updatingHandles.add((()=>e.inputPoints),(()=>{t=u(t),t=o((async e=>{await c(this._frameTask.schedule((()=>this._computeResult(n)),e))}))}),{initial:!0,equals:()=>!1}),a((()=>t=u(t)))])}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some((t=>t.target===e))||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex((t=>t.target===e));this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add((()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:P(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null})),(({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)}),d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange((()=>this._computations),(e=>this._onComputationCollectionChange(e)),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange((()=>this.analysis.targets),(e=>this._onTargetCollectionChange(e)),{initial:!0,final:!0}),this._updatingHandles.add((()=>this.analysisViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)}))])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=B;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>Z}_getEffectiveElevationInfo(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};e([p({constructOnly:!0})],U.prototype,"analysis",void 0),e([p({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],U.prototype,"view",void 0),e([p()],U.prototype,"updating",null),e([p()],U.prototype,"priority",null),e([p()],U.prototype,"updateOnCameraChange",void 0),e([p()],U.prototype,"_computations",null),e([p()],U.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([p()],U.prototype,"_observerGroundOffsetRenderSpace",void 0),e([p()],U.prototype,"_effectiveObserverElevationMode",void 0),e([p()],U.prototype,"_observerFeatureId",void 0),e([p()],U.prototype,"_screenPixelSize",null),e([p({readOnly:!0})],U.prototype,"_updatingHandles",void 0),e([p()],U.prototype,"_frameTask",void 0),e([p()],U.prototype,"_isCameraDirty",null),U=e([g("esri.views.3d.analysis.LineOfSight.LineOfSightController")],U);const Z=.1,B=I(),q=A(),J=S(),K=.05;export{U as LineOfSightController};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import{getFeatureId as t}from"../../../../analysis/featureReferenceUtils.js";import n from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{handlesGroup as s,makeHandle as a}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{abortMaybe as u}from"../../../../core/maybe.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{initial as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as h,q as m,f as v,n as f,h as _,g as b,o as y,z as C}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as P}from"../../../../geometry/projection.js";import{projectBoundingRect as O}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as S,containsPointObject as j,intersectsSegment as R}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as w,create as A}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as E}from"../../../../support/elevationInfoUtils.js";import{LineOfSightAnalysisResult as H}from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as F}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as V}from"../support/projectionUtils.js";import{StoreResults as x}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as D,hasLod as N,getIntersectedFeatureBSRadius as G}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as k}from"../../../support/Scheduler.js";import M from"../../../../geometry/Point.js";let U=class extends(i.EventedMixin(n)){constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new T,this._frameTask=z,this._computationHandles=new r,this._externalObserverUpdate=!0}initialize(){const e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(k.LINE_OF_SIGHT_TOOL):z,this._intersector=new L({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){const t=e.computation,{inputPoints:n,computationResult:o}=t,{observerAdjusted:i,targetAdjusted:r}=n,{start:s,end:a}=o;h(s,i),h(a,r);this._canCompute(t)?this._computeIntersection(e):this._interpolateIntersection(e),t.notifyResultChanged(),this.emit("result-changed",{target:e.computation.target,result:t.result})}_updateAdjustedPointsFromFeatures(e){const n=this.view,{sceneIntersectionHelper:o}=n,{inputPoints:i}=e,{observerAdjusted:r,observerFeatureId:s,targetFeatureId:a,targetAdjusted:l}=i;if(null==s&&null==a)return;const u=m(r,l),c=this._intersector.intersector,d=w(i.observer,i.target,B);c.options.store=x.ALL,o.intersectToolIntersectorRay(d,c);let p=null,g=null,h=null,v=null;for(const m of c.results.all){const e=D(m,this.view);if(null==e||null==m.distanceInRenderSpace)continue;const o=t(e);null!=o&&(null!=s&&o===s&&(null==p&&(p=this._getFeatureDistanceThreshold(m,n,u)),m.distanceInRenderSpace<p&&(h=m)),null!=a&&o===a&&(null==g&&(g=this._getFeatureDistanceThreshold(m,n,u)),null==v&&m.distanceInRenderSpace<u&&u-m.distanceInRenderSpace<g&&(v=m)))}null!=h&&h.getIntersectionPoint(r)&&(i.observerSurfaceNormal=h.getTransformedNormal(I())),null!=v&&v.getIntersectionPoint(l)&&(i.targetSurfaceNormal=v.getTransformedNormal(I()))}_getFeatureDistanceThreshold(e,t,n){if(N(e)){const o=G(e,t);if(null!=o)return Math.min(o*K,n)}return 1e-5*n}_adjustStartEndPositions(e){const t=this._screenPixelSize,n=this.view,{inputPoints:o}=e,{observer:i,observerSurfaceNormal:r,target:s,targetSurfaceNormal:a,observerAdjusted:l,targetAdjusted:u}=o,c=q;h(l,i),h(u,s),this._updateAdjustedPointsFromFeatures(e),null!=r?h(c,r):v(c,u,l);const d=t;f(c,c),_(c,c,Math.min(d,1)),b(l,l,c),null!=a?h(c,a):v(c,l,u);const p=n.state.camera.computeScreenPixelSizeAt(u);f(c,c),_(c,c,Math.min(p,1)),b(u,u,c)}_computeIntersection({computation:e,interpolationInfo:t}){const{view:n}=this,{sceneIntersectionHelper:o,renderCoordsHelper:i}=n;if(null==o)return;const r=this._intersector.intersector,{computationResult:s,inputPoints:a}=e,{observer:l,target:u}=a,{start:c,end:d}=s,p=w(c,d,B);r.options.store=x.MIN,o.intersectToolIntersectorRay(p,r);const g=r.results.min,m=s.intersection,v=q;let f=!0;if(null!=g&&g.getIntersectionPoint(m)){h(t.originalIntersection,m),h(t.originalObserver,c),h(t.originalTarget,d),i.fromRenderCoords(m,v,n.spatialReference);const e=1-y(d,u)/y(c,u);f=y(l,m)>=e*y(l,u)}const _=new M(v,n.spatialReference);{const{result:t,target:o}=e;null!=t?(t.target=o,t.intersectedGraphic=f?null:D(g,n),t.intersectedLocation=f?null:_,t.visible=f):e.result=new H({target:o,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:D(g,n),intersectedLocation:f?null:_,visible:f})}s.isValid=a.isValid=!0,s.isTargetVisible=f}_interpolateIntersection({computation:e,interpolationInfo:t}){const{computationResult:n,inputPoints:o}=e,{start:i,end:r,intersection:s}=n,{originalIntersection:a,originalObserver:l,originalTarget:u}=t;if(h(s,a),o.isValid){const e=q,t=y(l,a)/y(l,u);C(e,i,l),_(e,e,1-t),b(s,s,e),C(e,r,u),_(e,e,t),b(s,s,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}_canCompute(e){const t=this.analysisViewData.elevationAlignedObserver,n=this.view.frustum;if(null==t||null==e.elevationAlignedTargetLocation||null==n)return!1;const{observerAdjusted:o,targetAdjusted:i}=e.inputPoints,r=n.intersectsPoint(o),s=n.intersectsPoint(i);return r&&s}_onObserverPositionChange(e,n,o,i,r){if(this._externalObserverUpdate=r,null==e)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(null==n)return V(this.analysis,e.spatialReference,l.getLogger(this)),void(this.analysisViewData.elevationAlignedObserver=null);const s=this._getEffectiveElevationInfo(n,o),{absoluteZ:a,elevation:u}=E(n.x,n.y,n.z,this.view.spatialReference,this.view,s),c=n.clone();c.z=a,this._effectiveObserverElevationMode=s.mode,this.analysisViewData.elevationAlignedObserver=c;const d=I();this.view.renderCoordsHelper.toRenderCoords(c,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=a-u,this._observerFeatureId=t(i),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i){const{inputPoints:r}=e;switch(h(r.observer,t),r.observerFeatureId=i,r.observerSurfaceNormal=null,o){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(r.observer,n,r.observer);null==r.observerFeatureId&&(r.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,n,o,i,r,s=!0){const a=e.inputPoints;if(s&&(a.isValid=!1),null==o)return null!=n&&V(this.analysis,n.spatialReference,l.getLogger(this)),e.elevationAlignedTargetLocation=null,void e.notifyInputPointsChanged();const u=this._getEffectiveElevationInfo(o,i),{absoluteZ:c,elevation:d}=E(o.x,o.y,o.z,this.view.spatialReference,this.view,u),p=o.clone();switch(p.z=c,e.elevationAlignedTargetLocation=p,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,a.target),a.targetFeatureId=t(r),a.targetSurfaceNormal=null,u.mode){case"on-the-ground":case"relative-to-ground":{const e=this._intersector.updateFromGroundIntersection(a.target,c-d,a.target);null==a.targetFeatureId&&(a.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return s([this._updatingHandles.add((()=>({computation:e,targetPosition:e.target.position,targetElevationInfo:e.target.elevationInfo,targetFeatureInfo:e.target.feature,projectedTargetPosition:P(e.target.position,this.view.spatialReference)})),(({computation:e,targetPosition:t,targetElevationInfo:n,targetFeatureInfo:o,projectedTargetPosition:i})=>{null==i.pending?this._onTargetPositionChange(e,t,i.geometry,n,o):this._updatingHandles.addPromise(i.pending)}),d)])}_connectComputationToObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver})),(({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())}),d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add((()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId})),(({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:o,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,o,i)}),d)}_connectComputationToCamera(e){return this._updatingHandles.add((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()}))}_connectComputationToSlicePlane(e){return this._updatingHandles.add((()=>this.view.slicePlane),(()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()}))}_connectComputationToElevation(e){const t=(n,o)=>{const i=this.analysis.observer,r=e.target;let s=null,a=null,l=null,u=null,c=null,d=null;if(null!=i?.position){const e=P(i.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));s=e.geometry,a=i.elevationInfo,l=i.feature}if(null!=r.position){const e=P(r.position,this.view.spatialReference);if(null!=e.pending)return this._updatingHandles.addPromise(e.pending),void e.pending.finally((()=>t(n,o)));u=e.geometry,c=r.elevationInfo,d=r.feature}null==s&&null==u||(O(n,o,J,this.view.spatialReference),null!=s&&j(J,s)&&this._onObserverPositionChange(null!=i?i.position:null,s,a,l,!1),null!=u&&j(J,u)&&this._onTargetPositionChange(e,r.position,u,c,d,!1),null!=s&&null!=u&&R(J,s,u)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:n})=>t(e,n)))}_connectComputationToTask(e){let t=null;const n={computation:e,interpolationInfo:{originalIntersection:I(),originalObserver:I(),originalTarget:I()}};return s([this._updatingHandles.add((()=>e.inputPoints),(()=>{t=u(t),t=o((async e=>{await c(this._frameTask.schedule((()=>this._computeResult(n)),e))}))}),{initial:!0,equals:()=>!1}),a((()=>t=u(t)))])}_connectComputation(e){const t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(const n of t)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_onTargetCollectionChange({added:e,removed:t}){for(const n of t)this._removeTarget(n);for(const n of e)this._addTarget(n)}_onCursorTargetChange(e,t){null!=t&&this._removeTarget(t),null!=e&&this._addTarget(e)}_addTarget(e){this._computations.some((t=>t.target===e))||this._computations.add(new F({target:e}))}_removeTarget(e){const t=this._computations.findIndex((t=>t.target===e));this._computations.removeAt(t)}_connectObserver(){return s([this._updatingHandles.add((()=>({observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,projectedObserverPosition:P(null!=this.analysis.observer?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:null!=this.analysis.observer?this.analysis.observer.elevationInfo:null,observerFeatureInfo:null!=this.analysis.observer?this.analysis.observer.feature:null})),(({observerPosition:e,projectedObserverPosition:t,observerElevationInfo:n,observerFeatureInfo:o})=>{null==t.pending?this._onObserverPositionChange(e,t.geometry,n,o,!0):this._updatingHandles.addPromise(t.pending)}),d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange((()=>this._computations),(e=>this._onComputationCollectionChange(e)),{initial:!0,final:!0})}_connectTargets(){return s([this._updatingHandles.addOnCollectionChange((()=>this.analysis.targets),(e=>this._onTargetCollectionChange(e)),{initial:!0,final:!0}),this._updatingHandles.add((()=>this.analysisViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)}))])}get _isCameraDirty(){const e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(null==e||null==n)return!1;const o=q;n.toRenderCoords(e,o);const i=t.state.camera.computeScreenPixelSizeAt(o);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>Z}_getEffectiveElevationInfo(e,t){return e.hasZ?t??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};e([p({constructOnly:!0})],U.prototype,"analysis",void 0),e([p({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([p({constructOnly:!0})],U.prototype,"view",void 0),e([p()],U.prototype,"updating",null),e([p()],U.prototype,"priority",null),e([p()],U.prototype,"updateOnCameraChange",void 0),e([p()],U.prototype,"_computations",null),e([p()],U.prototype,"_elevationAlignedObserverPositionRenderSpace",null),e([p()],U.prototype,"_observerGroundOffsetRenderSpace",void 0),e([p()],U.prototype,"_effectiveObserverElevationMode",void 0),e([p()],U.prototype,"_observerFeatureId",void 0),e([p()],U.prototype,"_screenPixelSize",null),e([p({readOnly:!0})],U.prototype,"_updatingHandles",void 0),e([p()],U.prototype,"_frameTask",void 0),e([p()],U.prototype,"_isCameraDirty",null),U=e([g("esri.views.3d.analysis.LineOfSight.LineOfSightController")],U);const Z=.1,q=I(),B=A(),J=S(),K=.05;export{U as LineOfSightController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import o from"../../../../core/Accessor.js";import{equals as t}from"../../../../core/arrayUtils.js";import{clone as s}from"../../../../core/lang.js";import{equalsMaybe as i}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{F as n}from"../../../../chunks/vec32.js";import{clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as a}from"../../../../geometry/support/ray.js";var m;let y=m=class extends o{constructor(r){super(r)}clone(){return new m({type:this.type,id:s(this.id),mapPoint:s(this.mapPoint),renderPoint:c(this.renderPoint),normal:s(this.normal),ray:s(this.ray),graphic:this.graphic})}equals(r){return this.type===r.type&&this.id===r.id&&i(this.mapPoint,r.mapPoint)&&n(this.renderPoint,r.renderPoint)&&t(this.normal,r.normal)&&a(this.ray,r.ray)&&this.graphic===r.graphic}};r([e()],y.prototype,"type",void 0),r([e({constructOnly:!0})],y.prototype,"id",void 0),r([e({constructOnly:!0})],y.prototype,"mapPoint",void 0),r([e({constructOnly:!0})],y.prototype,"renderPoint",void 0),r([e({constructOnly:!0})],y.prototype,"normal",void 0),r([e({constructOnly:!0})],y.prototype,"graphic",void 0),r([e({constructOnly:!0})],y.prototype,"ray",void 0),y=m=r([p("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],y);export{y as LineOfSightIntersectionResult};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import o from"../../../../core/Accessor.js";import{equals as t}from"../../../../core/arrayUtils.js";import{clone as s}from"../../../../core/lang.js";import{equalsMaybe as i}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as n}from"../../../../chunks/vec32.js";import{clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as a}from"../../../../geometry/support/ray.js";var m;let y=m=class extends o{constructor(r){super(r)}clone(){return new m({type:this.type,id:s(this.id),mapPoint:s(this.mapPoint),renderPoint:c(this.renderPoint),normal:s(this.normal),ray:s(this.ray),graphic:this.graphic})}equals(r){return this.type===r.type&&this.id===r.id&&i(this.mapPoint,r.mapPoint)&&n(this.renderPoint,r.renderPoint)&&t(this.normal,r.normal)&&a(this.ray,r.ray)&&this.graphic===r.graphic}};r([e()],y.prototype,"type",void 0),r([e({constructOnly:!0})],y.prototype,"id",void 0),r([e({constructOnly:!0})],y.prototype,"mapPoint",void 0),r([e({constructOnly:!0})],y.prototype,"renderPoint",void 0),r([e({constructOnly:!0})],y.prototype,"normal",void 0),r([e({constructOnly:!0})],y.prototype,"graphic",void 0),r([e({constructOnly:!0})],y.prototype,"ray",void 0),y=m=r([p("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],y);export{y as LineOfSightIntersectionResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../../core/scheduling.js";import{createScreenPoint as h,screenPointObjectToArray as p}from"../../../../core/screenUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as d,fromScaling as _,multiply as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{j as P,l as y,c as m,h as w,g,e as f,n as M,s as D}from"../../../../chunks/vec32.js";import{clone as V,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as k,c as S,n as x,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as C,intersectRay as R,getNormal as O}from"../../../../geometry/support/plane.js";import{create as I}from"../../../../geometry/support/ray.js";import{sv3d as z,sm4d as G,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as A}from"../images/Factory.js";import{ResizeManipulator as K}from"./ResizeManipulator.js";import{RotateManipulator as B}from"./RotateManipulator.js";import{getOutlineColor as F,planeColor as N}from"./settings.js";import{ShiftManipulator as q,OffsetMode as Z}from"./ShiftManipulator.js";import{pointerMoveTimerMs as W,planePreviewOutlineWidth as J,forceVerticalModifier as Q,forceHorizontalModifier as X,previewFadeDotThreshold as Y,previewFadeDurationSeconds as $,initialDepthOffsetFrac as tt}from"./sliceToolConfig.js";import{createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as wt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as gt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as ft}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Mt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends gt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=W,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=h(),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=Mt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&S(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new q(this.view,Z.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new B(this.view,((t,e)=>U(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new B(this.view,((t,e)=>A(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new K(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=J,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r));const o=n((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),l);this.addHandles([o,n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.active&&(this.view.activeTool=null))}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),S(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=k();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=wt(this.view.state.camera,i,St);this.inputState=Tt(e,t.pointerId,a.origin,a)}return S(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===Q||t.key===X)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==Q&&t.key!==X||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=wt(this.view.state.camera,t.screenPoint,St);S(this.analysisViewData.plane,this._startPlane),this.inputState=Tt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(x(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=m(z.get(),this._startPlane.origin),i=m(z.get(),x(this._startPlane));w(i,i,-t.depth),g(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=d(G.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=f(z.get(),this._startPlane.basis1,e),a=f(z.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,k());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=wt(this.view.state.camera,t.screenPoint,St),a=z.get();R(this.analysisViewData.plane.plane,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:V(a)})}_createResizeDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=S(this.analysisViewData.plane,k());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,S(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:k();if(i=null!=i?S(i,kt):null,this._pickPlane(t,!0,e,a)){const t=Y;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(M(z.get(),i.basis1),M(z.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=o({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=p(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=z.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(z.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&w(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*tt,p=w(z.get(),r,h);g(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[Q]?ot.VERTICAL:i[X]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(z.get(),y(t.basis1),y(t.basis2),1),s=_(G.get(),a),n=v(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=F(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=T(N);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=E}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Tt(t,e,i,a){const s=Pt(i,x(a),t.direction,C()),n=b();return R(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([u()],bt.prototype,"_clock",void 0),t([u({constructOnly:!0})],bt.prototype,"view",void 0),t([u()],bt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],bt.prototype,"state",null),t([u({readOnly:!0})],bt.prototype,"cursor",null),t([u()],bt.prototype,"analysis",null),t([u()],bt.prototype,"removeIncompleteOnCancel",void 0),t([u()],bt.prototype,"_layersMode",void 0),t([u()],bt.prototype,"layersMode",null),t([u({value:null})],bt.prototype,"inputState",null),t([u()],bt.prototype,"_isPlacingSlicePlane",null),t([u()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([c("esri.views.3d.analysis.Slice.SliceTool")],bt);const kt=k(),St=I(),xt=bt;export{xt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../../core/scheduling.js";import{createScreenPoint as h,screenPointObjectToArray as p}from"../../../../core/screenUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as d,fromScaling as _,multiply as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{k as P,l as y,c as m,h as w,g,e as f,n as M,s as D}from"../../../../chunks/vec32.js";import{clone as V,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as k,c as S,n as x,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as C,intersectRay as R,getNormal as O}from"../../../../geometry/support/plane.js";import{create as I}from"../../../../geometry/support/ray.js";import{sv3d as z,sm4d as G,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as A}from"../images/Factory.js";import{ResizeManipulator as K}from"./ResizeManipulator.js";import{RotateManipulator as B}from"./RotateManipulator.js";import{getOutlineColor as F,planeColor as N}from"./settings.js";import{ShiftManipulator as q,OffsetMode as Z}from"./ShiftManipulator.js";import{pointerMoveTimerMs as W,planePreviewOutlineWidth as J,forceVerticalModifier as Q,forceHorizontalModifier as X,previewFadeDotThreshold as Y,previewFadeDurationSeconds as $,initialDepthOffsetFrac as tt}from"./sliceToolConfig.js";import{createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as wt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as gt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as ft}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Mt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends gt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=W,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=h(),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=Mt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&S(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new q(this.view,Z.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new B(this.view,((t,e)=>U(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new B(this.view,((t,e)=>A(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new K(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=J,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r));const o=n((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),l);this.addHandles([o,n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.active&&(this.view.activeTool=null))}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),S(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=k();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=wt(this.view.state.camera,i,St);this.inputState=Tt(e,t.pointerId,a.origin,a)}return S(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===Q||t.key===X)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==Q&&t.key!==X||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=wt(this.view.state.camera,t.screenPoint,St);S(this.analysisViewData.plane,this._startPlane),this.inputState=Tt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(x(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=m(z.get(),this._startPlane.origin),i=m(z.get(),x(this._startPlane));w(i,i,-t.depth),g(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=d(G.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=f(z.get(),this._startPlane.basis1,e),a=f(z.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,k());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=wt(this.view.state.camera,t.screenPoint,St),a=z.get();R(this.analysisViewData.plane.plane,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:V(a)})}_createResizeDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=S(this.analysisViewData.plane,k());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,S(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:k();if(i=null!=i?S(i,kt):null,this._pickPlane(t,!0,e,a)){const t=Y;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(M(z.get(),i.basis1),M(z.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=o({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=p(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=z.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(z.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&w(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*tt,p=w(z.get(),r,h);g(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[Q]?ot.VERTICAL:i[X]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(z.get(),y(t.basis1),y(t.basis2),1),s=_(G.get(),a),n=v(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=F(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=T(N);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=E}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Tt(t,e,i,a){const s=Pt(i,x(a),t.direction,C()),n=b();return R(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([u()],bt.prototype,"_clock",void 0),t([u({constructOnly:!0})],bt.prototype,"view",void 0),t([u()],bt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],bt.prototype,"state",null),t([u({readOnly:!0})],bt.prototype,"cursor",null),t([u()],bt.prototype,"analysis",null),t([u()],bt.prototype,"removeIncompleteOnCancel",void 0),t([u()],bt.prototype,"_layersMode",void 0),t([u()],bt.prototype,"layersMode",null),t([u({value:null})],bt.prototype,"inputState",null),t([u()],bt.prototype,"_isPlacingSlicePlane",null),t([u()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([c("esri.views.3d.analysis.Slice.SliceTool")],bt);const kt=k(),St=I(),xt=bt;export{xt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as e,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{rotateZ as r,fromZRotation as s,scale as a,multiply as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{h as u,c as d,j as g,b as m,n as p,g as f,l as b,f as T,s as h,o as I,y as E}from"../../../../chunks/vec32.js";import{clone as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as j}from"../../../../geometry/projection.js";import{Axis as R}from"../../../../geometry/support/Axis.js";import{r as w,f as O,i as P,a as L,n as v,u as V}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as C,fromPositionAndNormal as _}from"../../../../geometry/support/plane.js";import{create as M}from"../../../../geometry/support/ray.js";import{angleAroundAxis as S}from"../../../../geometry/support/vector.js";import{sv3d as y,sm4d as N}from"../../../../geometry/support/vectorStacks.js";import{getOutlineColor as H,planeColor as U,getGridColor as x}from"./settings.js";import{verticalDotThreshold as G,smallAngleDotThreshold as k,planeMinBasisScreenLen2 as X,initialPlaneHalfSizeViewProportion as D,shiftRestartOffsetDistance as Y,resizeHandleEdgePaddingFrac as Z,planeOutlineWidth as z}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as F}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as W}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as B}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as $}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as q}from"../../support/RenderCoordsHelper.js";import{fromRender as J}from"../../support/geometryUtils/ray.js";import{RenderOccludedFlag as K}from"../../webgl-engine/lib/Material.js";import{ManipulatorStateCustomFlags as Q}from"../../../interactive/interfaces.js";import ii from"../../../../geometry/Point.js";import ti from"../../../../geometry/Extent.js";function ei(i,t,e,n,o,r,s,a){return ni(t,s.worldUpAtPosition(i,y.get()),o,r,a.basis1,a.basis2),u(a.basis1,a.basis1,e),u(a.basis2,a.basis2,n),d(a.origin,i),C(a.basis2,a.basis1,a.origin,a.plane),a}function ni(i,t,e,n,o,r){const s=g(i,t),a=y.get(),c=y.get();switch(n===Mi.HORIZONTAL_OR_VERTICAL?Math.abs(s)>G?Mi.HORIZONTAL:Mi.VERTICAL:n){case Mi.VERTICAL:{const n=Math.abs(s)<=k?i:e.viewUp;m(a,n,t),d(c,t);break}case Mi.HORIZONTAL:m(a,e.viewUp,t),m(c,t,a);break;case Mi.TILTED:{const n=Math.abs(s)<=k?t:e.viewUp;m(a,n,i),m(c,i,a);break}}const l=m(y.get(),a,c);g(l,e.viewForward)>0&&u(c,c,-1),p(o,a),p(r,c)}function oi(i,t,e){const n=t.worldUpAtPosition(i.origin,y.get()),o=i.basis1,r=Oi(i,n),s=Math.round(r/Ni)*Ni;return w(i,s-r,o,e)}function ri(i,t,e,n,o,r){const s=d(y.get(),o.origin);f(s,s,u(y.get(),o.basis1,i.direction[0]<0?1:-1)),f(s,s,u(y.get(),o.basis2,i.direction[1]<0?1:-1));const a=b(o.basis1),c=b(o.basis2),l=T(y.get(),e,s),m=T(y.get(),t,s);let p=0,h=0;if(Ei(i)){const t=Ii(o),e=Ii(r);p=a-.5*i.direction[0]*g(o.basis1,m)/a,h=c-.5*i.direction[1]*g(o.basis2,m)/c;const n=e/t;p*=n,h*=n}const I=p+.5*i.direction[0]*g(o.basis1,l)/a,E=h+.5*i.direction[1]*g(o.basis2,l)/c,A=u(y.get(),o.basis1,I/a),j=u(y.get(),o.basis2,E/c);(I<=0||Ti(r.origin,A,n)<=X)&&d(A,r.basis1),(E<=0||Ti(r.origin,j,n)<=X)&&d(j,r.basis2);const R=d(y.get(),s);return f(R,R,u(y.get(),A,i.direction[0]<0?-1:1)),f(R,R,u(y.get(),j,i.direction[1]<0?-1:1)),O(R,A,j,r)}function si(i,t){return D*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(i)}function ai(i,t,e,n){const o=m(y.get(),t,e);return m(o,o,t),_(i,o,n)}function ci(i,t){return W(i.basis1,i.basis2,i.origin,t)}function li(i,t,e,n){const o=t.worldUpAtPosition(i.origin,y.get()),r=y.get();switch(e){case _i.HEADING:d(r,o);break;case _i.TILT:d(r,i.basis1)}return _(i.origin,r,n)}function ui(i,t,e,n){const s=bi(e,fi.NEGATIVE_X),a=N.get();r(a,t,s.edge*Math.PI/2);const c=p(y.get(),s.basis);let l=u(y.get(),c,s.direction*n.computeScreenPixelSizeAt(s.position)*Y);f(l,l,s.position);const d=n.projectToRenderScreen(l,o(y.get())),g=di(n,d);J(n,d,yi),p(yi.direction,yi.direction);const m=y.get();!g&&P(e,yi,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=A(l),g?i.state|=Si:i.state&=~Si}function di(i,t){const[e,n,o,r]=i.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<e+s?(t[0]=e+s,a=!1):t[0]>e+o-s&&(t[0]=e+o-s,a=!1),t[1]<n+s?(t[1]=n+s,a=!1):t[1]>n+r-s&&(t[1]=n+r-s,a=!1),a}function gi(i,t,e,n){const o=b(n.basis1),r=b(n.basis2),l=hi(n),d=Ii(n),g=h(y.get(),0,0,0);f(g,u(y.get(),n.basis1,t.direction[0]),u(y.get(),n.basis2,t.direction[1])),f(g,n.origin,g);let m=0,p=1;if(Ei(t))1===t.direction[0]&&-1===t.direction[1]?m=Ni:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),p=d;else{const i=0!==t.direction[0]?1:2;m=1===i?Ni:0,p=(1===i?r:o)-l}const T=s(N.get(),m);a(T,T,h(y.get(),p,p,p)),c(T,e,T),T[12]=0,T[13]=0,T[14]=0,i.modelTransform=T,i.renderLocation=g}function mi(i,t,e,n){const o=n.worldUpAtPosition(e.origin,y.get()),r=bi(e,fi.POSITIVE_X),a=s(N.get(),r.edge*Math.PI/2);l(a,a,-Oi(e,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=r.position}function pi(i,t,e){const n=bi(e,fi.POSITIVE_Y),o=s(N.get(),n.edge*Math.PI/2);l(o,o,Ni),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,i.modelTransform=o,i.renderLocation=n.position}var fi;function bi(i,t){switch(t){case fi.POSITIVE_X:return{basis:i.basis1,direction:1,position:f(y.get(),i.origin,i.basis1),edge:t};case fi.POSITIVE_Y:return{basis:i.basis2,direction:1,position:f(y.get(),i.origin,i.basis2),edge:t};case fi.NEGATIVE_X:return{basis:i.basis1,direction:-1,position:T(y.get(),i.origin,i.basis1),edge:t};case fi.NEGATIVE_Y:return{basis:i.basis2,direction:-1,position:T(y.get(),i.origin,i.basis2),edge:t}}}function Ti(i,t,e){const n=e.projectToRenderScreen(f(y.get(),i,t),o(y.get())),r=e.projectToRenderScreen(T(y.get(),i,t),o(y.get()));return I(T(n,n,r))}function hi(i){const t=b(i.basis1),e=b(i.basis2);return Z*Math.min(t,e)}function Ii(i){return hi(i)}function Ei(i){return 0!==i.direction[0]&&0!==i.direction[1]}function Ai(i){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new B({view:i,attached:!1,color:H(i.effectiveTheme),width:z,renderOccluded:K.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function ji(i){return new $({view:i,attached:!1,backgroundColor:U,gridColor:x(i.effectiveTheme),gridWidth:4,renderOccluded:K.OccludeAndTransparent,isDecoration:!0})}function Ri(t,n,o,r=new i){if(null==t)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(t.origin,new ii({spatialReference:n.spatialReference}));if(null==a)return null;const c=j(a,o);if(null==c)return null;r.position=c;const l=2*b(t.basis1),u=2*b(t.basis2),d=q.renderUnitScaleFactor(n.spatialReference,o);r.width=l*d,r.height=u*d;const g=s.worldUpAtPosition(t.origin,y.get());return r.tilt=e(Oi(t,g)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function wi(i,t,e){if(null==i)return null;const n=i.origin,o=y.get(),r=y.get(),s=y.get(),a=y.get();let c,l,u,d,g,m;f(o,n,i.basis1),f(o,o,i.basis2),f(r,n,i.basis1),E(r,r,i.basis2),E(s,n,i.basis1),E(s,s,i.basis2),E(a,n,i.basis1),f(a,a,i.basis2);for(const p of[o,r,s,a]){const i=t.fromRenderCoords(p,p,e);if(null==i)return null;c=null==c?i[0]:Math.min(c,i[0]),l=null==l?i[0]:Math.max(l,i[0]),u=null==u?i[1]:Math.min(u,i[1]),d=null==d?i[1]:Math.max(d,i[1]),g=null==g?i[2]:Math.min(g,i[2]),m=null==m?i[2]:Math.max(m,i[2])}return new ti({xmin:c,xmax:l,ymin:u,ymax:d,zmin:g,zmax:m,spatialReference:e})}function Oi(i,t){return S(t,i.basis2,i.basis1)+Ni}function Pi(i,e,o,r,s,a,c=L()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,R.X,c.basis1),a.worldBasisAtPosition(c.origin,R.Y,c.basis2),C(c.basis2,c.basis1,c.origin,c.plane),w(c,-n(e),v(c),c),w(c,n(o),c.basis1,c),u(c.basis1,c.basis1,r/2),u(c.basis2,c.basis2,s/2),V(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Li(i,t){if(null==i?.position)return null;const e=F(i.position,t.spatialReference,t.elevationProvider);if(null==e)return null;const n=q.renderUnitScaleFactor(i.position.spatialReference,t.spatialReference),o=i.width*n,r=i.height*n;return{position:e,heading:i.heading,tilt:i.tilt,renderWidth:o,renderHeight:r}}function vi(i,t,e,n=L()){const o=Li(i,t);return null==o?null:Vi(o,t,e,n)}function Vi(i,t,e,n=L()){if(null==i)return null;const o=Pi(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,t.renderCoordsHelper,n);return e.tiltEnabled||null==o||oi(o,t.renderCoordsHelper,o),o}!function(i){i[i.POSITIVE_X=0]="POSITIVE_X",i[i.POSITIVE_Y=1]="POSITIVE_Y",i[i.NEGATIVE_X=2]="NEGATIVE_X",i[i.NEGATIVE_Y=3]="NEGATIVE_Y"}(fi||(fi={}));const Ci=Q.Custom1;var _i,Mi;!function(i){i[i.HEADING=1]="HEADING",i[i.TILT=2]="TILT"}(_i||(_i={})),function(i){i[i.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",i[i.HORIZONTAL=1]="HORIZONTAL",i[i.VERTICAL=2]="VERTICAL",i[i.TILTED=3]="TILTED"}(Mi||(Mi={}));const Si=Q.Custom2,yi=M(),Ni=Math.PI/2,Hi=Q.Custom1,Ui=Q.Custom2;function xi(i){return null!=("building-scene-3d"===i.type?i:null)}export{Ci as DidPointerMoveRecentlyFlag,Si as IsShiftEdgeOnScreenFlag,_i as RotationAxis,Mi as SliceOrientation,ci as calculateBoundedPlaneTranslateRotate,Ii as calculateDiagonalResizeHandleScale,si as calculatePlaneHalfSize,ji as createGridVisualElement,Ai as createOutlineVisualElement,ei as createPlane,li as createRotatePlane,ai as createShiftPlane,oi as forceHorizontalOrVertical,Ei as isDiagonalResizeHandle,xi as isIBuildingSceneLayerView3D,ni as normalToBases,wi as planeToExtent,Ri as planeToShape,Li as projectAndElevationAlignShape,Vi as projectedShapeToPlane,Hi as resizeNormal,Ui as resizeOutlineOnly,ri as resizePlane,vi as shapeToPlane,gi as updateResizeHandle,mi as updateRotateHeadingHandle,pi as updateRotateTiltHandle,ui as updateShiftRestartHandle};
5
+ import"../../../../geometry.js";import i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as e,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{rotateZ as r,fromZRotation as s,scale as a,multiply as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{h as u,c as d,k as g,b as m,n as p,g as f,l as b,f as T,s as h,p as I,z as E}from"../../../../chunks/vec32.js";import{clone as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as j}from"../../../../geometry/projection.js";import{Axis as R}from"../../../../geometry/support/Axis.js";import{r as w,f as O,i as P,a as L,n as v,u as V}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as C,fromPositionAndNormal as _}from"../../../../geometry/support/plane.js";import{create as M}from"../../../../geometry/support/ray.js";import{angleAroundAxis as S}from"../../../../geometry/support/vector.js";import{sv3d as y,sm4d as N}from"../../../../geometry/support/vectorStacks.js";import{getOutlineColor as H,planeColor as U,getGridColor as x}from"./settings.js";import{verticalDotThreshold as k,smallAngleDotThreshold as G,planeMinBasisScreenLen2 as X,initialPlaneHalfSizeViewProportion as D,shiftRestartOffsetDistance as Y,resizeHandleEdgePaddingFrac as Z,planeOutlineWidth as z}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as F}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as W}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as B}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as $}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as q}from"../../support/RenderCoordsHelper.js";import{fromRender as J}from"../../support/geometryUtils/ray.js";import{RenderOccludedFlag as K}from"../../webgl-engine/lib/Material.js";import{ManipulatorStateCustomFlags as Q}from"../../../interactive/interfaces.js";import ii from"../../../../geometry/Point.js";import ti from"../../../../geometry/Extent.js";function ei(i,t,e,n,o,r,s,a){return ni(t,s.worldUpAtPosition(i,y.get()),o,r,a.basis1,a.basis2),u(a.basis1,a.basis1,e),u(a.basis2,a.basis2,n),d(a.origin,i),C(a.basis2,a.basis1,a.origin,a.plane),a}function ni(i,t,e,n,o,r){const s=g(i,t),a=y.get(),c=y.get();switch(n===Mi.HORIZONTAL_OR_VERTICAL?Math.abs(s)>k?Mi.HORIZONTAL:Mi.VERTICAL:n){case Mi.VERTICAL:{const n=Math.abs(s)<=G?i:e.viewUp;m(a,n,t),d(c,t);break}case Mi.HORIZONTAL:m(a,e.viewUp,t),m(c,t,a);break;case Mi.TILTED:{const n=Math.abs(s)<=G?t:e.viewUp;m(a,n,i),m(c,i,a);break}}const l=m(y.get(),a,c);g(l,e.viewForward)>0&&u(c,c,-1),p(o,a),p(r,c)}function oi(i,t,e){const n=t.worldUpAtPosition(i.origin,y.get()),o=i.basis1,r=Oi(i,n),s=Math.round(r/Ni)*Ni;return w(i,s-r,o,e)}function ri(i,t,e,n,o,r){const s=d(y.get(),o.origin);f(s,s,u(y.get(),o.basis1,i.direction[0]<0?1:-1)),f(s,s,u(y.get(),o.basis2,i.direction[1]<0?1:-1));const a=b(o.basis1),c=b(o.basis2),l=T(y.get(),e,s),m=T(y.get(),t,s);let p=0,h=0;if(Ei(i)){const t=Ii(o),e=Ii(r);p=a-.5*i.direction[0]*g(o.basis1,m)/a,h=c-.5*i.direction[1]*g(o.basis2,m)/c;const n=e/t;p*=n,h*=n}const I=p+.5*i.direction[0]*g(o.basis1,l)/a,E=h+.5*i.direction[1]*g(o.basis2,l)/c,A=u(y.get(),o.basis1,I/a),j=u(y.get(),o.basis2,E/c);(I<=0||Ti(r.origin,A,n)<=X)&&d(A,r.basis1),(E<=0||Ti(r.origin,j,n)<=X)&&d(j,r.basis2);const R=d(y.get(),s);return f(R,R,u(y.get(),A,i.direction[0]<0?-1:1)),f(R,R,u(y.get(),j,i.direction[1]<0?-1:1)),O(R,A,j,r)}function si(i,t){return D*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(i)}function ai(i,t,e,n){const o=m(y.get(),t,e);return m(o,o,t),_(i,o,n)}function ci(i,t){return W(i.basis1,i.basis2,i.origin,t)}function li(i,t,e,n){const o=t.worldUpAtPosition(i.origin,y.get()),r=y.get();switch(e){case _i.HEADING:d(r,o);break;case _i.TILT:d(r,i.basis1)}return _(i.origin,r,n)}function ui(i,t,e,n){const s=bi(e,fi.NEGATIVE_X),a=N.get();r(a,t,s.edge*Math.PI/2);const c=p(y.get(),s.basis);let l=u(y.get(),c,s.direction*n.computeScreenPixelSizeAt(s.position)*Y);f(l,l,s.position);const d=n.projectToRenderScreen(l,o(y.get())),g=di(n,d);J(n,d,yi),p(yi.direction,yi.direction);const m=y.get();!g&&P(e,yi,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=A(l),g?i.state|=Si:i.state&=~Si}function di(i,t){const[e,n,o,r]=i.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<e+s?(t[0]=e+s,a=!1):t[0]>e+o-s&&(t[0]=e+o-s,a=!1),t[1]<n+s?(t[1]=n+s,a=!1):t[1]>n+r-s&&(t[1]=n+r-s,a=!1),a}function gi(i,t,e,n){const o=b(n.basis1),r=b(n.basis2),l=hi(n),d=Ii(n),g=h(y.get(),0,0,0);f(g,u(y.get(),n.basis1,t.direction[0]),u(y.get(),n.basis2,t.direction[1])),f(g,n.origin,g);let m=0,p=1;if(Ei(t))1===t.direction[0]&&-1===t.direction[1]?m=Ni:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),p=d;else{const i=0!==t.direction[0]?1:2;m=1===i?Ni:0,p=(1===i?r:o)-l}const T=s(N.get(),m);a(T,T,h(y.get(),p,p,p)),c(T,e,T),T[12]=0,T[13]=0,T[14]=0,i.modelTransform=T,i.renderLocation=g}function mi(i,t,e,n){const o=n.worldUpAtPosition(e.origin,y.get()),r=bi(e,fi.POSITIVE_X),a=s(N.get(),r.edge*Math.PI/2);l(a,a,-Oi(e,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=r.position}function pi(i,t,e){const n=bi(e,fi.POSITIVE_Y),o=s(N.get(),n.edge*Math.PI/2);l(o,o,Ni),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,i.modelTransform=o,i.renderLocation=n.position}var fi;function bi(i,t){switch(t){case fi.POSITIVE_X:return{basis:i.basis1,direction:1,position:f(y.get(),i.origin,i.basis1),edge:t};case fi.POSITIVE_Y:return{basis:i.basis2,direction:1,position:f(y.get(),i.origin,i.basis2),edge:t};case fi.NEGATIVE_X:return{basis:i.basis1,direction:-1,position:T(y.get(),i.origin,i.basis1),edge:t};case fi.NEGATIVE_Y:return{basis:i.basis2,direction:-1,position:T(y.get(),i.origin,i.basis2),edge:t}}}function Ti(i,t,e){const n=e.projectToRenderScreen(f(y.get(),i,t),o(y.get())),r=e.projectToRenderScreen(T(y.get(),i,t),o(y.get()));return I(T(n,n,r))}function hi(i){const t=b(i.basis1),e=b(i.basis2);return Z*Math.min(t,e)}function Ii(i){return hi(i)}function Ei(i){return 0!==i.direction[0]&&0!==i.direction[1]}function Ai(i){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new B({view:i,attached:!1,color:H(i.effectiveTheme),width:z,renderOccluded:K.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function ji(i){return new $({view:i,attached:!1,backgroundColor:U,gridColor:x(i.effectiveTheme),gridWidth:4,renderOccluded:K.OccludeAndTransparent,isDecoration:!0})}function Ri(t,n,o,r=new i){if(null==t)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(t.origin,new ii({spatialReference:n.spatialReference}));if(null==a)return null;const c=j(a,o);if(null==c)return null;r.position=c;const l=2*b(t.basis1),u=2*b(t.basis2),d=q.renderUnitScaleFactor(n.spatialReference,o);r.width=l*d,r.height=u*d;const g=s.worldUpAtPosition(t.origin,y.get());return r.tilt=e(Oi(t,g)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function wi(i,t,e){if(null==i)return null;const n=i.origin,o=y.get(),r=y.get(),s=y.get(),a=y.get();let c,l,u,d,g,m;f(o,n,i.basis1),f(o,o,i.basis2),f(r,n,i.basis1),E(r,r,i.basis2),E(s,n,i.basis1),E(s,s,i.basis2),E(a,n,i.basis1),f(a,a,i.basis2);for(const p of[o,r,s,a]){const i=t.fromRenderCoords(p,p,e);if(null==i)return null;c=null==c?i[0]:Math.min(c,i[0]),l=null==l?i[0]:Math.max(l,i[0]),u=null==u?i[1]:Math.min(u,i[1]),d=null==d?i[1]:Math.max(d,i[1]),g=null==g?i[2]:Math.min(g,i[2]),m=null==m?i[2]:Math.max(m,i[2])}return new ti({xmin:c,xmax:l,ymin:u,ymax:d,zmin:g,zmax:m,spatialReference:e})}function Oi(i,t){return S(t,i.basis2,i.basis1)+Ni}function Pi(i,e,o,r,s,a,c=L()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,R.X,c.basis1),a.worldBasisAtPosition(c.origin,R.Y,c.basis2),C(c.basis2,c.basis1,c.origin,c.plane),w(c,-n(e),v(c),c),w(c,n(o),c.basis1,c),u(c.basis1,c.basis1,r/2),u(c.basis2,c.basis2,s/2),V(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Li(i,t){if(null==i?.position)return null;const e=F(i.position,t.spatialReference,t.elevationProvider);if(null==e)return null;const n=q.renderUnitScaleFactor(i.position.spatialReference,t.spatialReference),o=i.width*n,r=i.height*n;return{position:e,heading:i.heading,tilt:i.tilt,renderWidth:o,renderHeight:r}}function vi(i,t,e,n=L()){const o=Li(i,t);return null==o?null:Vi(o,t,e,n)}function Vi(i,t,e,n=L()){if(null==i)return null;const o=Pi(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,t.renderCoordsHelper,n);return e.tiltEnabled||null==o||oi(o,t.renderCoordsHelper,o),o}!function(i){i[i.POSITIVE_X=0]="POSITIVE_X",i[i.POSITIVE_Y=1]="POSITIVE_Y",i[i.NEGATIVE_X=2]="NEGATIVE_X",i[i.NEGATIVE_Y=3]="NEGATIVE_Y"}(fi||(fi={}));const Ci=Q.Custom1;var _i,Mi;!function(i){i[i.HEADING=1]="HEADING",i[i.TILT=2]="TILT"}(_i||(_i={})),function(i){i[i.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",i[i.HORIZONTAL=1]="HORIZONTAL",i[i.VERTICAL=2]="VERTICAL",i[i.TILTED=3]="TILTED"}(Mi||(Mi={}));const Si=Q.Custom2,yi=M(),Ni=Math.PI/2,Hi=Q.Custom1,Ui=Q.Custom2;function xi(i){return null!=("building-scene-3d"===i.type?i:null)}export{Ci as DidPointerMoveRecentlyFlag,Si as IsShiftEdgeOnScreenFlag,_i as RotationAxis,Mi as SliceOrientation,ci as calculateBoundedPlaneTranslateRotate,Ii as calculateDiagonalResizeHandleScale,si as calculatePlaneHalfSize,ji as createGridVisualElement,Ai as createOutlineVisualElement,ei as createPlane,li as createRotatePlane,ai as createShiftPlane,oi as forceHorizontalOrVertical,Ei as isDiagonalResizeHandle,xi as isIBuildingSceneLayerView3D,ni as normalToBases,wi as planeToExtent,Ri as planeToShape,Li as projectAndElevationAlignShape,Vi as projectedShapeToPlane,Hi as resizeNormal,Ui as resizeOutlineOnly,ri as resizePlane,vi as shapeToPlane,gi as updateResizeHandle,mi as updateRotateHeadingHandle,pi as updateRotateTiltHandle,ui as updateShiftRestartHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,g as e,h as r,a as o,j as n,p as i,c as s,n as f,b as m}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicArea as c}from"../../../../geometry/geometryEngine.js";import u from"../../../../geometry/Polygon.js";import p from"../../../../geometry/SpatialReference.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToWGS84ComparableLonLat as h}from"../../../../geometry/projection/projectVectorToWGS84ComparableLonLat.js";import{inverseGeodeticSolver as j,InverseGeodeticSolverResult as y}from"../../../../geometry/support/geodesicUtils.js";import{g as b}from"../../../../chunks/sphere.js";import{planeFromPoints as P}from"../../support/mathUtils.js";function S(n,i){const s=b(i);t(s,0,0,0);for(let t=0;t<n.length;++t)e(s,s,n[t]);r(s,s,1/n.length);let f=0;for(let t=0;t<n.length;++t)f=Math.max(f,o(s,n[t]));i[3]=Math.sqrt(f)}function w(t,e){if(t.length<3)throw new Error("need at least 3 points to fit a plane");P(t[0],t[1],t[2],e)}function G(t,e){return n(t,e)+t[3]}function W(t,e,r){return l(t,k,r)&&l(e,q,r)?i(k,q):0}function d(t,e){if(!g(t,k)||!g(e,q))return 0;const r=new y;return j(r,[k[0],k[1]],[q[0],q[1]],p.WGS84),r.distance}function L(t,e,r){const o=new y;return j(o,[t[0],t[1]],[e[0],e[1]],r??p.WGS84),o.distance}function T(t,e,r,o){const n=C;return h(t,o,k)&&h(e,o,q)&&h(r,o,v)?(n.setPoint(0,0,k),n.setPoint(0,1,q),n.setPoint(0,2,v),Math.abs(c(n,"square-meters"))):0}function x(r,o=null,i=!0){const a=1e-6,c=(t,e)=>{if(0===e[0]&&0===e[1]&&0===e[2])return!1;for(let r=0;r<t.length;++r)if(n(e,t[r])<-a)return!1;return!0};if(0===r.length)return!1;if(1===r.length)return o&&s(o,r[0]),!0;t(E,0,0,0);for(let t=0;t<r.length;++t)e(E,E,r[t]);if(f(E,E),c(r,E))return o&&s(o,E),!0;if(!i)return!1;for(let t=0;t<r.length;++t)for(let e=0;e<r.length;++e)if(t!==e&&(m(E,r[t],r[e]),f(E,E),c(r,E)))return o&&s(o,E),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const k=a(),q=a(),v=a(),C=new u({rings:[[k,q,v]],spatialReference:p.WGS84}),E=a();export{w as bestFitPlane,S as boundingSphere,x as fitHemisphere,M as isPrimaryPointerAction,G as planePointDistance,W as segmentLengthEuclidean,d as segmentLengthGeodesic,L as segmentLengthGeodesicVector,T as triangleAreaGeodesic};
5
+ import{s as t,g as e,h as r,a as o,k as n,q as i,c as s,n as f,b as m}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicArea as c}from"../../../../geometry/geometryEngine.js";import u from"../../../../geometry/Polygon.js";import p from"../../../../geometry/SpatialReference.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToWGS84ComparableLonLat as h}from"../../../../geometry/projection/projectVectorToWGS84ComparableLonLat.js";import{inverseGeodeticSolver as j,InverseGeodeticSolverResult as y}from"../../../../geometry/support/geodesicUtils.js";import{g as b}from"../../../../chunks/sphere.js";import{planeFromPoints as P}from"../../support/mathUtils.js";function S(n,i){const s=b(i);t(s,0,0,0);for(let t=0;t<n.length;++t)e(s,s,n[t]);r(s,s,1/n.length);let f=0;for(let t=0;t<n.length;++t)f=Math.max(f,o(s,n[t]));i[3]=Math.sqrt(f)}function w(t,e){if(t.length<3)throw new Error("need at least 3 points to fit a plane");P(t[0],t[1],t[2],e)}function G(t,e){return n(t,e)+t[3]}function W(t,e,r){return l(t,x,r)&&l(e,M,r)?i(x,M):0}function d(t,e){if(!g(t,x)||!g(e,M))return 0;const r=new y;return j(r,[x[0],x[1]],[M[0],M[1]],p.WGS84),r.distance}function L(t,e,r){const o=new y;return j(o,[t[0],t[1]],[e[0],e[1]],r??p.WGS84),o.distance}function T(t,e,r,o){const n=C;return h(t,o,x)&&h(e,o,M)&&h(r,o,v)?(n.setPoint(0,0,x),n.setPoint(0,1,M),n.setPoint(0,2,v),Math.abs(c(n,"square-meters"))):0}function k(r,o=null,i=!0){const a=1e-6,c=(t,e)=>{if(0===e[0]&&0===e[1]&&0===e[2])return!1;for(let r=0;r<t.length;++r)if(n(e,t[r])<-a)return!1;return!0};if(0===r.length)return!1;if(1===r.length)return o&&s(o,r[0]),!0;t(E,0,0,0);for(let t=0;t<r.length;++t)e(E,E,r[t]);if(f(E,E),c(r,E))return o&&s(o,E),!0;if(!i)return!1;for(let t=0;t<r.length;++t)for(let e=0;e<r.length;++e)if(t!==e&&(m(E,r[t],r[e]),f(E,E),c(r,E)))return o&&s(o,E),!0;return!1}function q(t){return"mouse"!==t.pointerType||0===t.button}const x=a(),M=a(),v=a(),C=new u({rings:[[x,M,v]],spatialReference:p.WGS84}),E=a();export{w as bestFitPlane,S as boundingSphere,k as fitHemisphere,q as isPrimaryPointerAction,G as planePointDistance,W as segmentLengthEuclidean,d as segmentLengthGeodesic,L as segmentLengthGeodesicVector,T as triangleAreaGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{l as s,p as o,k as a,c as h,f as n,t as c,h as r,b as m,j as p,g as l,n as d}from"../../../../chunks/vec32.js";import{create as M,clone as y,UNIT_Z as g,UNIT_Y as w,UNIT_X as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{angle as P,slerp as A}from"../../support/mathUtils.js";class _{constructor(t){this.viewingMode=t,this.center=M(),this.pitch=0,this.yaw=0,this.distance=0,this.direction=y(F),this.fov=55,this.size=1}pixelsPerPanAtZoom(t){return this.size/2/(this._zoomToPanScale*t)}zoomAtPixelsPerPan(t){return this.size/2/(this._zoomToPanScale*t)}pixelsPerRotateAtZoom(){const t=Math.max(Math.cos(Math.abs(this.pitch)),.5);return this.size/2/t}compareTo(t,i){if(i||(i={pan:0,rotate:0,sourceZoom:0,targetZoom:0}),this.viewingMode===f.Global){const e=(s(this.center)+s(t.center))/2;i.pan=P(this.center,t.center)*e}else i.pan=o(this.center,t.center);let e=Math.abs(t.yaw-this.yaw);e>=Math.PI&&(e=2*Math.PI-e);const a=Math.abs(t.pitch-this.pitch);return i.rotate=Math.max(e,a),i.sourceZoom=this.distance,i.targetZoom=t.distance,i}interpolate(i,e,s){this.viewingMode===f.Global?A(i.center,e.center,s.pan,this.center):a(this.center,i.center,e.center,s.pan),this.distance=isFinite(e.distance)?t(i.distance,e.distance,s.zoom):i.distance,this.pitch=t(i.pitch,e.pitch,s.rotate);let o=i.yaw;const h=e.yaw;Math.abs(h-o)>=Math.PI&&(o+=2*(o<h?1:-1)*Math.PI),this.yaw=t(o,h,s.rotate)}copyFrom(t){h(this.center,t.center),this.pitch=t.pitch,this.yaw=t.yaw,this.distance=t.distance,h(this.direction,t.direction),this.size=t.size,this.copyFromCommon(t),this.viewingMode=t.viewingMode}copyFromRenderCamera(t){const i=this._lookAtOrientation(t.center,Z);h(this.center,t.center),n(j,t.center,t.eye),c(j,j,i),c(k,t.up,i),this.distance=s(j),0!==this.distance&&(j[0]/=this.distance,j[1]/=this.distance,j[2]/=this.distance),this.pitch=this._eyeUpToPitch(j),this.yaw=x(j,k),this.size=Math.sqrt(t.width*t.width+t.height*t.height),this.copyFromCommon(t)}copyFromCommon(t){this.fov=t.fov,this._zoomToPanScale=Math.atan(.5*this.fov)}copyToRenderCamera(t){const e=this._lookAtOrientation(this.center,Z);i(e,e),this._axisAngleVec3(V,this.pitch-Math.PI/2,F,j),this._axisAngleVec3(T,this.yaw,j,j),this._axisAngleVec3(V,this.pitch-Math.PI/2,T,k),this._axisAngleVec3(T,this.yaw,k,k),r(j,j,this.distance),c(j,j,e),c(k,k,e),t.center=this.center,t.eye=n(j,this.center,j),t.up=k}_axisAngleVec3(t,i,e,s){const o=Math.cos(i),a=Math.sin(i);return r(v,e,o),m(z,t,e),r(z,z,a),r(b,t,(1-o)*p(t,e)),l(s,l(s,v,z),b)}_lookAtOrientation(t,i=e()){return this._upAtLookAt(t,b),m(v,this.direction,b),d(v,v),0===v[0]&&0===v[1]&&0===v[2]&&h(v,V),m(z,b,v),d(z,z),i[0]=v[0],i[1]=z[0],i[2]=b[0],i[3]=v[1],i[4]=z[1],i[5]=b[1],i[6]=v[2],i[7]=z[2],i[8]=b[2],i}_upAtLookAt(t,i){return this.viewingMode===f.Local?h(i,T):d(i,t)}_eyeUpToPitch(t){return Math.PI-P(T,t)}}function x(t,i){const e=I;return Math.abs(i[2])<.5?(h(e,i),t[2]>0&&r(e,e,-1)):h(e,t),m(z,e,T),d(z,z),P(V,z,T)}const v=M(),z=M(),b=M(),j=M(),k=M(),I=M(),T=g,F=w,V=u,Z=e();export{_ as Camera};
5
+ import{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{l as s,q as o,m as a,c as h,f as n,t as c,h as r,b as m,k as p,g as l,n as d}from"../../../../chunks/vec32.js";import{create as M,clone as y,UNIT_Z as g,UNIT_Y as w,UNIT_X as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{angle as P,slerp as A}from"../../support/mathUtils.js";class _{constructor(t){this.viewingMode=t,this.center=M(),this.pitch=0,this.yaw=0,this.distance=0,this.direction=y(F),this.fov=55,this.size=1}pixelsPerPanAtZoom(t){return this.size/2/(this._zoomToPanScale*t)}zoomAtPixelsPerPan(t){return this.size/2/(this._zoomToPanScale*t)}pixelsPerRotateAtZoom(){const t=Math.max(Math.cos(Math.abs(this.pitch)),.5);return this.size/2/t}compareTo(t,i){if(i||(i={pan:0,rotate:0,sourceZoom:0,targetZoom:0}),this.viewingMode===f.Global){const e=(s(this.center)+s(t.center))/2;i.pan=P(this.center,t.center)*e}else i.pan=o(this.center,t.center);let e=Math.abs(t.yaw-this.yaw);e>=Math.PI&&(e=2*Math.PI-e);const a=Math.abs(t.pitch-this.pitch);return i.rotate=Math.max(e,a),i.sourceZoom=this.distance,i.targetZoom=t.distance,i}interpolate(i,e,s){this.viewingMode===f.Global?A(i.center,e.center,s.pan,this.center):a(this.center,i.center,e.center,s.pan),this.distance=isFinite(e.distance)?t(i.distance,e.distance,s.zoom):i.distance,this.pitch=t(i.pitch,e.pitch,s.rotate);let o=i.yaw;const h=e.yaw;Math.abs(h-o)>=Math.PI&&(o+=2*(o<h?1:-1)*Math.PI),this.yaw=t(o,h,s.rotate)}copyFrom(t){h(this.center,t.center),this.pitch=t.pitch,this.yaw=t.yaw,this.distance=t.distance,h(this.direction,t.direction),this.size=t.size,this.copyFromCommon(t),this.viewingMode=t.viewingMode}copyFromRenderCamera(t){const i=this._lookAtOrientation(t.center,Z);h(this.center,t.center),n(j,t.center,t.eye),c(j,j,i),c(k,t.up,i),this.distance=s(j),0!==this.distance&&(j[0]/=this.distance,j[1]/=this.distance,j[2]/=this.distance),this.pitch=this._eyeUpToPitch(j),this.yaw=x(j,k),this.size=Math.sqrt(t.width*t.width+t.height*t.height),this.copyFromCommon(t)}copyFromCommon(t){this.fov=t.fov,this._zoomToPanScale=Math.atan(.5*this.fov)}copyToRenderCamera(t){const e=this._lookAtOrientation(this.center,Z);i(e,e),this._axisAngleVec3(V,this.pitch-Math.PI/2,F,j),this._axisAngleVec3(T,this.yaw,j,j),this._axisAngleVec3(V,this.pitch-Math.PI/2,T,k),this._axisAngleVec3(T,this.yaw,k,k),r(j,j,this.distance),c(j,j,e),c(k,k,e),t.center=this.center,t.eye=n(j,this.center,j),t.up=k}_axisAngleVec3(t,i,e,s){const o=Math.cos(i),a=Math.sin(i);return r(v,e,o),m(z,t,e),r(z,z,a),r(b,t,(1-o)*p(t,e)),l(s,l(s,v,z),b)}_lookAtOrientation(t,i=e()){return this._upAtLookAt(t,b),m(v,this.direction,b),d(v,v),0===v[0]&&0===v[1]&&0===v[2]&&h(v,V),m(z,b,v),d(z,z),i[0]=v[0],i[1]=z[0],i[2]=b[0],i[3]=v[1],i[4]=z[1],i[5]=b[1],i[6]=v[2],i[7]=z[2],i[8]=b[2],i}_upAtLookAt(t,i){return this.viewingMode===f.Local?h(i,T):d(i,t)}_eyeUpToPitch(t){return Math.PI-P(T,t)}}function x(t,i){const e=I;return Math.abs(i[2])<.5?(h(e,i),t[2]>0&&r(e,e,-1)):h(e,t),m(z,e,T),d(z,z),P(V,z,T)}const v=M(),z=M(),b=M(),j=M(),k=M(),I=M(),T=g,F=w,V=u,Z=e();export{_ as Camera};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{c as n,h as a,j as m}from"../../../../chunks/vec32.js";import{ConstraintOptions as t}from"./ConstraintOptions.js";import{ConstraintTypes as i}from"./ConstraintTypes.js";function o(n,a){return 0!=(n&a)}function r(n,a,m,t,i,o){0!==n&&(m?(o.min=Math.min(o.min,a),o.max=Math.max(o.max,a)):null!=t?(o.min-=Math.max(0,(a-o.min)*(1-t)),o.max+=Math.max(0,(a-o.max)*(1-t))):i&&(o.min-=Math.max(0,a-o.min-i),o.max+=Math.max(0,a-o.max-i)))}const s=new t(i.NONE);function x(t,i,o,r){return i=i||t.viewForward,n(r,i),a(r,r,Math.sign(m(i,o))),r}export{r as adjustRangeForInteraction,s as defaultConstraintOptions,o as hasConstraintType,x as interactionDirectionTowardsConstraintMinimization};
5
+ import{c as n,h as a,k as m}from"../../../../chunks/vec32.js";import{ConstraintOptions as t}from"./ConstraintOptions.js";import{ConstraintTypes as i}from"./ConstraintTypes.js";function o(n,a){return 0!=(n&a)}function r(n,a,m,t,i,o){0!==n&&(m?(o.min=Math.min(o.min,a),o.max=Math.max(o.max,a)):null!=t?(o.min-=Math.max(0,(a-o.min)*(1-t)),o.max+=Math.max(0,(a-o.max)*(1-t))):i&&(o.min-=Math.max(0,a-o.min-i),o.max+=Math.max(0,a-o.max-i)))}const s=new t(i.NONE);function x(t,i,o,r){return i=i||t.viewForward,n(r,i),a(r,r,Math.sign(m(i,o))),r}export{r as adjustRangeForInteraction,s as defaultConstraintOptions,o as hasConstraintType,x as interactionDirectionTowardsConstraintMinimization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{c as e,f as r,g as n,p as t,D as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{h as s,b as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";import{InteractionType as p}from"./InteractionType.js";function d(e,r,n=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,l(e,n,x);const o=O(e,r),i=x.max-o;return i>=-1e-6?0:i}function y(t,o,i=f){const u=d(t,o,i);if(0===u)return!1;const p=t.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const y=O(t,o)+u,l=e(L,o.eye),x=m(o,i.interactionDirection,g(o,p.renderLocation,h),I);if(!s(a(p.renderLocation,y),c(o.eye,x),C))return!1;o.eye=C;const N=r(j,o.eye,l);o.center=n(C,o.center,N);const b=t.renderCoordsHelper.getAltitude(o.center),k=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,b,C);return null!=k&&(o.center=k),!0}function l(e,r,n){const t=r.interactionType;if(t===p.NONE)return;const{min:o,max:i}=n,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=t===p.ZOOM||t===p.PAN,f=d(e,c),m=0===f?0:O(e,c);n.min=o,n.max=i;u(f,m,a,s,.05*m,n)}function O(e,r){const n=e.pointsOfInterest.surfaceOrigin;return n.renderLocation?t(r.eye,n.renderLocation):0}function g(e,r,n){return o(n,e.eye,r)}const x={min:0,max:0},L=i(),j=i(),I=i(),h=i(),C=i();export{y as applyDistanceConstraint,d as getDistanceConstraintError};
5
+ import{c as e,f as r,g as n,q as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{h as s,b as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";import{InteractionType as p}from"./InteractionType.js";function d(e,r,n=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,l(e,n,x);const o=O(e,r),i=x.max-o;return i>=-1e-6?0:i}function y(t,o,i=f){const u=d(t,o,i);if(0===u)return!1;const p=t.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const y=O(t,o)+u,l=e(L,o.eye),x=m(o,i.interactionDirection,g(o,p.renderLocation,h),I);if(!s(a(p.renderLocation,y),c(o.eye,x),C))return!1;o.eye=C;const N=r(j,o.eye,l);o.center=n(C,o.center,N);const b=t.renderCoordsHelper.getAltitude(o.center),k=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,b,C);return null!=k&&(o.center=k),!0}function l(e,r,n){const t=r.interactionType;if(t===p.NONE)return;const{min:o,max:i}=n,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=t===p.ZOOM||t===p.PAN,f=d(e,c),m=0===f?0:O(e,c);n.min=o,n.max=i;u(f,m,a,s,.05*m,n)}function O(e,r){const n=e.pointsOfInterest.surfaceOrigin;return n.renderLocation?t(r.eye,n.renderLocation):0}function g(e,r,n){return o(n,e.eye,r)}const x={min:0,max:0},L=i(),j=i(),I=i(),h=i(),C=i();export{y as applyDistanceConstraint,d as getDistanceConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as o,e as c,h as u,g as l,p as m,j as f,n as d,l as p,o as y}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{j as C,k as T,t as I}from"../../../../chunks/sphere.js";import{hasConstraintType as O,defaultConstraintOptions as A,adjustRangeForInteraction as D}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as j}from"./InteractionType.js";import{TiltMode as x}from"./TiltMode.js";import{viewAngle as R}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){V.eyeCenterDistance=0,V.requiresTwoSteps=!1;const a=U(t,r,n,A,V);if(0===a)return!1;switch(s(_,-a,r.viewRight),n.tiltMode){case x.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,V.eyeCenterDistance),r.center=l(z,r.eye,K);break;case x.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!V.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,J);return N(e,r,a),n.interactionType===j.TUMBLE&&O(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,a),r.tiltMode===x.LOOK_AROUND||n.tiltMode===x.LOOK_AROUND?L(e,t,a,i):P(e,t,a)}function P(e,r,n){const i=R(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return v(s)?s:0}function L(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return b(e,t,r,n);case"local":return g(e,t,r,n)}}function g(e,r,n,i){const s=R(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),o=s-a;if(!v(o))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return o}function b(e,r,n,i){const s=q(e,r,Q),a=t(s.tiltAtCenter,n.min,n.max);if(!v(s.tiltAtCenter-a))return 0;let o,c;return s.centerIsOnSurface?(o=H(s),c=k(s,o)):(o=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(s,o)),i&&(i.eyeCenterDistance=E(s,o)),c}function q(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,s=i+h(e.spatialReference).radius,a=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,null!=a?(n.eyeCenterDistance=m(t.eye,a),n.tiltAtCenter=R(e.renderCoordsHelper,a,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=R(e.renderCoordsHelper,t.center,t.eye):(C(T(I,s),t.ray,z),n.eyeCenterDistance=m(t.eye,z),n.tiltAtCenter=r(-f(t.viewForward,d(z,z)))),n.radius=s,n.eyeRadius=p(t.eye),n.constraints=e.state.constraints,n}function v(e){return Math.abs(e)>1e-9}function H(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=E(e,s);if(t.clampTilt(a,n)===s)return s;let o=0;for(;o<10&&v(s-i);){const r=(i+s)/2,n=E(e,r);v(t.clampTilt(n,r)-r)?i=r:s=r,o++}return s}function E(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,o=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function k(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===j.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:s,max:a}=r,o=U(e,n,A,t),c=0===o?0:R(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===j.TUMBLE?(O(t.selection,S.ALTITUDE)&&B(e,n,r),D(o,c,!0,i,G,r)):D(o,c,!1,i,G,r)}function B(e,t,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!t)return;const s=y(t.center),a=Math.sqrt(s),o=t.distance,c=h(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,m=(u*u-o*o-s)/(-2*a*o),f=(l*l-o*o-s)/(-2*a*o);n.min=Math.max(n.min,Math.min(Math.PI-r(f),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=M(),_=a(),z=M(),G=i(5),J={min:0,max:0},Q={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},V={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as o,e as c,h as u,g as l,q as m,k as f,n as d,l as p,p as y}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{j as C,k as T,t as I}from"../../../../chunks/sphere.js";import{hasConstraintType as O,defaultConstraintOptions as A,adjustRangeForInteraction as D}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as x}from"./InteractionType.js";import{TiltMode as R}from"./TiltMode.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){V.eyeCenterDistance=0,V.requiresTwoSteps=!1;const a=U(t,r,n,A,V);if(0===a)return!1;switch(s(_,-a,r.viewRight),n.tiltMode){case R.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,V.eyeCenterDistance),r.center=l(z,r.eye,K);break;case R.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!V.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,J);return N(e,r,a),n.interactionType===x.TUMBLE&&O(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,a),r.tiltMode===R.LOOK_AROUND||n.tiltMode===R.LOOK_AROUND?L(e,t,a,i):P(e,t,a)}function P(e,r,n){const i=j(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return v(s)?s:0}function L(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return q(e,t,r,n);case"local":return g(e,t,r,n)}}function g(e,r,n,i){const s=j(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),o=s-a;if(!v(o))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return o}function q(e,r,n,i){const s=b(e,r,Q),a=t(s.tiltAtCenter,n.min,n.max);if(!v(s.tiltAtCenter-a))return 0;let o,c;return s.centerIsOnSurface?(o=H(s),c=E(s,o)):(o=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(s,o)),i&&(i.eyeCenterDistance=k(s,o)),c}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,s=i+h(e.spatialReference).radius,a=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,null!=a?(n.eyeCenterDistance=m(t.eye,a),n.tiltAtCenter=j(e.renderCoordsHelper,a,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,t.center,t.eye):(C(T(I,s),t.ray,z),n.eyeCenterDistance=m(t.eye,z),n.tiltAtCenter=r(-f(t.viewForward,d(z,z)))),n.radius=s,n.eyeRadius=p(t.eye),n.constraints=e.state.constraints,n}function v(e){return Math.abs(e)>1e-9}function H(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=k(e,s);if(t.clampTilt(a,n)===s)return s;let o=0;for(;o<10&&v(s-i);){const r=(i+s)/2,n=k(e,r);v(t.clampTilt(n,r)-r)?i=r:s=r,o++}return s}function k(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,o=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function E(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===x.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:s,max:a}=r,o=U(e,n,A,t),c=0===o?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===x.TUMBLE?(O(t.selection,S.ALTITUDE)&&B(e,n,r),D(o,c,!0,i,G,r)):D(o,c,!1,i,G,r)}function B(e,t,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!t)return;const s=y(t.center),a=Math.sqrt(s),o=t.distance,c=h(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,m=(u*u-o*o-s)/(-2*a*o),f=(l*l-o*o-s)/(-2*a*o);n.min=Math.max(n.min,Math.min(Math.PI-r(f),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=M(),_=a(),z=M(),G=i(5),J={min:0,max:0},Q={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},V={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{c as e,a as r,h as t,f as n,g as i,j as o,l as s}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as l}from"../../../geometry/support/aaBoundingRect.js";import{newIntersector as d}from"../webgl-engine/lib/Intersector.js";function u(e,r,t,n){return null!=e.renderCoordsHelper.fromRenderCoords(r.eye,M,n)&&l(t,M)}function f(e,r){return e.elevationProvider?e.elevationProvider.getElevation(r[0],r[1],r[2],e.renderCoordsHelper.spatialReference,"ground")??0:0}function g(o,s,a,c){const l=o.state.camera.clone();s&&a&&c&&(l.eye=s,l.center=a,l.up=c),m(o,l.ray,b)||e(b,l.center);const d=o.state.constraints,u=d.minimumPoiDistance;if(r(l.eye,b)<u){const r=d.collision.enabled;e(j,l.viewForward),t(j,j,u),r?l.eye=n(M,b,j):i(b,l.eye,j);const s=o.renderCoordsHelper,a=s.getAltitude(l.eye),c=d.collision.elevationMargin;r&&a<c&&(n(j,b,l.eye),l.eye=s.setAltitude(M,c,l.eye),i(b,l.eye,j))}return l.center=b,l}function p(e,t,n){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;const i=f(e,t),o=e.stateManager.constraintsManager.nearFarHeuristic,{far:s}=o.compute(t,n,e.renderDataExtent,i,w),a=s*s;return r(t,n)>a}function m(e,r,t){let n=v[e.viewingMode];n||(n=d(e.state.viewingMode),n.options.backfacesTerrain=!e.state.isGlobal,n.options.invisibleTerrain=!0,v[e.viewingMode]=n);const{isGlobal:i}=e.state;return!(!e.sceneIntersectionHelper.intersectRay(r,n,t)||p(e,r.origin,t))||(!(!e.renderCoordsHelper.intersectManifold(r,0,t)||p(e,r.origin,t))||!!i&&y(r,t,c(e.spatialReference).radius))}function y(e,r,n){const a=o(e.origin,e.origin)-n*n,c=a>0?Math.sqrt(a)/3:1;return t(r,e.direction,c/s(e.direction)),i(r,r,e.origin),!0}const v={},M=a(),b=a(),j=a(),w={near:0,far:0};export{g as cameraOnContentAlongViewDirection,u as eyeWithinExtent,f as surfaceElevationBelowRenderLocation};
5
+ import{c as e,a as r,h as t,f as n,g as i,k as o,l as s}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as l}from"../../../geometry/support/aaBoundingRect.js";import{newIntersector as d}from"../webgl-engine/lib/Intersector.js";function u(e,r,t,n){return null!=e.renderCoordsHelper.fromRenderCoords(r.eye,M,n)&&l(t,M)}function f(e,r){return e.elevationProvider?e.elevationProvider.getElevation(r[0],r[1],r[2],e.renderCoordsHelper.spatialReference,"ground")??0:0}function g(o,s,a,c){const l=o.state.camera.clone();s&&a&&c&&(l.eye=s,l.center=a,l.up=c),m(o,l.ray,b)||e(b,l.center);const d=o.state.constraints,u=d.minimumPoiDistance;if(r(l.eye,b)<u){const r=d.collision.enabled;e(w,l.viewForward),t(w,w,u),r?l.eye=n(M,b,w):i(b,l.eye,w);const s=o.renderCoordsHelper,a=s.getAltitude(l.eye),c=d.collision.elevationMargin;r&&a<c&&(n(w,b,l.eye),l.eye=s.setAltitude(M,c,l.eye),i(b,l.eye,w))}return l.center=b,l}function p(e,t,n){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;const i=f(e,t),o=e.stateManager.constraintsManager.nearFarHeuristic,{far:s}=o.compute(t,n,e.renderDataExtent,i,H),a=s*s;return r(t,n)>a}function m(e,r,t){let n=v[e.viewingMode];n||(n=d(e.state.viewingMode),n.options.backfacesTerrain=!e.state.isGlobal,n.options.invisibleTerrain=!0,v[e.viewingMode]=n);const{isGlobal:i}=e.state;return!(!e.sceneIntersectionHelper.intersectRay(r,n,t)||p(e,r.origin,t))||(!(!e.renderCoordsHelper.intersectManifold(r,0,t)||p(e,r.origin,t))||!!i&&y(r,t,c(e.spatialReference).radius))}function y(e,r,n){const a=o(e.origin,e.origin)-n*n,c=a>0?Math.sqrt(a)/3:1;return t(r,e.direction,c/s(e.direction)),i(r,r,e.origin),!0}const v={},M=a(),b=a(),w=a(),H={near:0,far:0};export{g as cameraOnContentAlongViewDirection,u as eyeWithinExtent,f as surfaceElevationBelowRenderLocation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,o as d}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as l}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as f,computeInnerAltitudeFade as T}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as v}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as w}from"../webgl/formats.js";import{Pos2Tex as x}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as P}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as R}from"../webgl-engine/lib/textureUtils.js";import{A as q}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as j}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as E}from"../../webgl/enums.js";import B from"../../../webscene/background/ColorBackground.js";class C{constructor(s,i){this._view=s,this._context=i,this.type=l.Realistic,this._handles=new t,this._compositingPassParameters=new q,this._atmosphereConfiguration=new v,this._passParameters=new b,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=p.radius,this._fadeHaze=0,this._updateRadius(p.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([a((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),a((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null)),a((()=>this._view?.environment.background),(t=>{const s=t instanceof B?e(t.color):c;h(this._passParameters.backgroundColor,s[0]*s[3],s[1]*s[3],s[2]*s[3])}),o)]);const n=new v;n.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(g,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(g,n),this._vao=P(r,x)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,e.bindParameters.linearDepth?.getTexture(),s,!0)}_render(e,t,s,r,a){if(null==s)return;const o=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=s;const n=e.rctx.bindTechnique(t,e.bindParameters,this._passParameters);if(r)o.renderDepthDetached((()=>this._renderCommon(n,e)));else{const t=e.rctx.getViewport(),r=m(e.bindParameters.camera.eye)-p.radius;let h;if(r<_){const e=Math.min(1,Math.max(0,r/_));h=a?i(.4,.5,e):i(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(r-_)/(15*_)));h=a?i(.5,1,e):i(.3,.6,e)}const d=R(Math.round(h*e.bindParameters.camera.fullViewport[2])),u=R(Math.round(h*e.bindParameters.camera.fullViewport[3]));e.rctx.setViewport(0,0,d,u);const c=o.renderToCachedFBO(null,"chapman",(()=>this._renderCommon(n,e)),[0,0,0,1],w.RGBA,null,d,u);e.rctx.setViewport(t.x,t.y,t.width,t.height),this._compositingPassParameters.color=c.getTexture(),this._compositingPassParameters.depth=s,this._atmosphereConfiguration.haze=a;const l=this._context.techniqueRepository.acquire(j,this._atmosphereConfiguration);e.rctx.bindTechnique(l,e.bindParameters,this._compositingPassParameters),o.renderDepthDetached((()=>e.rctx.screen.draw())),l.release(),c.release()}}_renderCommon(e,t){null!=this._vao&&(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(E.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=p.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(p.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,n(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}_update(e){if(!e)return;const t=d(e.eye),a=Math.sqrt(t),o=t-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/_,0,1);u(this._passParameters.heightParameters,a,t,o,n),this._passParameters.altitudeFade=T(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=i(i(.6,1,r(9500,10500,a-p.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{C as ChapmanAtmosphere};
5
+ import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,p as d}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as l}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as f,computeInnerAltitudeFade as T}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as v}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as w}from"../webgl/formats.js";import{Pos2Tex as x}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as P}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as R}from"../webgl-engine/lib/textureUtils.js";import{A as q}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as j}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as E}from"../../webgl/enums.js";import B from"../../../webscene/background/ColorBackground.js";class C{constructor(s,i){this._view=s,this._context=i,this.type=l.Realistic,this._handles=new t,this._compositingPassParameters=new q,this._atmosphereConfiguration=new v,this._passParameters=new b,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=p.radius,this._fadeHaze=0,this._updateRadius(p.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([a((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),a((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null)),a((()=>this._view?.environment.background),(t=>{const s=t instanceof B?e(t.color):c;h(this._passParameters.backgroundColor,s[0]*s[3],s[1]*s[3],s[2]*s[3])}),o)]);const n=new v;n.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(g,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(g,n),this._vao=P(r,x)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,e.bindParameters.linearDepth?.getTexture(),s,!0)}_render(e,t,s,r,a){if(null==s)return;const o=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=s;const n=e.rctx.bindTechnique(t,e.bindParameters,this._passParameters);if(r)o.renderDepthDetached((()=>this._renderCommon(n,e)));else{const t=e.rctx.getViewport(),r=m(e.bindParameters.camera.eye)-p.radius;let h;if(r<_){const e=Math.min(1,Math.max(0,r/_));h=a?i(.4,.5,e):i(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(r-_)/(15*_)));h=a?i(.5,1,e):i(.3,.6,e)}const d=R(Math.round(h*e.bindParameters.camera.fullViewport[2])),u=R(Math.round(h*e.bindParameters.camera.fullViewport[3]));e.rctx.setViewport(0,0,d,u);const c=o.renderToCachedFBO(null,"chapman",(()=>this._renderCommon(n,e)),[0,0,0,1],w.RGBA,null,d,u);e.rctx.setViewport(t.x,t.y,t.width,t.height),this._compositingPassParameters.color=c.getTexture(),this._compositingPassParameters.depth=s,this._atmosphereConfiguration.haze=a;const l=this._context.techniqueRepository.acquire(j,this._atmosphereConfiguration);e.rctx.bindTechnique(l,e.bindParameters,this._compositingPassParameters),o.renderDepthDetached((()=>e.rctx.screen.draw())),l.release(),c.release()}}_renderCommon(e,t){null!=this._vao&&(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(E.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=p.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(p.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,n(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}_update(e){if(!e)return;const t=d(e.eye),a=Math.sqrt(t),o=t-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/_,0,1);u(this._passParameters.heightParameters,a,t,o,n),this._passParameters.altitudeFade=T(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=i(i(.6,1,r(9500,10500,a-p.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{C as ChapmanAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,k as p}from"../../../chunks/vec32.js";import{fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as S}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[T.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[T.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:L}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case T.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===S.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{D=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=D}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const k=u(.5,.5,.5),q=u(1.5,1.5,1.5);let D;export{I as EnvironmentRenderer,V as WeatherParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,m as p}from"../../../chunks/vec32.js";import{fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as S}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[T.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[T.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:L}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case T.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===S.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{H=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=H}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const q=u(.5,.5,.5),D=u(1.5,1.5,1.5);let H;export{I as EnvironmentRenderer,V as WeatherParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{smoothstep as s}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,j as a,h as n,k as c,l as m}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{atmosphereHeight as u}from"./atmosphereUtils.js";import{F as d}from"../../../chunks/Fog.glsl.js";import{FogTechnique as l}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";import{Pos2Tex as f}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as j}from"../../webgl/enums.js";const b=.95,x=1;let v=class extends e{constructor(t){super(t),this._passParameters=new d;const e=t.context.renderContext.rctx;this._vao=_(e,f),this._technique=new l(t);const s=h(t.view.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+u}destroy(){this._technique.release(),this._vao.dispose()}set strength(t){this._passParameters.fogStrength=t}get strength(){return this._passParameters.fogStrength}render(t,e){if(this._update(t,e),this._passParameters.fogAmount<=0)return;const s=this._technique;if(!s.compiled)return void this.context.requestRender();const r=t.offscreenRenderingHelper;r.renderDepthDetached((()=>{this._passParameters.depthTexture=r.depthTexture;const e=t.rctx.bindTechnique(s,t.bindParameters,this._passParameters);this._renderFog(e,t)}))}_renderFog(t,e){const s=e.rctx;s.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(j.TRIANGLE_STRIP,0,4)}_update(t,e){const r=t.bindParameters.camera;i(P,r.eye);const o=Math.max(0,a(P,t.bindParameters.lighting.mainLight.direction)),p=e.color;n(w,p,.1),c(this._passParameters.fogColor,w,p,o);const h=m(r.eye),u=h*h;this._passParameters.atmosphereC=u-this._atmosphereRadius*this._atmosphereRadius,this._passParameters.fogAmount=(1-s(b*g,x*g,Math.abs(h-this._planetRadius)))*e.amount,this._passParameters.fogStrength=e.strength}static isSupported(t){return t.capabilities.depthTexture}};t([r({constructOnly:!0})],v.prototype,"context",void 0),t([r({constructOnly:!0})],v.prototype,"view",void 0),t([r({constructOnly:!0})],v.prototype,"rctx",void 0),t([r({constructOnly:!0})],v.prototype,"viewingMode",void 0),v=t([o("esri.views.3d.environment.Fog")],v);class y{constructor(){this.color=p(),this.strength=0,this.amount=0}}const P=p(),w=p();export{v as Fog,y as FogParameters};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{smoothstep as s}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,k as a,h as n,m as c,l as m}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{atmosphereHeight as u}from"./atmosphereUtils.js";import{F as d}from"../../../chunks/Fog.glsl.js";import{FogTechnique as l}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";import{Pos2Tex as f}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as j}from"../../webgl/enums.js";const b=.95,x=1;let v=class extends e{constructor(t){super(t),this._passParameters=new d;const e=t.context.renderContext.rctx;this._vao=_(e,f),this._technique=new l(t);const s=h(t.view.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+u}destroy(){this._technique.release(),this._vao.dispose()}set strength(t){this._passParameters.fogStrength=t}get strength(){return this._passParameters.fogStrength}render(t,e){if(this._update(t,e),this._passParameters.fogAmount<=0)return;const s=this._technique;if(!s.compiled)return void this.context.requestRender();const r=t.offscreenRenderingHelper;r.renderDepthDetached((()=>{this._passParameters.depthTexture=r.depthTexture;const e=t.rctx.bindTechnique(s,t.bindParameters,this._passParameters);this._renderFog(e,t)}))}_renderFog(t,e){const s=e.rctx;s.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(j.TRIANGLE_STRIP,0,4)}_update(t,e){const r=t.bindParameters.camera;i(P,r.eye);const o=Math.max(0,a(P,t.bindParameters.lighting.mainLight.direction)),p=e.color;n(w,p,.1),c(this._passParameters.fogColor,w,p,o);const h=m(r.eye),u=h*h;this._passParameters.atmosphereC=u-this._atmosphereRadius*this._atmosphereRadius,this._passParameters.fogAmount=(1-s(b*g,x*g,Math.abs(h-this._planetRadius)))*e.amount,this._passParameters.fogStrength=e.strength}static isSupported(t){return t.capabilities.depthTexture}};t([r({constructOnly:!0})],v.prototype,"context",void 0),t([r({constructOnly:!0})],v.prototype,"view",void 0),t([r({constructOnly:!0})],v.prototype,"rctx",void 0),t([r({constructOnly:!0})],v.prototype,"viewingMode",void 0),v=t([o("esri.views.3d.environment.Fog")],v);class y{constructor(){this.color=p(),this.strength=0,this.amount=0}}const P=p(),w=p();export{v as Fog,y as FogParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as n,h as m,g as p,p as c,b as u,o as l}from"../../../chunks/vec32.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as f}from"../../../geometry/support/FloatArray.js";import{AtmosphereType as g}from"./AtmosphereType.js";import{computeInnerAltitudeFade as b,innerAtmosphereDepth as x}from"./atmosphereUtils.js";import{S as R}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as j}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as V,SimpleAtmosphereGeometry as y}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as w}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as A}from"../support/mathUtils.js";import{glLayout as P}from"../support/buffer/glUtil.js";import{newLayout as T}from"../support/buffer/InterleavedLayout.js";import{Default3D as q}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as v}from"../webgl-engine/lib/glUtil3D.js";import{project as S}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as F}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as C}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as M}from"../../webgl/BufferObject.js";import{TextureWrapMode as U,PrimitiveType as W,Usage as I}from"../../webgl/enums.js";import{Texture as O}from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";import{vertexCount as L}from"../../webgl/Util.js";const E=128,G=-x,H=0,N=50,k=()=>1-511/512,B=A([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class z{constructor(e,t){this.view=e,this.type=g.Mars,this._passParameters=new R,this._vaoCount=0,this._texV1=1;const s=d(e.spatialReference);this._planetRadius=s.radius,this._outerRimWidth=s.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+G)/this._planetRadius,this._middleRimFactor=(this._planetRadius+H)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=H/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniqueRepository=t.techniqueRepository;const o=t.renderContext.rctx;this._cameraChangeHandle=r((()=>this.view.state?.camera),(()=>t.requestRender()),i),this._vao=this._createRibbon(o),this._vaoCount=L(this._vao,"geometry"),this._fadeVao=v(o),this._fadeVaoCount=L(this._fadeVao,"geometry");const a=new D;a.wrapMode=U.CLAMP_TO_EDGE,a.flipped=!0,a.width=1,a.height=512,this._passParameters.texture=new O(o,a,w);const h=new V;h.geometry=y.Cone,this._coneTechnique=this._techniqueRepository.acquire(j,h),h.geometry=y.Underground,this._undergroundTechnique=this._techniqueRepository.acquire(j,h)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=s(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const t=e.bindParameters.camera;this._update(t);const s=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(s.bindTechnique(this._coneTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(W.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(s.bindTechnique(this._undergroundTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._fadeVao),s.drawArrays(W.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(s){const r=_(),i=this._planetRadius,o=n(s.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const p=Math.max(N,a),c=i+G;this._passParameters.innerScale=Y(i+p,i,c)-1,this._passParameters.altitudeFade=b(a),m(r,s.eye,(i+N)/o),J(r,s.center,s.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(s,r,s.up,this._passParameters.silhouette),l=k(),d=B(a);let f=this._texV0+l*this._texVScale,g=this._texV0+u*d*this._texVScale;if(a>N){J(s.eye,s.center,s.up,i,this._passParameters.silhouette);const r=this._computeScreenRimWidth(s,s.eye,s.up,this._passParameters.silhouette),o=t((r-1.5)/(u-1.5),0,1);f=this._texV0+o*l*this._texVScale,g=this._texV0+e(this._texV1,u*d,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(e){const t=f(3+3*E*3),s=new Uint32Array(3*E*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<E;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const r=3*o+1,i=o===E-1?1:r+3,a=15*o;s[a]=r,s[a+1]=r+1,s[a+2]=i+1,s[a+3]=i+1,s[a+4]=i,s[a+5]=r,s[a+6]=r+1,s[a+7]=r+2,s[a+8]=i+2,s[a+9]=i+2,s[a+10]=i+1,s[a+11]=r+1,s[a+12]=r,s[a+13]=i,s[a+14]=0}const r=Z.createBuffer(s.length),i=r.position;for(let o=0;o<s.length;++o){const e=3*s[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new F(e,q,{geometry:P(Z)},{geometry:M.createVertex(e,I.STATIC_DRAW,r.buffer)})}_computeScreenRimWidth(e,t,s,r){return p(Q,r.center,r.v2),m(X,Q,this._outerRimFactor),o(K,t,Q,s),S(Q,K,e.projectionMatrix,e.viewport,Q),S(X,K,e.projectionMatrix,e.viewport,X),c(Q,X)/e.height}}function J(e,t,s,r,i){const o=n(e),a=r*Math.sqrt(o*o-r*r)/o,h=Math.sqrt(r*r-a*a),p=i.v1,c=i.v2;return m(i.center,e,h/o),u(p,e,t),l(p)<1&&u(p,e,s),m(p,p,a/n(p)),u(c,p,e),m(c,c,a/n(c)),a}const K=a(),Q=_(),X=_();function Y(e,t,s){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-s*s)+t*s)}const Z=T().vec3f(C.POSITION);export{z as default};
5
+ import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as n,h as m,g as p,q as c,b as u,p as l}from"../../../chunks/vec32.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as f}from"../../../geometry/support/FloatArray.js";import{AtmosphereType as g}from"./AtmosphereType.js";import{computeInnerAltitudeFade as b,innerAtmosphereDepth as x}from"./atmosphereUtils.js";import{S as R}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as j}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as V,SimpleAtmosphereGeometry as y}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as w}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as A}from"../support/mathUtils.js";import{glLayout as P}from"../support/buffer/glUtil.js";import{newLayout as q}from"../support/buffer/InterleavedLayout.js";import{Default3D as T}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as v}from"../webgl-engine/lib/glUtil3D.js";import{project as S}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as F}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as C}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as M}from"../../webgl/BufferObject.js";import{TextureWrapMode as U,PrimitiveType as W,Usage as I}from"../../webgl/enums.js";import{Texture as O}from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";import{vertexCount as L}from"../../webgl/Util.js";const E=128,G=-x,H=0,N=50,k=()=>1-511/512,B=A([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class z{constructor(e,t){this.view=e,this.type=g.Mars,this._passParameters=new R,this._vaoCount=0,this._texV1=1;const s=d(e.spatialReference);this._planetRadius=s.radius,this._outerRimWidth=s.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+G)/this._planetRadius,this._middleRimFactor=(this._planetRadius+H)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=H/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniqueRepository=t.techniqueRepository;const o=t.renderContext.rctx;this._cameraChangeHandle=r((()=>this.view.state?.camera),(()=>t.requestRender()),i),this._vao=this._createRibbon(o),this._vaoCount=L(this._vao,"geometry"),this._fadeVao=v(o),this._fadeVaoCount=L(this._fadeVao,"geometry");const a=new D;a.wrapMode=U.CLAMP_TO_EDGE,a.flipped=!0,a.width=1,a.height=512,this._passParameters.texture=new O(o,a,w);const h=new V;h.geometry=y.Cone,this._coneTechnique=this._techniqueRepository.acquire(j,h),h.geometry=y.Underground,this._undergroundTechnique=this._techniqueRepository.acquire(j,h)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=s(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const t=e.bindParameters.camera;this._update(t);const s=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(s.bindTechnique(this._coneTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(W.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(s.bindTechnique(this._undergroundTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._fadeVao),s.drawArrays(W.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(s){const r=_(),i=this._planetRadius,o=n(s.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const p=Math.max(N,a),c=i+G;this._passParameters.innerScale=Y(i+p,i,c)-1,this._passParameters.altitudeFade=b(a),m(r,s.eye,(i+N)/o),J(r,s.center,s.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(s,r,s.up,this._passParameters.silhouette),l=k(),d=B(a);let f=this._texV0+l*this._texVScale,g=this._texV0+u*d*this._texVScale;if(a>N){J(s.eye,s.center,s.up,i,this._passParameters.silhouette);const r=this._computeScreenRimWidth(s,s.eye,s.up,this._passParameters.silhouette),o=t((r-1.5)/(u-1.5),0,1);f=this._texV0+o*l*this._texVScale,g=this._texV0+e(this._texV1,u*d,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(e){const t=f(3+3*E*3),s=new Uint32Array(3*E*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<E;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const r=3*o+1,i=o===E-1?1:r+3,a=15*o;s[a]=r,s[a+1]=r+1,s[a+2]=i+1,s[a+3]=i+1,s[a+4]=i,s[a+5]=r,s[a+6]=r+1,s[a+7]=r+2,s[a+8]=i+2,s[a+9]=i+2,s[a+10]=i+1,s[a+11]=r+1,s[a+12]=r,s[a+13]=i,s[a+14]=0}const r=Z.createBuffer(s.length),i=r.position;for(let o=0;o<s.length;++o){const e=3*s[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new F(e,T,{geometry:P(Z)},{geometry:M.createVertex(e,I.STATIC_DRAW,r.buffer)})}_computeScreenRimWidth(e,t,s,r){return p(Q,r.center,r.v2),m(X,Q,this._outerRimFactor),o(K,t,Q,s),S(Q,K,e.projectionMatrix,e.viewport,Q),S(X,K,e.projectionMatrix,e.viewport,X),c(Q,X)/e.height}}function J(e,t,s,r,i){const o=n(e),a=r*Math.sqrt(o*o-r*r)/o,h=Math.sqrt(r*r-a*a),p=i.v1,c=i.v2;return m(i.center,e,h/o),u(p,e,t),l(p)<1&&u(p,e,s),m(p,p,a/n(p)),u(c,p,e),m(c,c,a/n(c)),a}const K=a(),Q=_(),X=_();function Y(e,t,s){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-s*s)+t*s)}const Z=q().vec3f(C.POSITION);export{z as default};