@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 t from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{after as i}from"../../../core/promiseUtils.js";import{watch as s,sync as n,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,h as l,c,k as p}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectToWGS84ComparableLonLat as m}from"../../../geometry/projection.js";import{projectPointToWGS84ComparableLonLat as f}from"../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{EnvironmentRenderer as v}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as b}from"../support/earthUtils.js";import{computeColorAndIntensity as C,computeVirtualLightDirection as w,computeShadowsEnabled as y,ColorAndIntensity as U}from"../support/sunUtils.js";import{Update as S}from"../webgl-engine/lib/Update.js";import{MainLight as T,AmbientLight as R,FillLight as M}from"../webgl-engine/lighting/Lightsources.js";let W=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new T,this._ambientLight=new R,this._moonLight=new M,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===P.Global&&g(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new v({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),n),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),n),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,n),s((()=>e.qualitySettings.ambientOcclusion),t,n),s((()=>e.qualitySettings.reflections),t,n),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),n),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,S.Faded)),n),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,S.Faded)),n),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),o),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),o),s((()=>e.state.camera),r,o),s((()=>this.disableQueries),r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=r(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!m(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=b(this._referencePosWGS84Comparable,j);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=g(this._view.spatialReference);if(r&&!m(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=_()),r?f(i,this._referencePosWGS84Comparable):d(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=S.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,s=i?H:G,n=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?C(e,i,r.state.viewingMode,n,r.state.camera,s):"virtual"===r.environment.lighting.type&&w(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const o=this._mainLight,a=s.direct;l(o.intensity,a.color,a.intensity*Math.PI),c(o.direction,a.directionToLightSource),o.specularStrength=s.specularStrength,o.environmentStrength=s.environmentStrength;const h=this._ambientLight;l(h.intensity,s.ambient.color,s.ambient.intensity);const d=this._moonLight;p(d.intensity,q,E,s.globalFactor);const _=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(d.intensity,d.intensity,_),c(d.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,d],s.noonFactor,s.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=L;r.setTime((t||this._view.environment.lighting.date).getTime());const i=b(e,j);if(null==i)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===i.hours&&s.minutes===i.minutes&&s.seconds===i.seconds)return!1}else s=i;const n=r.getUTCHours()-(i.hours-s.hours),o=r.getUTCMinutes()-(i.minutes-s.minutes),a=r.getUTCSeconds()-(i.seconds-s.seconds);return r.setUTCHours(n),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePosWGS84Comparable||y(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=i(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=i(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([a({type:Boolean,readOnly:!0})],W.prototype,"updating",null),e([a()],W.prototype,"disableQueries",void 0),e([a()],W.prototype,"_disableWeather",void 0),e([a()],W.prototype,"weatherEnabled",null),e([a()],W.prototype,"weatherVisible",null),e([a()],W.prototype,"referencePositionWGS84Comparable",null),e([a()],W.prototype,"_renderer",void 0),e([a()],W.prototype,"_referencePosWGS84Comparable",void 0),W=e([h("esri.views.3d.environment.SceneViewEnvironmentManager")],W);const H=new U,G=new U,L=new Date,j={hours:0,minutes:0,seconds:0},q=u(.22,.22,.33),E=u(.22,.22,.22);export{W as SceneViewEnvironmentManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{after as i}from"../../../core/promiseUtils.js";import{watch as s,sync as n,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,h as l,c,m as p}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectToWGS84ComparableLonLat as m}from"../../../geometry/projection.js";import{projectPointToWGS84ComparableLonLat as f}from"../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{EnvironmentRenderer as v}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as b}from"../support/earthUtils.js";import{computeColorAndIntensity as C,computeVirtualLightDirection as w,computeShadowsEnabled as y,ColorAndIntensity as U}from"../support/sunUtils.js";import{Update as S}from"../webgl-engine/lib/Update.js";import{MainLight as T,AmbientLight as R,FillLight as M}from"../webgl-engine/lighting/Lightsources.js";let W=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new T,this._ambientLight=new R,this._moonLight=new M,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===P.Global&&g(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new v({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),n),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),n),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,n),s((()=>e.qualitySettings.ambientOcclusion),t,n),s((()=>e.qualitySettings.reflections),t,n),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),n),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,S.Faded)),n),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,S.Faded)),n),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),o),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),o),s((()=>e.state.camera),r,o),s((()=>this.disableQueries),r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=r(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!m(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=b(this._referencePosWGS84Comparable,j);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=g(this._view.spatialReference);if(r&&!m(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=_()),r?f(i,this._referencePosWGS84Comparable):d(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=S.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,s=i?H:G,n=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?C(e,i,r.state.viewingMode,n,r.state.camera,s):"virtual"===r.environment.lighting.type&&w(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const o=this._mainLight,a=s.direct;l(o.intensity,a.color,a.intensity*Math.PI),c(o.direction,a.directionToLightSource),o.specularStrength=s.specularStrength,o.environmentStrength=s.environmentStrength;const h=this._ambientLight;l(h.intensity,s.ambient.color,s.ambient.intensity);const d=this._moonLight;p(d.intensity,q,E,s.globalFactor);const _=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(d.intensity,d.intensity,_),c(d.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,d],s.noonFactor,s.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=L;r.setTime((t||this._view.environment.lighting.date).getTime());const i=b(e,j);if(null==i)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===i.hours&&s.minutes===i.minutes&&s.seconds===i.seconds)return!1}else s=i;const n=r.getUTCHours()-(i.hours-s.hours),o=r.getUTCMinutes()-(i.minutes-s.minutes),a=r.getUTCSeconds()-(i.seconds-s.seconds);return r.setUTCHours(n),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePosWGS84Comparable||y(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=i(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=i(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([a({type:Boolean,readOnly:!0})],W.prototype,"updating",null),e([a()],W.prototype,"disableQueries",void 0),e([a()],W.prototype,"_disableWeather",void 0),e([a()],W.prototype,"weatherEnabled",null),e([a()],W.prototype,"weatherVisible",null),e([a()],W.prototype,"referencePositionWGS84Comparable",null),e([a()],W.prototype,"_renderer",void 0),e([a()],W.prototype,"_referencePosWGS84Comparable",void 0),W=e([h("esri.views.3d.environment.SceneViewEnvironmentManager")],W);const H=new U,G=new U,L=new Date,j={hours:0,minutes:0,seconds:0},q=u(.22,.22,.33),E=u(.22,.22,.22);export{W as SceneViewEnvironmentManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import{multiplyOpacity as n}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as i}from"../../../core/handleUtils.js";import{k as t}from"../../../chunks/vec32.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as a,absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{ExtendedLineVisualElement as s,ExtensionType as c}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as p}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as u}from"./visualElements/RightAngleQuadVisualElement.js";import{DrapedRenderGroup as m}from"../layers/interfaces.js";import{RenderOccludedFlag as f}from"../webgl-engine/lib/Material.js";import{toDehydratedPoint as g,create as v}from"../../interactive/sketch/normalizedPoint.js";import{defaults as h}from"../../interactive/snapping/Settings.js";import{SnappingDomain as E}from"../../interactive/snapping/SnappingDomain.js";import{LineSegmentHintType as C}from"../../interactive/snapping/snappingUtils.js";import{SnappingVisualizer as S}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as j}from"../../interactive/snapping/hints/LineSnappingHint.js";import{vectorToRender as w}from"../../interactive/support/viewUtils.js";class O extends S{sortUniqueHints(e){return e.sort(((e,n)=>(n instanceof j?n.length:0)-(e instanceof j?e.length:0)))}visualizeIntersectionPoint(e,n){const{spatialReference:t,view:r}=n,o=D(n);return i(new d({view:r,primitive:"circle",geometry:g(e.intersectionPoint,t),elevationInfo:e.isDraped?a:l,size:20,outlineSize:2,color:o.intersectionPointColor,outlineColor:o.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.point,e.domain,n);return i(new d({view:t,primitive:"circle",geometry:g(a,r),elevationInfo:x(e,n),size:20,outlineSize:2,color:o.pointColor,outlineColor:o.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.lineStart,e.domain,n),l=R(e.lineEnd,e.domain,n);return i(this._createLineSegmentHint(e.type,a,l,r,x(e,n),t,o,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,n){const{view:r,spatialReference:o}=n,a=D(n),{isDraped:l}=e,s=x(e,n),c=R(e.lineStart,e.domain,n),d=R(e.lineEnd,e.domain,n),u=H(c,o,s,r,l),g=H(d,o,s,r,l),v=t(g,u,g,.5),E=new p({view:r,attached:!1,offset:h.parallelLineHintOffset,length:h.parallelLineHintLength,width:h.parallelLineHintWidth,color:a.parallelSignColor,location:v,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,isDraped:l,renderGroup:m.SnappingHint,isDecoration:!0});return E.setDirectionFromPoints(u,v),E.attached=!0,i(E)}visualizeRightAngleQuad(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=x(e,n),{isDraped:l}=e,s=R(e.previousVertex,e.domain,n),c=R(e.centerVertex,e.domain,n),p=R(e.nextVertex,e.domain,n),d=H(s,r,a,t,l),g=H(c,r,a,t,l),v=H(p,r,a,t,l);return i(new u({view:t,attached:!0,color:l?o.rightAngleColorDraped:o.rightAngleColor,renderOccluded:l?f.OccludeAndTransparent:f.Transparent,outlineRenderOccluded:l?f.OccludeAndTransparent:f.Opaque,outlineColor:o.rightAngleOutlineColor,outlineSize:h.rightAngleHintOutlineSize,size:h.rightAngleHintSize,isDraped:l,geometry:{previous:d,center:g,next:v},renderGroup:m.SnappingHint,isDecoration:!0}))}_createLineSegmentHint(e,n,i,t,r,o,a,l=!1,p=!0,d=!0){const u=H(n,t,r,o,l),g=H(i,t,r,o,l),v=new s({view:o,extensionType:c.FADED,start:u,end:g,isDraped:l,color:a.lineColor,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,renderGroup:m.SnappingHint,isDecoration:!0});switch(e){case C.TARGET:v.width=h.lineHintWidthTarget,v.fadedExtensions={start:0,end:h.lineHintFadedExtensions};break;case C.REFERENCE_EXTENSION:v.width=h.lineHintWidthReference,v.fadedExtensions={start:0,end:0};break;case C.REFERENCE:v.width=h.lineHintWidthReference,v.fadedExtensions={start:p?h.lineHintFadedExtensions:0,end:d?h.lineHintFadedExtensions:0}}return v.attached=!0,v}}function D(i){const{effectiveTheme:t}=i.view,r=e.toUnitRGBA(t.accentColor),o=[0,0,0,0];return{intersectionPointColor:o,intersectionPointOutlineColor:r,pointColor:o,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e.toUnitRGBA(n(t.accentColor,.5)),rightAngleOutlineColor:r}}function R(e,n,i){const t=A(n,i);return null==t?e:v(e[0],e[1],t)}function x(e,n){return null!=A(e.domain,n)?n.selfSnappingZ.elevationInfo:e.isDraped?a:l}function A(e,{selfSnappingZ:n}){return e===E.SELF&&null!=n?n.value:null}function H(e,n,i,t,a){const l=r();if(a){const i=t.basemapTerrain.overlayManager.renderer.spatialReference;o(e,n,l,i)}else w(e,n,i,t,l);return l}export{O as SnappingVisualizer3D};
5
+ import e from"../../../Color.js";import{multiplyOpacity as n}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as i}from"../../../core/handleUtils.js";import{m as t}from"../../../chunks/vec32.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as a,absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{ExtendedLineVisualElement as s,ExtensionType as c}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as p}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as m}from"./visualElements/RightAngleQuadVisualElement.js";import{DrapedRenderGroup as u}from"../layers/interfaces.js";import{RenderOccludedFlag as f}from"../webgl-engine/lib/Material.js";import{toDehydratedPoint as g,create as v}from"../../interactive/sketch/normalizedPoint.js";import{defaults as h}from"../../interactive/snapping/Settings.js";import{SnappingDomain as E}from"../../interactive/snapping/SnappingDomain.js";import{LineSegmentHintType as C}from"../../interactive/snapping/snappingUtils.js";import{SnappingVisualizer as S}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as j}from"../../interactive/snapping/hints/LineSnappingHint.js";import{vectorToRender as w}from"../../interactive/support/viewUtils.js";class O extends S{sortUniqueHints(e){return e.sort(((e,n)=>(n instanceof j?n.length:0)-(e instanceof j?e.length:0)))}visualizeIntersectionPoint(e,n){const{spatialReference:t,view:r}=n,o=D(n);return i(new d({view:r,primitive:"circle",geometry:g(e.intersectionPoint,t),elevationInfo:e.isDraped?a:l,size:20,outlineSize:2,color:o.intersectionPointColor,outlineColor:o.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.point,e.domain,n);return i(new d({view:t,primitive:"circle",geometry:g(a,r),elevationInfo:x(e,n),size:20,outlineSize:2,color:o.pointColor,outlineColor:o.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.lineStart,e.domain,n),l=R(e.lineEnd,e.domain,n);return i(this._createLineSegmentHint(e.type,a,l,r,x(e,n),t,o,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,n){const{view:r,spatialReference:o}=n,a=D(n),{isDraped:l}=e,s=x(e,n),c=R(e.lineStart,e.domain,n),d=R(e.lineEnd,e.domain,n),m=H(c,o,s,r,l),g=H(d,o,s,r,l),v=t(g,m,g,.5),E=new p({view:r,attached:!1,offset:h.parallelLineHintOffset,length:h.parallelLineHintLength,width:h.parallelLineHintWidth,color:a.parallelSignColor,location:v,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,isDraped:l,renderGroup:u.SnappingHint,isDecoration:!0});return E.setDirectionFromPoints(m,v),E.attached=!0,i(E)}visualizeRightAngleQuad(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=x(e,n),{isDraped:l}=e,s=R(e.previousVertex,e.domain,n),c=R(e.centerVertex,e.domain,n),p=R(e.nextVertex,e.domain,n),d=H(s,r,a,t,l),g=H(c,r,a,t,l),v=H(p,r,a,t,l);return i(new m({view:t,attached:!0,color:l?o.rightAngleColorDraped:o.rightAngleColor,renderOccluded:l?f.OccludeAndTransparent:f.Transparent,outlineRenderOccluded:l?f.OccludeAndTransparent:f.Opaque,outlineColor:o.rightAngleOutlineColor,outlineSize:h.rightAngleHintOutlineSize,size:h.rightAngleHintSize,isDraped:l,geometry:{previous:d,center:g,next:v},renderGroup:u.SnappingHint,isDecoration:!0}))}_createLineSegmentHint(e,n,i,t,r,o,a,l=!1,p=!0,d=!0){const m=H(n,t,r,o,l),g=H(i,t,r,o,l),v=new s({view:o,extensionType:c.FADED,start:m,end:g,isDraped:l,color:a.lineColor,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,renderGroup:u.SnappingHint,isDecoration:!0});switch(e){case C.TARGET:v.width=h.lineHintWidthTarget,v.fadedExtensions={start:0,end:h.lineHintFadedExtensions};break;case C.REFERENCE_EXTENSION:v.width=h.lineHintWidthReference,v.fadedExtensions={start:0,end:0};break;case C.REFERENCE:v.width=h.lineHintWidthReference,v.fadedExtensions={start:p?h.lineHintFadedExtensions:0,end:d?h.lineHintFadedExtensions:0}}return v.attached=!0,v}}function D(i){const{effectiveTheme:t}=i.view,r=e.toUnitRGBA(t.accentColor),o=[0,0,0,0];return{intersectionPointColor:o,intersectionPointOutlineColor:r,pointColor:o,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e.toUnitRGBA(n(t.accentColor,.5)),rightAngleOutlineColor:r}}function R(e,n,i){const t=A(n,i);return null==t?e:v(e[0],e[1],t)}function x(e,n){return null!=A(e.domain,n)?n.selfSnappingZ.elevationInfo:e.isDraped?a:l}function A(e,{selfSnappingZ:n}){return e===E.SELF&&null!=n?n.value:null}function H(e,n,i,t,a){const l=r();if(a){const i=t.basemapTerrain.overlayManager.renderer.spatialReference;o(e,n,l,i)}else w(e,n,i,t,l);return l}export{O as SnappingVisualizer3D};
@@ -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{screenPointObjectToArray as e,castScreenPointArray as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{l as t,c as o,b as l,f as s,j as c,h as i,g as a}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPoint as p}from"../../../../geometry/projection.js";import{intersectRay as m,create as d,getNormal as f,fromPositionAndNormal as g}from"../../../../geometry/support/plane.js";import{create as y}from"../../../../geometry/support/ray.js";import{projectPoint as E}from"../../../../geometry/support/vector.js";import{sv2d as j}from"../../../../geometry/support/vectorStacks.js";import{getZForElevationMode as S,getGraphicEffectiveElevationInfo as R}from"../../../../support/elevationInfoUtils.js";import{fromScreen as v}from"../../support/geometryUtils/ray.js";import{newIntersector as x}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{EventPipeline as H}from"../../../interactive/dragEventPipeline.js";import U from"../../../../geometry/Point.js";function O(e,n){return P(e,(()=>n))}function C(e){return P(e,(e=>e.plane))}function P(r,t){const o=u(),l=u();let s=!1;return c=>{const i=t(c);if("start"===c.action){const t=e(c.screenStart,n(j.get())),l=v(r.state.camera,t,K);null!=l&&(s=m(i,l,o))}if(!s)return null;const a=e(c.screenEnd,n(j.get())),u=v(r.state.camera,a,K);return null==u?null:m(i,u,l)?{...c,renderStart:o,renderEnd:l,plane:i,ray:u}:null}}function T(e,n,t=0,o=null,l=null){let s=null;return c=>{if("start"===c.action&&(s=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenStart.x,c.screenStart.y),n,t,l),null!=s&&null!=o&&!p(s,s,o)))return null;if(null==s)return null;const i=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenEnd.x,c.screenEnd.y),n,t,l);return null!=i&&(null==o||p(i,i,o))?{...c,mapStart:s,mapEnd:i}:null}}function D(e,n,r,t=null,o=null){return T(e,r,S(n,e,r),t,o)}function M(e,n,r,t=null,o=null){return D(e,r,R(n),t,o)}function N(e,n,r,t){const o=n.toMap(e.screenStart,{include:[r]});return null!=o?M(n,r,o,t):null}function h(e,n){const r=B,t=J,o=d();e.renderCoordsHelper.worldUpAtPosition(n,r);const c=l(f(o),r,s(t,n,e.state.camera.eye));return l(c,c,r),g(n,c,o)}function G(e,n,r){let t=null;const o=new H;return o.next(O(e,h(e,n))).next(k(e,n)).next(A(e,r)).next((e=>{e.mapEnd.x=e.mapStart.x,e.mapEnd.y=e.mapStart.y,t=e})),e=>(t=null,o.execute(e),t)}function k(e,n){const r=u(),l=t(n);e.renderCoordsHelper.worldUpAtPosition(n,r);const p=u(),m=u(),d=o=>{if(s(o,o,n),E(r,o,o),"global"===e.viewingMode){t(o)*Math.sign(c(r,o))<.001-l&&s(o,i(o,r,.001),n)}return a(o,o,n),o};return e=>(e.renderStart=d(o(p,e.renderStart)),e.renderEnd=d(o(m,e.renderEnd)),e)}function A(e,n){const r=e.renderCoordsHelper;return e=>{const t=r.fromRenderCoords(e.renderStart,new U({spatialReference:n})),o=r.fromRenderCoords(e.renderEnd,new U({spatialReference:n}));return null!=t&&null!=o?{...e,mapStart:t,mapEnd:o}:null}}var F;function q(e){let n=null;return r=>{switch(r.action){case"start":n=e.disableDisplay();break;case"end":case"cancel":null!=n&&(n.remove(),n=null)}return r}}function z(n,t=null){const o=x(n.state.viewingMode);o.options.selectionMode=!0,o.options.store=b.MIN,o.options.hud=!1;const l=r(),s={requiresGroundFeedback:!0,enableDraped:!0,exclude:new Set},c=u(),i=t??n.spatialReference,a=r=>{n.map.ground&&n.map.ground.opacity<1?s.exclude.add(I):s.exclude.delete(I),n.sceneIntersectionHelper.intersectIntersectorScreen(e(r,l),o,s);const t=o.results.min;let a;if(t.getIntersectionPoint(c))a=t.intersector===w.TERRAIN?F.GROUND:F.OTHER;else{if(!o.results.ground.getIntersectionPoint(c))return null;a=F.GROUND}return{location:n.renderCoordsHelper.fromRenderCoords(c,new U({spatialReference:i})),surfaceType:a}};let p;return e=>{if("start"===e.action){const n=a(e.screenStart);p=null!=n?n.location:null}if(null==p)return null;const n=a(e.screenEnd);return null!=n?.location?{...e,mapStart:p,mapEnd:n.location,surfaceType:n.surfaceType}:null}}!function(e){e[e.GROUND=0]="GROUND",e[e.OTHER=1]="OTHER"}(F||(F={}));const B=u(),J=u(),K=y();export{F as SurfaceType,A as convertToMapCoordinates,q as hideManipulatorWhileDragging,k as projectToWorldUp,z as screenToMap3D,D as screenToMapXYAtLocation,N as screenToMapXYForGraphic,M as screenToMapXYForGraphicAtLocation,O as screenToRenderPlane,C as screenToRenderPlaneFromEvent,G as screenToZConstrained};
5
+ import"../../../../geometry.js";import{screenPointObjectToArray as e,castScreenPointArray as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{l as t,c as o,b as l,f as s,k as c,h as i,g as a}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPoint as p}from"../../../../geometry/projection.js";import{intersectRay as m,create as d,getNormal as f,fromPositionAndNormal as g}from"../../../../geometry/support/plane.js";import{create as y}from"../../../../geometry/support/ray.js";import{projectPoint as E}from"../../../../geometry/support/vector.js";import{sv2d as S}from"../../../../geometry/support/vectorStacks.js";import{getZForElevationMode as j,getGraphicEffectiveElevationInfo as R}from"../../../../support/elevationInfoUtils.js";import{fromScreen as v}from"../../support/geometryUtils/ray.js";import{newIntersector as x}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{EventPipeline as H}from"../../../interactive/dragEventPipeline.js";import U from"../../../../geometry/Point.js";function O(e,n){return P(e,(()=>n))}function C(e){return P(e,(e=>e.plane))}function P(r,t){const o=u(),l=u();let s=!1;return c=>{const i=t(c);if("start"===c.action){const t=e(c.screenStart,n(S.get())),l=v(r.state.camera,t,K);null!=l&&(s=m(i,l,o))}if(!s)return null;const a=e(c.screenEnd,n(S.get())),u=v(r.state.camera,a,K);return null==u?null:m(i,u,l)?{...c,renderStart:o,renderEnd:l,plane:i,ray:u}:null}}function T(e,n,t=0,o=null,l=null){let s=null;return c=>{if("start"===c.action&&(s=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenStart.x,c.screenStart.y),n,t,l),null!=s&&null!=o&&!p(s,s,o)))return null;if(null==s)return null;const i=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenEnd.x,c.screenEnd.y),n,t,l);return null!=i&&(null==o||p(i,i,o))?{...c,mapStart:s,mapEnd:i}:null}}function D(e,n,r,t=null,o=null){return T(e,r,j(n,e,r),t,o)}function M(e,n,r,t=null,o=null){return D(e,r,R(n),t,o)}function N(e,n,r,t){const o=n.toMap(e.screenStart,{include:[r]});return null!=o?M(n,r,o,t):null}function h(e,n){const r=B,t=J,o=d();e.renderCoordsHelper.worldUpAtPosition(n,r);const c=l(f(o),r,s(t,n,e.state.camera.eye));return l(c,c,r),g(n,c,o)}function k(e,n,r){let t=null;const o=new H;return o.next(O(e,h(e,n))).next(G(e,n)).next(A(e,r)).next((e=>{e.mapEnd.x=e.mapStart.x,e.mapEnd.y=e.mapStart.y,t=e})),e=>(t=null,o.execute(e),t)}function G(e,n){const r=u(),l=t(n);e.renderCoordsHelper.worldUpAtPosition(n,r);const p=u(),m=u(),d=o=>{if(s(o,o,n),E(r,o,o),"global"===e.viewingMode){t(o)*Math.sign(c(r,o))<.001-l&&s(o,i(o,r,.001),n)}return a(o,o,n),o};return e=>(e.renderStart=d(o(p,e.renderStart)),e.renderEnd=d(o(m,e.renderEnd)),e)}function A(e,n){const r=e.renderCoordsHelper;return e=>{const t=r.fromRenderCoords(e.renderStart,new U({spatialReference:n})),o=r.fromRenderCoords(e.renderEnd,new U({spatialReference:n}));return null!=t&&null!=o?{...e,mapStart:t,mapEnd:o}:null}}var F;function q(e){let n=null;return r=>{switch(r.action){case"start":n=e.disableDisplay();break;case"end":case"cancel":null!=n&&(n.remove(),n=null)}return r}}function z(n,t=null){const o=x(n.state.viewingMode);o.options.selectionMode=!0,o.options.store=b.MIN,o.options.hud=!1;const l=r(),s={requiresGroundFeedback:!0,enableDraped:!0,exclude:new Set},c=u(),i=t??n.spatialReference,a=r=>{n.map.ground&&n.map.ground.opacity<1?s.exclude.add(I):s.exclude.delete(I),n.sceneIntersectionHelper.intersectIntersectorScreen(e(r,l),o,s);const t=o.results.min;let a;if(t.getIntersectionPoint(c))a=t.intersector===w.TERRAIN?F.GROUND:F.OTHER;else{if(!o.results.ground.getIntersectionPoint(c))return null;a=F.GROUND}return{location:n.renderCoordsHelper.fromRenderCoords(c,new U({spatialReference:i})),surfaceType:a}};let p;return e=>{if("start"===e.action){const n=a(e.screenStart);p=null!=n?n.location:null}if(null==p)return null;const n=a(e.screenEnd);return null!=n?.location?{...e,mapStart:p,mapEnd:n.location,surfaceType:n.surfaceType}:null}}!function(e){e[e.GROUND=0]="GROUND",e[e.OTHER=1]="OTHER"}(F||(F={}));const B=u(),J=u(),K=y();export{F as SurfaceType,A as convertToMapCoordinates,q as hideManipulatorWhileDragging,G as projectToWorldUp,z as screenToMap3D,D as screenToMapXYAtLocation,N as screenToMapXYForGraphic,M as screenToMapXYForGraphicAtLocation,O as screenToRenderPlane,C as screenToRenderPlaneFromEvent,k as screenToZConstrained};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../Color.js";import{darken as t}from"../../../../../core/colorUtils.js";import r from"../../../../../core/Evented.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{removeMaybe as a}from"../../../../../core/maybe.js";import{watch as o}from"../../../../../core/reactiveUtils.js";import{translate as s,rotateX as n,scale as l}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m,f as d,n as u,j as p,b as h,h as f}from"../../../../../chunks/vec32.js";import{create as _,fromValues as j}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Manipulator3D as g}from"../../Manipulator3D.js";import{createManipulatorMaterial as w}from"../../manipulatorUtils.js";import{RenderObject as v}from"../../RenderObject.js";import{screenToZConstrained as M}from"../dragEventPipeline3D.js";import{ManipulatorType as U}from"../ManipulatorType.js";import{Settings as b}from"../settings.js";import{discRadius as O}from"./config.js";import{Manipulation as C}from"./Manipulation.js";import{createGraphicMoveDragPipeline as D}from"./moveUtils.js";import{createTubeGeometry as y,createConeGeometry as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as T}from"../../../webgl-engine/lib/Material.js";import{createManipulatorDragEventPipeline as k,addScreenDelta as z}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as F}from"../../../../interactive/interfaces.js";class x extends C{constructor(e){super(),this._radius=O,this.events=new r,this._tool=e.tool,this._view=e.view;const t=new b({getTheme:()=>this._view.effectiveTheme});this._settings=t,null!=e.radius&&(this._radius=e.radius);const i=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:w(this._createDarkenedColor(i,1,.25),T.Occlude),materialFocused:w(this._createDarkenedColor(i,1,0),T.Occlude),materialOccludedUnfocused:w(this._createDarkenedColor(i,.7,0),t.zManipulator.renderOccluded),materialOccludedFocused:w(this._createDarkenedColor(i,.85,0),t.zManipulator.renderOccluded)},this._themeHandle=o((()=>this._view.effectiveTheme.accentColor),(e=>{const t=this._createDarkenedColor(e,1,.25),r=this._createDarkenedColor(e,1,0),i=this._createDarkenedColor(e,.7,0),a=this._createDarkenedColor(e,.85,0),{materialUnfocused:o,materialFocused:s,materialOccludedUnfocused:n,materialOccludedFocused:l}=this._materials;o.setParameters({color:t}),s.setParameters({color:r}),n.setParameters({color:i}),l.setParameters({color:a})})),this._createManipulator(),this.forEachManipulator((e=>this._tool.manipulators.add(e)))}destroy(){this._themeHandle=a(this._themeHandle),this._manipulator.applyObjectTransform=H,this.forEachManipulator((e=>{this._tool.manipulators.remove(e),e.destroy()}))}forEachManipulator(e){e(this._manipulator,U.TRANSLATE_Z)}createGraphicDragPipeline(e,t,r){const i=t.graphic.geometry.spatialReference;return D(t.graphic,r,(t=>this.createDragPipeline(((r,i,a,o,s)=>(({steps:i,cancel:a}=e(r,i,a,o,s)),t(r,i,a))),i)))}createDragPipeline(e,t){const r=this._view;return k(this._manipulator,((i,a,o,s,n)=>{const l=a.next((e=>({...e,manipulatorType:U.TRANSLATE_Z}))).next(M(r,i.renderLocation,t)).next(z());e(i,l,o,s,n)}))}get radius(){return this._radius}set radius(e){e!==this._radius&&(this._radius=e,this._updateManipulator())}_updateManipulator(){const e=this._settings,t=this._radius/O,r=e.zManipulator.height*t,i=e.zManipulator.coneHeight*t,a=e.zManipulator.coneWidth*t,o=e.zManipulator.width*t,m=[j(0,0,0),j(0,0,r)],d=[j(0,0,0),j(0,0,r+i)],u=e=>{const t=c();if(s(t,t,[0,0,r]),n(t,t,Math.PI/2),e){const r=1+2*e/a;l(t,t,[r,r,r])}return t},p=u(0),{materialUnfocused:h,materialFocused:f,materialOccludedUnfocused:_,materialOccludedFocused:g}=this._materials,w=y(h,m,o/2,16,!1),M=P(h,i,a/2,16,!1);M.transformation=p,this._manipulator.renderObjects=[new v(M,F.Unfocused),new v(w,F.Unfocused),new v(M.instantiate({material:f}),F.Focused),new v(w.instantiate({material:f}),F.Focused),new v(M.instantiate({material:_}),F.Unfocused),new v(w.instantiate({material:_}),F.Unfocused),new v(M.instantiate({material:g}),F.Focused),new v(w.instantiate({material:g}),F.Focused)],this._manipulator.radius=o/2+2,this._manipulator.collisionType={type:"line",paths:[d]}}_createManipulator(){const e=this._view,t=new g({view:e,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});t.applyObjectTransform=t=>{const r=e.state.camera,a=A;e.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,a);const o=m(r.eye,a),s=r.computeRenderPixelSizeAtDist(o),n=d(E,a,r.eye);u(n,n);const l=R;e.renderCoordsHelper.worldUpAtPosition(A,l);const c=Math.abs(p(n,l)),_=h(E,n,l),j=h(E,_,l),g=i(c,.01,1),w=1-Math.sqrt(1-g*g)/g/r.fullWidth,v=this._settings,M=this._radius/O,U=v.zManipulator.width*M;f(j,u(j,j),(1/w-1)*o+s*U),t[12]-=E[0],t[13]-=E[1],t[14]-=E[2]},this._manipulator=t,this._updateManipulator()}_createDarkenedColor(r,i,a){const o=t(r,a);return o.a*=i,e.toUnitRGBA(o)}get test(){return{manipulator:this._manipulator}}}const A=_(),E=_(),R=_(),H=()=>{};export{x as MoveZManipulation};
5
+ import e from"../../../../../Color.js";import{darken as t}from"../../../../../core/colorUtils.js";import r from"../../../../../core/Evented.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{removeMaybe as a}from"../../../../../core/maybe.js";import{watch as o}from"../../../../../core/reactiveUtils.js";import{translate as s,rotateX as n,scale as l}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{o as m,f as d,n as u,k as p,b as h,h as f}from"../../../../../chunks/vec32.js";import{create as _,fromValues as j}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Manipulator3D as g}from"../../Manipulator3D.js";import{createManipulatorMaterial as w}from"../../manipulatorUtils.js";import{RenderObject as v}from"../../RenderObject.js";import{screenToZConstrained as M}from"../dragEventPipeline3D.js";import{ManipulatorType as U}from"../ManipulatorType.js";import{Settings as b}from"../settings.js";import{discRadius as O}from"./config.js";import{Manipulation as C}from"./Manipulation.js";import{createGraphicMoveDragPipeline as D}from"./moveUtils.js";import{createTubeGeometry as y,createConeGeometry as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as T}from"../../../webgl-engine/lib/Material.js";import{createManipulatorDragEventPipeline as k,addScreenDelta as z}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as F}from"../../../../interactive/interfaces.js";class x extends C{constructor(e){super(),this._radius=O,this.events=new r,this._tool=e.tool,this._view=e.view;const t=new b({getTheme:()=>this._view.effectiveTheme});this._settings=t,null!=e.radius&&(this._radius=e.radius);const i=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:w(this._createDarkenedColor(i,1,.25),T.Occlude),materialFocused:w(this._createDarkenedColor(i,1,0),T.Occlude),materialOccludedUnfocused:w(this._createDarkenedColor(i,.7,0),t.zManipulator.renderOccluded),materialOccludedFocused:w(this._createDarkenedColor(i,.85,0),t.zManipulator.renderOccluded)},this._themeHandle=o((()=>this._view.effectiveTheme.accentColor),(e=>{const t=this._createDarkenedColor(e,1,.25),r=this._createDarkenedColor(e,1,0),i=this._createDarkenedColor(e,.7,0),a=this._createDarkenedColor(e,.85,0),{materialUnfocused:o,materialFocused:s,materialOccludedUnfocused:n,materialOccludedFocused:l}=this._materials;o.setParameters({color:t}),s.setParameters({color:r}),n.setParameters({color:i}),l.setParameters({color:a})})),this._createManipulator(),this.forEachManipulator((e=>this._tool.manipulators.add(e)))}destroy(){this._themeHandle=a(this._themeHandle),this._manipulator.applyObjectTransform=H,this.forEachManipulator((e=>{this._tool.manipulators.remove(e),e.destroy()}))}forEachManipulator(e){e(this._manipulator,U.TRANSLATE_Z)}createGraphicDragPipeline(e,t,r){const i=t.graphic.geometry.spatialReference;return D(t.graphic,r,(t=>this.createDragPipeline(((r,i,a,o,s)=>(({steps:i,cancel:a}=e(r,i,a,o,s)),t(r,i,a))),i)))}createDragPipeline(e,t){const r=this._view;return k(this._manipulator,((i,a,o,s,n)=>{const l=a.next((e=>({...e,manipulatorType:U.TRANSLATE_Z}))).next(M(r,i.renderLocation,t)).next(z());e(i,l,o,s,n)}))}get radius(){return this._radius}set radius(e){e!==this._radius&&(this._radius=e,this._updateManipulator())}_updateManipulator(){const e=this._settings,t=this._radius/O,r=e.zManipulator.height*t,i=e.zManipulator.coneHeight*t,a=e.zManipulator.coneWidth*t,o=e.zManipulator.width*t,m=[j(0,0,0),j(0,0,r)],d=[j(0,0,0),j(0,0,r+i)],u=e=>{const t=c();if(s(t,t,[0,0,r]),n(t,t,Math.PI/2),e){const r=1+2*e/a;l(t,t,[r,r,r])}return t},p=u(0),{materialUnfocused:h,materialFocused:f,materialOccludedUnfocused:_,materialOccludedFocused:g}=this._materials,w=y(h,m,o/2,16,!1),M=P(h,i,a/2,16,!1);M.transformation=p,this._manipulator.renderObjects=[new v(M,F.Unfocused),new v(w,F.Unfocused),new v(M.instantiate({material:f}),F.Focused),new v(w.instantiate({material:f}),F.Focused),new v(M.instantiate({material:_}),F.Unfocused),new v(w.instantiate({material:_}),F.Unfocused),new v(M.instantiate({material:g}),F.Focused),new v(w.instantiate({material:g}),F.Focused)],this._manipulator.radius=o/2+2,this._manipulator.collisionType={type:"line",paths:[d]}}_createManipulator(){const e=this._view,t=new g({view:e,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});t.applyObjectTransform=t=>{const r=e.state.camera,a=A;e.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,a);const o=m(r.eye,a),s=r.computeRenderPixelSizeAtDist(o),n=d(E,a,r.eye);u(n,n);const l=R;e.renderCoordsHelper.worldUpAtPosition(A,l);const c=Math.abs(p(n,l)),_=h(E,n,l),j=h(E,_,l),g=i(c,.01,1),w=1-Math.sqrt(1-g*g)/g/r.fullWidth,v=this._settings,M=this._radius/O,U=v.zManipulator.width*M;f(j,u(j,j),(1/w-1)*o+s*U),t[12]-=E[0],t[13]-=E[1],t[14]-=E[2]},this._manipulator=t,this._updateManipulator()}_createDarkenedColor(r,i,a){const o=t(r,a);return o.a*=i,e.toUnitRGBA(o)}get test(){return{manipulator:this._manipulator}}}const A=_(),E=_(),R=_(),H=()=>{};export{x as MoveZManipulation};
@@ -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"../../../../../geometry.js";import e from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,initial as g}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as _}from"../../../../../core/unitUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as y,f as x,k as O,s as b,g as E,h as G}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as H}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as V}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as L}from"../../../../../layers/graphics/dehydratedPoint.js";import{getGraphicEffectiveElevationInfo as D}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as j}from"../../../../../symbols/support/utils.js";import{Manipulator3D as k}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as U,placeAtGraphic as C}from"../../manipulatorUtils.js";import{RenderObject as N}from"../../RenderObject.js";import{SegmentLabels3D as R}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as F}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as z,convertToMapCoordinates as X,screenToMapXYAtLocation as Z,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{orientation as q}from"../geometryUtils.js";import{ManipulatorType as W}from"../ManipulatorType.js";import{canMoveZ as K}from"../manipulatorUtils.js";import{Settings as B}from"../settings.js";import{createVisualElements as J}from"../visualElementUtils.js";import{discRadiusSmall as Q}from"../manipulations/config.js";import{ManipulationType as $,MoveManipulation as tt}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as et}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as it}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as at,createEdgeOffsetOperation as nt,edgeOffsetRotationMatrix as ot,screenEdgeLengthSquared as st}from"./edgeOffsetUtils.js";import{OutlineVisualElement as rt}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as lt}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pt,createSphereGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as dt}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ut,addMapDelta as ct,createManipulatorDragEventPipeline as mt,dragAtLocation as gt,addScreenDelta as _t}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as ft,ManipulatorStateCustomFlags as vt}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as Mt}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehavior as yt}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as xt}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Ot}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as bt}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Et}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Gt,TranslateGraphicXYTooltipInfo as It,TranslateGraphicTooltipInfo as St,TranslateVertexZTooltipInfo as Tt,TranslateVertexXYTooltipInfo as wt,TranslateVertexTooltipInfo as Ht}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{makeElevationField as Vt}from"../../../../interactive/tooltip/fields/fields.js";import{autoArea2D as At}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoDistanceBetweenPoints2D as Lt,autoLength2D as Dt}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as jt,elevationFromPoint as kt}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Pt}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ut from"../../../../../geometry/SpatialReference.js";let Ct=class extends(n.EventedMixin(e)){constructor(t){super(t),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Yt.NONE,this._updatingHandles=new T,this._recreatingManipulators=!1,this._settings=new B({getTheme:()=>this.view.effectiveTheme}),this._latestTooltipInfo=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null,this._translateVertexTooltipInfo=null,this._translateVertexXYTooltipInfo=null,this._translateVertexZTooltipInfo=null,this._edgeOffsetTooltipInfo=null,this.outputGeometry=null,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:t,view:e}=this,i=this._settings.manipulators,n=i.vertex;this._vertexManipulatorMaterial=P(a(n.color),n.renderOccluded),this._vertexManipulatorOutlineMaterial=U(a(n.outlineColor),n.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(a(n.hoverOutlineColor),n.renderOccluded);const o=i.edge;this._edgeManipulatorMaterial=P(a(o.color),o.renderOccluded),this._edgeManipulatorOutlineMaterial=U(a(o.outlineColor),o.renderOccluded);const s=i.edgeOffset;this._edgeOffsetManipulatorMaterial=P(a(s.color),s.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(a(s.hoverColor),s.renderOccluded,!1);const r=i.selected;this._selectedManipulatorMaterial=P(a(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=U(a(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(a(r.hoverOutlineColor),r.renderOccluded);const l=this._graphicState=new lt({graphic:t});this.tooltip=new Et({view:e}),this.addHandles([m((()=>{const t=this._settings.manipulators;return{vertexSettings:t.vertex,edgeSettings:t.edge,edgeOffsetSettings:t.edgeOffset,selectedSettings:t.selected}}),(({vertexSettings:t,edgeSettings:e,edgeOffsetSettings:i,selectedSettings:a})=>{t.applyColor(this._vertexManipulatorMaterial),t.applyOutline(this._vertexManipulatorOutlineMaterial),t.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),e.applyColor(this._edgeManipulatorMaterial),e.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)})),m((()=>l.displaying),(t=>{for(const e of this._manipulatorInfos)e.manipulator.available=t})),m((()=>({labels:this._segmentLabels,enabled:this.sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:t,enabled:e,edgeOffsetEnabled:i})=>{null!=t&&(t.visible=e,t.edgeDistance=i?"far":"default")}),g),m((()=>this.sketchOptions.tooltips.effectiveEnabled),(t=>{this.tooltip.info=t?this._latestTooltipInfo:null}),g),this.view.trackGraphicState(l)])}destroy(){this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(t){this._recreateEditGeometryAndManipulators(t)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}removeSelectedVertices(){const t=this._manipulatorInfos.filter((t=>t.manipulator.selected&&"vertex"===t.type));this._removeVertices(t)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._graphicMoveManipulation=p(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(t){if(null==this._editGeometryOperations)return;const e=D(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=t?.byComponentIndex.get(i.index);for(const t of i.vertices){const i=a?.has(t.index);this._createVertexOrEdgeManipulator(t,e,i)}for(const t of i.edges)this._createVertexOrEdgeManipulator(t,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const t=this._editGeometryOperations.redo();return null!=t&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const t=this._editGeometryOperations.undo();return null!=t&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._hideTooltip(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(t){const e={byComponentIndex:new Map};if(null!=t&&null!=this.inputGeometry&&H(t,this.inputGeometry))for(const n of this._manipulatorInfos)if("vertex"===n.type&&n.manipulator.selected){const{index:t,component:{index:i}}=n.handle,{byComponentIndex:a}=e,o=a.get(i)||new Set;o.add(t),a.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._hideTooltip(),this._editGeometryOperations=p(this._editGeometryOperations),this._segmentLabels=p(this._segmentLabels),null==t)return void(this._recreatingManipulators=!1);const i="mesh"===t.type?t.anchor:t;this._editGeometryOperations=Mt.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(e);const a=this.sketchOptions.labels;this._segmentLabels=new R({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:D(this.graphic),labelOptions:a,graphic:this.graphic,graphicState:this._graphicState},visible:a.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(t,e){if("end"===e.action)return e;let i=0;const a=[],n=this._manipulatorInfos.some((t=>"vertex"===t.type&&t.manipulator.selected)),o=t===qt.SELECTED_OR_ALL&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);if(0===a.length)return e;this._moveVertices(a,e);if(a.length===i){if(this._updateEventState(Yt.MOVING),this.destroyed)return e;this.emit("move",{type:"move",dx:e.screenDeltaX,dy:e.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Yt.RESHAPING),this.destroyed)return e;this.emit("reshape",{type:"reshape",mover:this.graphic})}return e}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((t,e)=>"vertex"===e.type&&e.manipulator.selected?t+1:t),0)>1}_perVertexManipulatorDragAction(t){if(this._updateEventState(Yt.RESHAPING),this.destroyed)return;const{mapDeltaX:e,mapDeltaY:i,mapDeltaZ:a}=t;if(!e&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===t.info)&&n.push(o);this._moveVertices(n,t,yt.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(t){if(t===this._reshapeEventState)return!1;switch(t){case Yt.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Yt.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Yt.MOVING:switch(this._reshapeEventState){case Yt.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Yt.RESHAPING:switch(this._reshapeEventState){case Yt.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Yt.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const e=this._reshapeEventState!==t;return this._reshapeEventState=t,e}_createGraphicMoveManipulation(){const{tool:t,view:e}=this,i=this._graphicState;if(this._graphicMoveManipulation=new it({tool:t,view:e,graphicState:i}),this.enableMoveGraphic){let t=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((e,i,a)=>{i.next((t=>this._trackNumDragging(t))).next((e=>("start"===e.action&&(t=this._editGeometryOperations.createUndoGroup()),e))).next((t=>this._perGraphicManipulatorDragAction(qt.ALL,t))).next((t=>(this._updateTranslateGraphicTooltip($.XY,t),t))).next((e=>{"end"===e.action&&(this._hideTooltip(),t=h(t))})),a.next((()=>this._onDragCancel(!0,(()=>t=h(t)))))}))),this._graphicMoveManipulation.forEachManipulator((t=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(t,!1))))}else this._graphicMoveManipulation.forEachManipulator((t=>{t.grabbable=!1,t.cursor=null}));this._graphicMoveManipulation.forEachManipulator((t=>this._manipulatorHandles.add(t.events.on("immediate-click",(t=>{this._manipulatorInfos.some((t=>t.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()})))))}_createMoveManipulation(t){const{graphic:e,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new tt({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&K(e),snapToScene:!1,radius:tt.radiusForSymbol(e.symbol)}),this._moveManipulation.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(t)||this._manipulatorInfos.some((t=>t.manipulator.selected))||this.emit("immediate-click",{...i,graphic:e}),i.stopPropagation()})),this._watchAndUpdateGrabState(t,!1)])));const o=t=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{"focus"===e?this._updateTranslateTooltip(t):this._hideTooltip()})))};this._moveManipulation.xyManipulation.forEachManipulator(o($.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o($.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o($.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=e.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,s,r)=>{const{snappingStep:l,cancelSnapping:p}=Ot({predicate:t=>!!t.info,snappingManager:i.snappingManager,snappingContext:new xt({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:r,excludeFeature:e,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next((t=>(this._onDragCancel(),t))).next(p),{steps:o=o.next((t=>this._trackNumDragging(t))).next((t=>{const e=this._manipulatorInfos.filter((t=>"vertex"===t.type&&t.manipulator.selected));return t.manipulatorType===W.TRANSLATE_XY&&1===e.length?{...t,info:e[0],snapOrigin:e[0].handle.pos}:t})).next(ut(this.view,t,e)).next(...l).next(ct()).next((t=>this._perGraphicManipulatorDragAction(qt.SELECTED_OR_ALL,t))).next((t=>(this._updateTranslateTooltip(a,t),t))),cancel:s}}),t,s,e),m((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),g),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(t=>{this._updateMoveManipulationPosition();const e="align-move-manipulation";t?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),e):this.removeHandles(e)}),g)])}_createVisualElements(){const{graphic:t,view:e}=this,i=J({view:e,graphic:t,forEachManipulator:t=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(t),this._moveManipulation.forEachManipulator(t);for(const e of this._manipulatorInfos)t(e.manipulator,W.TRANSLATE_XY)}},onManipulatorsChanged:t=>this.on("manipulators-changed",t)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof rt?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(t,e=D(this.graphic)){if(t.component.vertices.length<=2)return null;const i=this._settings.manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,o=a/n,r=o*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=pt(this._edgeOffsetManipulatorMaterial,r,o/2,o/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=pt(this._edgeOffsetManipulatorMaterial,-r,o/2,o/2,i.height,-i.offset));const l=[new N(this._edgeOffsetManipulatorGeometryInside.instantiate(),ft.Unfocused),new N(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ft.Focused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate(),ft.Unfocused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ft.Focused)],p=new k({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==e.mode||j(this.graphic.symbol)?{mode:"absolute-height",offset:0}:e,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new k({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),u={manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:e,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(u,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(u);const c=[];for(const s of[t.leftVertex,t.rightVertex]){const t=this._getManipulatorInfoFromHandle(s);null!=t&&c.push(t.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(u))))}u.locationUpdateHandle=s(c),this._manipulatorHandles.add(u.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(mt(p,this._createEdgeOffsetPipeline(u,e)),p),this._manipulatorHandles.add(mt(h,((t,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(u,e)(t,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((t=>this._trackNumDragging(t))).next(gt(this.view,t.elevationAlignedLocation)).next(Z(this.view,t.elevationAlignedLocation,e,o,n)).next(_t()).next(ct()).next((t=>this._perGraphicManipulatorDragAction(qt.ALL,t))).next((t=>(this._updateTranslateGraphicTooltip($.XY,t),t))).next((t=>{"end"===t.action&&this._hideTooltip()})),a.next((()=>this._onDragCancel(!t.metadata.deleting)))}})),p);const m=t=>{this._manipulatorInfos.some((t=>t.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",m),h.events.on("immediate-click",m),p.events.on("focus-changed",(({action:t})=>{const{sketchOptions:e,tooltip:i}=this;if("focus"===t){const t=this._edgeOffsetTooltipInfo??=new bt({sketchOptions:e});t.distance=d,t.sketchOptions=e,this._updateTooltipAreaOrTotalLength(t),this._latestTooltipInfo=t,i.info=e.tooltips.effectiveEnabled?this._latestTooltipInfo:null}else this._hideTooltip()}))],p),this._manipulatorInfos.push(u),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),u}_autoHideEdgeOffsetManipulator(t,e){const i=t.manipulator,a=t.edgeManipulator,n=()=>{t.visibilityHandle=h(t.visibilityHandle);const n=this._getManipulatorInfoFromHandle(t.handle.leftVertex),o=this._getManipulatorInfoFromHandle(t.handle.rightVertex),l=null!=n&&null!=o&&st(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<e;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,t.visibilityHandle=s([i.disableDisplay(),r((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r((()=>{h(t.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(t){this._updateManipulatorPosition(t);const{coordinateHelper:e}=this._editGeometryOperations.data,i=at(this.view,t.manipulator.elevationAlignedLocation,nt(e,t.handle,t.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(t.handle.leftVertex),n=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ot(i,o,s):M;t.manipulator.modelTransform=r,t.edgeManipulator.elevationAlignedLocation=t.manipulator.elevationAlignedLocation,t.edgeManipulator.modelTransform=r;const l=y(x(zt,o,s))/2;t.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(t,e){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:s}=this._initializeEdgeOffset(t,e);a.next((t=>this._trackNumDragging(t))).next(gt(this.view,i.elevationAlignedLocation)).next(o).next(z(this.view)).next(X(this.view,this._editGeometryOperations.data.spatialReference)).next(ct()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(t)).next(this._showEdgeOffsetTooltip()).next((t=>{"end"===t.action&&s()})),n.next((()=>{i.metadata.deleting||(s(),this._onDragCancel())}))}}_initializeEdgeOffset(t,e){const{view:i}=this,n=this._editGeometryOperations,o=nt(n.data.coordinateHelper,t.handle,e),r=n.createUndoGroup(),p=at(i,t.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const e=this._getManipulatorInfoFromHandle(t.handle.leftVertex.leftEdge);null!=e&&this._splitEdgeManipulator(e,1)}if(o.requiresSplitEdgeRight){const e=this._getManipulatorInfoFromHandle(t.handle.rightVertex.rightEdge);null!=e&&this._splitEdgeManipulator(e,0)}const d=()=>new w({paths:[[t.handle.leftVertex.pos,t.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),u=this._settings,c=new rt({view:i,isDraped:this._graphicState.isDraped,geometry:d(),elevationInfo:t.elevationInfo,width:u.visualElements.lineGraphics.outline.width,attached:!1,isDecoration:!0});let _;const f=()=>{this._cleanEdgeOffsetCollapsedEdges(t),_=h(_)},v=this.on("undo",f);return _=s([m((()=>a(this._accentColor)),(t=>c.color=t),g),l(c),m((()=>this._graphicState.isDraped),(t=>c.isDraped=t)),this._graphicState.on("changed",(()=>c.geometry=d())),r,v]),c.attached=!0,{step:t=>null==o||null==p?(f(),null):{...t,operation:o,plane:p},cleanup:f}}_applyEdgeOffsetStep(t){return e=>{if(this.destroyed||null==e.operation)return e;this._updateEventState(Yt.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=e;return(i||a||n)&&(this._offsetEdge(t,e),this.emit("reshape",{type:"reshape",mover:this.graphic})),e}}_applyComputeEdgeOffsetDistanceStep(){return t=>{const{operation:e,mapEnd:i}=t;return null==e||null==i?t:("start"===t.action&&e.selectArrowFromStartPoint(i),{...t,signedDistance:e.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return t=>{const{mapEnd:e,signedDistance:i,operation:a}=t,{tooltip:n,sketchOptions:o}=this;if(null!=i){const n=this._edgeOffsetTooltipInfo??=new bt({sketchOptions:o});n.sketchOptions=o,n.distance="end"===t.action?d:Rt(this._graphicState.isDraped,i*a.selectedArrow,e,a.plane,this._editGeometryOperations.data.coordinateHelper),this._updateTooltipAreaOrTotalLength(n),this._latestTooltipInfo=n}else this._latestTooltipInfo=null;return n.info=o.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t}}_cleanEdgeOffsetCollapsedEdges(t){const e=t.handle.leftVertex.leftEdge?.leftVertex,i=t.handle.leftVertex,a=t.handle.rightVertex.rightEdge?.rightVertex,n=t.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,s=[];if(e&&o.distance(e.pos,i.pos)<Xt){const t=this._getManipulatorInfoFromHandle(i);null!=t&&s.push(t)}if(o.distance(i.pos,n.pos)<Xt||a&&o.distance(a.pos,n.pos)<Xt){const t=this._getManipulatorInfoFromHandle(n);null!=t&&s.push(t)}s.length&&this._removeVertices(s)}_computeVertexManipulatorSizeAndOutline(t){const e=t.size/2,i=e+t.collisionPadding;return{size:e/i,outlineSize:(e+t.outlineSize)/i}}_createVertexOrEdgeManipulator(t,e=D(this.graphic),i=!1){const{view:a}=this,n=this._settings;if("edge"===t.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(t,e);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:t,outlineSize:e}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=ht(this._vertexManipulatorMaterial,t,16,16),this._vertexManipulatorOutlineGeometry=ht(this._vertexManipulatorOutlineMaterial,e,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:t,outlineSize:e}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=ht(this._edgeManipulatorMaterial,t,16,16),this._edgeManipulatorOutlineGeometry=ht(this._edgeManipulatorOutlineMaterial,e,16,16)}const{geometry:o}=this.graphic,r=o?.type,l="point"===r||"mesh"===r?[]:[new N(this._vertexManipulatorGeometry.instantiate(),Zt.Vertex|ft.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate(),Zt.Vertex|ft.Unfocused|ft.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Zt.Vertex|ft.Focused|ft.Unselected),new N(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),ft.Selected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),ft.Selected|ft.Unfocused),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),ft.Selected|ft.Focused)];this.enableMidpoints&&l.push(new N(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Zt.Edge|ft.Focused|ft.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Zt.Edge|ft.Focused|ft.Unselected),new N(this._edgeManipulatorGeometry.instantiate(),Zt.Edge|ft.Unfocused|ft.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate(),Zt.Edge|ft.Unfocused|ft.Unselected));const p=new k({view:a,renderObjects:l,elevationInfo:e,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});p.selected=i,this._setTypeSpecificManipulatorSettings(p,t,e);const d="edge"===t.type?{manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:p,handle:t,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(p),this._updateManipulatorPosition(d),"edge"===d.type){const t=[];for(const e of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(e);null!=i&&t.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=s(t),this._manipulatorHandles.add(d.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const u=mt(p,((t,i,a,n)=>{let o=null;const{snappingStep:s,cancelSnapping:r}=Ot({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new xt({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:n,excludeFeature:this.graphic,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((e=>(this._onDragCancel(!t.metadata.deleting,(()=>o=h(o))),e))).next(r),i.next((t=>this._trackNumDragging(t))).next((t=>{if("start"===t.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const e=this._splitEdgeManipulator(d);return{...t,info:e,snapOrigin:e.handle.pos}}return{...t,info:d,snapOrigin:d.handle.pos}})).next(gt(this.view,t.elevationAlignedLocation)).next(Y(this.view,this.graphic,t.elevationAlignedLocation,t.location.spatialReference,this.graphic)).next(ut(this.view,e,this.graphic)).next(...s).next(ct()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(o=h(o)),this._updateTranslateVertexTooltip(t,$.XY,e)}))}));return this._manipulatorHandles.add([u,p.events.on("immediate-click",(t=>this._manipulatorClickCallback(t,d))),p.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),p.events.on("focus-changed",(({action:t})=>{"focus"===t&&"edge"!==d.type?this._updateTranslateVertexTooltip(p,$.XY):this._hideTooltip()}))],p),this.emit("manipulators-changed"),d}_trackNumDragging(t){switch(t.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return t}_onDragCancel(t=!0,e){switch(this._numDragging--,t&&(this.undo(),this.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._hideTooltip(),this._reshapeEventState){case Yt.NONE:break;case Yt.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(Yt.NONE)}_setTypeSpecificManipulatorSettings(t,e,i){const{graphic:a}=this,n=this._settings;switch(e.type){case"vertex":{t.state=Zt.Vertex,t.selectable=!0,t.cursor="move",t.collisionPriority=2;const{size:e,collisionPadding:o}=n.manipulators.vertex;t.radius=e/2+o,t.elevationInfo=i;const{geometry:s}=a,r=s?.type;t.interactive=null!=r&&"point"!==r&&"mesh"!==r;break}case"edge":{t.state=Zt.Edge,t.selectable=!1,t.cursor="copy",t.collisionPriority=-1;const{size:e,collisionPadding:o}=n.manipulators.edge;t.radius=e/2+o,t.elevationInfo="on-the-ground"!==i.mode||j(a.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(t,e){return t.events.on("grab-changed",(i=>this._onGrabStateChanged(t,e,i.action,i.pointerType)))}_onGrabStateChanged(t,e,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)e&&this._updateSelection(t),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Yt.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((t=>{const{manipulator:e}=t,{geometry:i}=this.graphic,a=i?.type;e.interactive=e.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in t&&(t.edgeManipulator.interactive=t.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((t=>{t.interactive=t.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const t of this._manipulatorInfos)t.manipulator.grabbing||(t.manipulator.selected=!1)}_updateSelection(t){t.grabbing&&!t.selected&&t.selectable&&(this._clearSelection(),t.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(t){null!=t&&(t.manipulator.metadata.deleting=!0,this.manipulators.remove(t.manipulator),this._manipulatorHandles.remove(t.manipulator),i(this._manipulatorInfos,t),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(t){if(t)for(const e of this._manipulatorInfos)if(t===e.handle)return e;return null}_updateManipulatorPosition(t){if(null==t)return;const e=this._editGeometryOperations;if("vertex"===t.type)t.manipulator.location=e.data.coordinateHelper.vectorToDehydratedPoint(t.handle.pos,Ft),t.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=t.manipulator.renderLocation);else if("edge"===t.type){const i=this._getManipulatorInfoFromHandle(t.handle.leftVertex),a=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if(null!=t.manipulator.elevationInfo&&"on-the-ground"===t.manipulator.elevationInfo.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;t.manipulator.location=L(r,l,p,e.data.spatialReference)}else O(zt,n.renderLocation,o.renderLocation,.5),t.manipulator.renderLocation=zt}}_splitEdgeManipulator(t,e=.5){const i=this._editGeometryOperations,a=i.splitEdge(t.handle,e).createdVertex;t.locationUpdateHandle=h(t.locationUpdateHandle);const n=D(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(t),o=this._createVertexOrEdgeManipulator(a)):(o=t,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(t.manipulator,t.handle,n)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,$.XY),this._updateSelection(t.manipulator);const s=this._updateEventState(Yt.RESHAPING),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(Yt.NONE),o}_updateMoveManipulationPosition(){const t=b(zt,0,0,0);let e=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(e++,E(t,t,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===e){const t=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=t,this._moveManipulation.xyAxisManipulation.available=t,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=t,this._moveManipulation.zManipulation.available=t&&this.enableZShape&&K(this.graphic),this._moveManipulation.angle=q(this.graphic.geometry),this._moveManipulation.radius=tt.radiusForSymbol(this.graphic.symbol)}else{const t=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=t,this._moveManipulation.xyAxisManipulation.available=t,this._moveManipulation.zManipulation.available=t&&this.enableZVertex&&K(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=t&&1!==e;let i=0;if(null!=a){const t=a.handle.pos,e=null!=n?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;e&&o?this._moveManipulation.xyAxisManipulation.available=!1:e?i=Nt(e,t):o&&(i=Nt(t,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=Q}0!==e&&i?(G(t,t,1/e),Ft.spatialReference=this._editGeometryOperations.data.spatialReference,Ft.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(t,Ft),this._moveManipulation.elevationAlignedLocation=Ft):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(t){const e=new Array,i=this._editGeometryOperations;for(const a of t){const t=a.handle.component;if("vertex"===a.type&&i.canRemoveVertex(t)){e.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&t.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(t.edges[0]))}}if(e.length>0){const t=e.map((t=>{const e=i.data.components.indexOf(t.component);return{coordinates:i.data.coordinateHelper.vectorToArray(t.pos),componentIndex:e,vertexIndex:t.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Yt.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:t.map((t=>t.coordinates)),vertices:t}),this.destroyed)return;if(a&&(this._updateEventState(Yt.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(t,e,i=("start"===e.action?yt.NEW_STEP:yt.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(t.map((t=>t.handle)),e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of t)this._updateManipulatorPosition(n)}_offsetEdge(t,e){if(null==e.operation||null==e.signedDistance)return;const i=this._editGeometryOperations,a=e.operation.clone();a.distance=e.signedDistance,i.updateVertices([t.handle.leftVertex,t.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.rightVertex))}_manipulatorClickCallback(t,e){t.shiftKey||this._clearSelection(),"vertex"===e.type&&(e.manipulator.selected=!e.manipulator.selected,t.button===dt.Right&&this._removeVertices([e])),"edge"===e.type&&t.button===dt.Left&&this._splitEdgeManipulator(e),t.stopPropagation()}_updateTranslateTooltip(t,e){const i=this._manipulatorInfos.filter((t=>"vertex"===t.type&&t.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,t,e):this._updateTranslateGraphicTooltip(t,e)}_updateTranslateGraphicTooltip(t,e){const{sketchOptions:i,tooltip:a}=this;switch(t){case $.XY:this._latestTooltipInfo=this._translateGraphicTooltipInfo??=new St({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,((t,e)=>Lt(t,e)));break;case $.XY_AXIS:this._latestTooltipInfo=this._translateGraphicXYTooltipInfo??=new It({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,((t,i)=>u(Lt(t,i),et(e))));break;case $.Z:this._latestTooltipInfo=this._translateGraphicZTooltipInfo??=new Gt({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,jt)}this._latestTooltipInfo.sketchOptions=i,a.info=i.tooltips.effectiveEnabled?this._latestTooltipInfo:null}_updateTranslateVertexTooltip(t,e,i){const{sketchOptions:a,tooltip:n}=this;switch(e){case $.XY:this._latestTooltipInfo=this._translateVertexTooltipInfo??=new Ht({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,((t,e)=>Lt(t,e))),this._updateTooltipAreaOrTotalLength(this._latestTooltipInfo);break;case $.XY_AXIS:this._latestTooltipInfo=this._translateVertexXYTooltipInfo??=new wt({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,((t,e)=>u(Lt(t,e),et(i)))),this._updateTooltipAreaOrTotalLength(this._latestTooltipInfo);break;case $.Z:this._latestTooltipInfo=this._translateVertexZTooltipInfo??=new Tt({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,jt)}const o=kt(t.location);this._latestTooltipInfo.elevation=null!=o?Vt({actual:o}):null,this._latestTooltipInfo.sketchOptions=a,n.info=a.tooltips.effectiveEnabled?this._latestTooltipInfo:null}_updateTranslateTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:n}=e,o=i(a,n);t.distance=null!=o?o:d}else t.distance=d}_updateTooltipAreaOrTotalLength(t){const{geometry:e}=this.graphic;if(null==e)return t.area=null,void(t.totalLength=null);t.area="polygon"===e.type?At(e):null,t.totalLength="polyline"===e.type?Dt(e):null}_hideTooltip(){this.tooltip.clear(),this._latestTooltipInfo=null}get test(){return{segmentLabels:this._segmentLabels,manipulatorInfos:this._manipulatorInfos}}};function Nt(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])+Math.PI/2}function Rt(t,e,i,a,n){if(t){const t=n.toXYZ(n.pointToVector(i)),o=V(a,t,A.get()),s=Pt(o,t,n.spatialReference);if(null!=s)return c(s.value*Math.sign(e),s.unit)}return c(e*_(i.spatialReference),"meters")}t([f()],Ct.prototype,"_editGeometryOperations",void 0),t([f()],Ct.prototype,"_segmentLabels",void 0),t([f({constructOnly:!0})],Ct.prototype,"tool",void 0),t([f()],Ct.prototype,"tooltip",void 0),t([f()],Ct.prototype,"inputGeometry",null),t([f()],Ct.prototype,"outputGeometry",void 0),t([f({readOnly:!0})],Ct.prototype,"updating",null),t([f()],Ct.prototype,"manipulators",null),t([f()],Ct.prototype,"view",null),t([f()],Ct.prototype,"graphic",null),t([f()],Ct.prototype,"enableZShape",null),t([f()],Ct.prototype,"enableZVertex",null),t([f()],Ct.prototype,"enableMoveGraphic",null),t([f()],Ct.prototype,"enableMidpoints",null),t([f()],Ct.prototype,"enableEdgeOffset",null),t([f()],Ct.prototype,"sketchOptions",null),t([f()],Ct.prototype,"_accentColor",null),Ct=t([v("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Ct);const Ft=L(0,0,void 0,Ut.WGS84),zt=S(),Xt=1e-6;var Zt,Yt,qt;!function(t){t.Vertex=vt.Custom1,t.Edge=vt.Custom2}(Zt||(Zt={})),function(t){t[t.NONE=0]="NONE",t[t.MOVING=1]="MOVING",t[t.RESHAPING=2]="RESHAPING"}(Yt||(Yt={})),function(t){t[t.ALL=0]="ALL",t[t.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(qt||(qt={}));export{Ct as ReshapeOperation};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import e from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,initial as g}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as _}from"../../../../../core/unitUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as y,f as x,m as O,s as b,g as E,h as G}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as T}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as H}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as V}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as L}from"../../../../../layers/graphics/dehydratedPoint.js";import{getGraphicEffectiveElevationInfo as D}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as j}from"../../../../../symbols/support/utils.js";import{Manipulator3D as k}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as U,placeAtGraphic as C}from"../../manipulatorUtils.js";import{RenderObject as N}from"../../RenderObject.js";import{SegmentLabels3D as R}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as F}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as z,convertToMapCoordinates as X,screenToMapXYAtLocation as Z,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{orientation as q}from"../geometryUtils.js";import{ManipulatorType as W}from"../ManipulatorType.js";import{canMoveZ as K}from"../manipulatorUtils.js";import{Settings as B}from"../settings.js";import{createVisualElements as J}from"../visualElementUtils.js";import{discRadiusSmall as Q}from"../manipulations/config.js";import{ManipulationType as $,MoveManipulation as tt}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as et}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as it}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as at,createEdgeOffsetOperation as nt,edgeOffsetRotationMatrix as ot,screenEdgeLengthSquared as st}from"./edgeOffsetUtils.js";import{OutlineVisualElement as rt}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as lt}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pt,createSphereGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as dt}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ut,addMapDelta as ct,createManipulatorDragEventPipeline as mt,dragAtLocation as gt,addScreenDelta as _t}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as ft,ManipulatorStateCustomFlags as vt}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as Mt}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehavior as yt}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as xt}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Ot}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as bt}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Et}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Gt,TranslateGraphicXYTooltipInfo as It,TranslateGraphicTooltipInfo as St,TranslateVertexZTooltipInfo as Tt,TranslateVertexXYTooltipInfo as wt,TranslateVertexTooltipInfo as Ht}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{makeElevationField as Vt}from"../../../../interactive/tooltip/fields/fields.js";import{autoArea2D as At}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoDistanceBetweenPoints2D as Lt,autoLength2D as Dt}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as jt,elevationFromPoint as kt}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Pt}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ut from"../../../../../geometry/SpatialReference.js";let Ct=class extends(n.EventedMixin(e)){constructor(t){super(t),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Yt.NONE,this._updatingHandles=new T,this._recreatingManipulators=!1,this._settings=new B({getTheme:()=>this.view.effectiveTheme}),this._latestTooltipInfo=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null,this._translateVertexTooltipInfo=null,this._translateVertexXYTooltipInfo=null,this._translateVertexZTooltipInfo=null,this._edgeOffsetTooltipInfo=null,this.outputGeometry=null,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:t,view:e}=this,i=this._settings.manipulators,n=i.vertex;this._vertexManipulatorMaterial=P(a(n.color),n.renderOccluded),this._vertexManipulatorOutlineMaterial=U(a(n.outlineColor),n.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=U(a(n.hoverOutlineColor),n.renderOccluded);const o=i.edge;this._edgeManipulatorMaterial=P(a(o.color),o.renderOccluded),this._edgeManipulatorOutlineMaterial=U(a(o.outlineColor),o.renderOccluded);const s=i.edgeOffset;this._edgeOffsetManipulatorMaterial=P(a(s.color),s.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(a(s.hoverColor),s.renderOccluded,!1);const r=i.selected;this._selectedManipulatorMaterial=P(a(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=U(a(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=U(a(r.hoverOutlineColor),r.renderOccluded);const l=this._graphicState=new lt({graphic:t});this.tooltip=new Et({view:e}),this.addHandles([m((()=>{const t=this._settings.manipulators;return{vertexSettings:t.vertex,edgeSettings:t.edge,edgeOffsetSettings:t.edgeOffset,selectedSettings:t.selected}}),(({vertexSettings:t,edgeSettings:e,edgeOffsetSettings:i,selectedSettings:a})=>{t.applyColor(this._vertexManipulatorMaterial),t.applyOutline(this._vertexManipulatorOutlineMaterial),t.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),e.applyColor(this._edgeManipulatorMaterial),e.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)})),m((()=>l.displaying),(t=>{for(const e of this._manipulatorInfos)e.manipulator.available=t})),m((()=>({labels:this._segmentLabels,enabled:this.sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:t,enabled:e,edgeOffsetEnabled:i})=>{null!=t&&(t.visible=e,t.edgeDistance=i?"far":"default")}),g),m((()=>this.sketchOptions.tooltips.effectiveEnabled),(t=>{this.tooltip.info=t?this._latestTooltipInfo:null}),g),this.view.trackGraphicState(l)])}destroy(){this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(t){this._recreateEditGeometryAndManipulators(t)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}removeSelectedVertices(){const t=this._manipulatorInfos.filter((t=>t.manipulator.selected&&"vertex"===t.type));this._removeVertices(t)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._graphicMoveManipulation=p(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(t){if(null==this._editGeometryOperations)return;const e=D(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=t?.byComponentIndex.get(i.index);for(const t of i.vertices){const i=a?.has(t.index);this._createVertexOrEdgeManipulator(t,e,i)}for(const t of i.edges)this._createVertexOrEdgeManipulator(t,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const t=this._editGeometryOperations.redo();return null!=t&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const t=this._editGeometryOperations.undo();return null!=t&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._hideTooltip(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(t){const e={byComponentIndex:new Map};if(null!=t&&null!=this.inputGeometry&&H(t,this.inputGeometry))for(const n of this._manipulatorInfos)if("vertex"===n.type&&n.manipulator.selected){const{index:t,component:{index:i}}=n.handle,{byComponentIndex:a}=e,o=a.get(i)||new Set;o.add(t),a.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._hideTooltip(),this._editGeometryOperations=p(this._editGeometryOperations),this._segmentLabels=p(this._segmentLabels),null==t)return void(this._recreatingManipulators=!1);const i="mesh"===t.type?t.anchor:t;this._editGeometryOperations=Mt.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(e);const a=this.sketchOptions.labels;this._segmentLabels=new R({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:D(this.graphic),labelOptions:a,graphic:this.graphic,graphicState:this._graphicState},visible:a.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(t,e){if("end"===e.action)return e;let i=0;const a=[],n=this._manipulatorInfos.some((t=>"vertex"===t.type&&t.manipulator.selected)),o=t===qt.SELECTED_OR_ALL&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);if(0===a.length)return e;this._moveVertices(a,e);if(a.length===i){if(this._updateEventState(Yt.MOVING),this.destroyed)return e;this.emit("move",{type:"move",dx:e.screenDeltaX,dy:e.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Yt.RESHAPING),this.destroyed)return e;this.emit("reshape",{type:"reshape",mover:this.graphic})}return e}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((t,e)=>"vertex"===e.type&&e.manipulator.selected?t+1:t),0)>1}_perVertexManipulatorDragAction(t){if(this._updateEventState(Yt.RESHAPING),this.destroyed)return;const{mapDeltaX:e,mapDeltaY:i,mapDeltaZ:a}=t;if(!e&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===t.info)&&n.push(o);this._moveVertices(n,t,yt.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(t){if(t===this._reshapeEventState)return!1;switch(t){case Yt.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Yt.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Yt.MOVING:switch(this._reshapeEventState){case Yt.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Yt.RESHAPING:switch(this._reshapeEventState){case Yt.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Yt.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const e=this._reshapeEventState!==t;return this._reshapeEventState=t,e}_createGraphicMoveManipulation(){const{tool:t,view:e}=this,i=this._graphicState;if(this._graphicMoveManipulation=new it({tool:t,view:e,graphicState:i}),this.enableMoveGraphic){let t=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((e,i,a)=>{i.next((t=>this._trackNumDragging(t))).next((e=>("start"===e.action&&(t=this._editGeometryOperations.createUndoGroup()),e))).next((t=>this._perGraphicManipulatorDragAction(qt.ALL,t))).next((t=>(this._updateTranslateGraphicTooltip($.XY,t),t))).next((e=>{"end"===e.action&&(this._hideTooltip(),t=h(t))})),a.next((()=>this._onDragCancel(!0,(()=>t=h(t)))))}))),this._graphicMoveManipulation.forEachManipulator((t=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(t,!1))))}else this._graphicMoveManipulation.forEachManipulator((t=>{t.grabbable=!1,t.cursor=null}));this._graphicMoveManipulation.forEachManipulator((t=>this._manipulatorHandles.add(t.events.on("immediate-click",(t=>{this._manipulatorInfos.some((t=>t.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()})))))}_createMoveManipulation(t){const{graphic:e,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new tt({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&K(e),snapToScene:!1,radius:tt.radiusForSymbol(e.symbol)}),this._moveManipulation.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(t)||this._manipulatorInfos.some((t=>t.manipulator.selected))||this.emit("immediate-click",{...i,graphic:e}),i.stopPropagation()})),this._watchAndUpdateGrabState(t,!1)])));const o=t=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{"focus"===e?this._updateTranslateTooltip(t):this._hideTooltip()})))};this._moveManipulation.xyManipulation.forEachManipulator(o($.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o($.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o($.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=e.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,s,r)=>{const{snappingStep:l,cancelSnapping:p}=Ot({predicate:t=>!!t.info,snappingManager:i.snappingManager,snappingContext:new xt({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:r,excludeFeature:e,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next((t=>(this._onDragCancel(),t))).next(p),{steps:o=o.next((t=>this._trackNumDragging(t))).next((t=>{const e=this._manipulatorInfos.filter((t=>"vertex"===t.type&&t.manipulator.selected));return t.manipulatorType===W.TRANSLATE_XY&&1===e.length?{...t,info:e[0],snapOrigin:e[0].handle.pos}:t})).next(ut(this.view,t,e)).next(...l).next(ct()).next((t=>this._perGraphicManipulatorDragAction(qt.SELECTED_OR_ALL,t))).next((t=>(this._updateTranslateTooltip(a,t),t))),cancel:s}}),t,s,e),m((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),g),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(t=>{this._updateMoveManipulationPosition();const e="align-move-manipulation";t?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),e):this.removeHandles(e)}),g)])}_createVisualElements(){const{graphic:t,view:e}=this,i=J({view:e,graphic:t,forEachManipulator:t=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(t),this._moveManipulation.forEachManipulator(t);for(const e of this._manipulatorInfos)t(e.manipulator,W.TRANSLATE_XY)}},onManipulatorsChanged:t=>this.on("manipulators-changed",t)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof rt?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(t,e=D(this.graphic)){if(t.component.vertices.length<=2)return null;const i=this._settings.manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,o=a/n,r=o*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=pt(this._edgeOffsetManipulatorMaterial,r,o/2,o/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=pt(this._edgeOffsetManipulatorMaterial,-r,o/2,o/2,i.height,-i.offset));const l=[new N(this._edgeOffsetManipulatorGeometryInside.instantiate(),ft.Unfocused),new N(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ft.Focused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate(),ft.Unfocused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ft.Focused)],p=new k({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==e.mode||j(this.graphic.symbol)?{mode:"absolute-height",offset:0}:e,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new k({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),u={manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:e,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(u,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(u);const c=[];for(const s of[t.leftVertex,t.rightVertex]){const t=this._getManipulatorInfoFromHandle(s);null!=t&&c.push(t.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(u))))}u.locationUpdateHandle=s(c),this._manipulatorHandles.add(u.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(mt(p,this._createEdgeOffsetPipeline(u,e)),p),this._manipulatorHandles.add(mt(h,((t,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(u,e)(t,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((t=>this._trackNumDragging(t))).next(gt(this.view,t.elevationAlignedLocation)).next(Z(this.view,t.elevationAlignedLocation,e,o,n)).next(_t()).next(ct()).next((t=>this._perGraphicManipulatorDragAction(qt.ALL,t))).next((t=>(this._updateTranslateGraphicTooltip($.XY,t),t))).next((t=>{"end"===t.action&&this._hideTooltip()})),a.next((()=>this._onDragCancel(!t.metadata.deleting)))}})),p);const m=t=>{this._manipulatorInfos.some((t=>t.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...t,graphic:this.graphic}),t.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",m),h.events.on("immediate-click",m),p.events.on("focus-changed",(({action:t})=>{const{sketchOptions:e,tooltip:i}=this;if("focus"===t){const t=this._edgeOffsetTooltipInfo??=new bt({sketchOptions:e});t.distance=d,t.sketchOptions=e,this._updateTooltipAreaOrTotalLength(t),this._latestTooltipInfo=t,i.info=e.tooltips.effectiveEnabled?this._latestTooltipInfo:null}else this._hideTooltip()}))],p),this._manipulatorInfos.push(u),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),u}_autoHideEdgeOffsetManipulator(t,e){const i=t.manipulator,a=t.edgeManipulator,n=()=>{t.visibilityHandle=h(t.visibilityHandle);const n=this._getManipulatorInfoFromHandle(t.handle.leftVertex),o=this._getManipulatorInfoFromHandle(t.handle.rightVertex),l=null!=n&&null!=o&&st(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<e;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,t.visibilityHandle=s([i.disableDisplay(),r((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r((()=>{h(t.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(t){this._updateManipulatorPosition(t);const{coordinateHelper:e}=this._editGeometryOperations.data,i=at(this.view,t.manipulator.elevationAlignedLocation,nt(e,t.handle,t.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(t.handle.leftVertex),n=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ot(i,o,s):M;t.manipulator.modelTransform=r,t.edgeManipulator.elevationAlignedLocation=t.manipulator.elevationAlignedLocation,t.edgeManipulator.modelTransform=r;const l=y(x(zt,o,s))/2;t.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(t,e){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:s}=this._initializeEdgeOffset(t,e);a.next((t=>this._trackNumDragging(t))).next(gt(this.view,i.elevationAlignedLocation)).next(o).next(z(this.view)).next(X(this.view,this._editGeometryOperations.data.spatialReference)).next(ct()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(t)).next(this._showEdgeOffsetTooltip()).next((t=>{"end"===t.action&&s()})),n.next((()=>{i.metadata.deleting||(s(),this._onDragCancel())}))}}_initializeEdgeOffset(t,e){const{view:i}=this,n=this._editGeometryOperations,o=nt(n.data.coordinateHelper,t.handle,e),r=n.createUndoGroup(),p=at(i,t.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const e=this._getManipulatorInfoFromHandle(t.handle.leftVertex.leftEdge);null!=e&&this._splitEdgeManipulator(e,1)}if(o.requiresSplitEdgeRight){const e=this._getManipulatorInfoFromHandle(t.handle.rightVertex.rightEdge);null!=e&&this._splitEdgeManipulator(e,0)}const d=()=>new w({paths:[[t.handle.leftVertex.pos,t.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),u=this._settings,c=new rt({view:i,isDraped:this._graphicState.isDraped,geometry:d(),elevationInfo:t.elevationInfo,width:u.visualElements.lineGraphics.outline.width,attached:!1,isDecoration:!0});let _;const f=()=>{this._cleanEdgeOffsetCollapsedEdges(t),_=h(_)},v=this.on("undo",f);return _=s([m((()=>a(this._accentColor)),(t=>c.color=t),g),l(c),m((()=>this._graphicState.isDraped),(t=>c.isDraped=t)),this._graphicState.on("changed",(()=>c.geometry=d())),r,v]),c.attached=!0,{step:t=>null==o||null==p?(f(),null):{...t,operation:o,plane:p},cleanup:f}}_applyEdgeOffsetStep(t){return e=>{if(this.destroyed||null==e.operation)return e;this._updateEventState(Yt.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=e;return(i||a||n)&&(this._offsetEdge(t,e),this.emit("reshape",{type:"reshape",mover:this.graphic})),e}}_applyComputeEdgeOffsetDistanceStep(){return t=>{const{operation:e,mapEnd:i}=t;return null==e||null==i?t:("start"===t.action&&e.selectArrowFromStartPoint(i),{...t,signedDistance:e.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return t=>{const{mapEnd:e,signedDistance:i,operation:a}=t,{tooltip:n,sketchOptions:o}=this;if(null!=i){const n=this._edgeOffsetTooltipInfo??=new bt({sketchOptions:o});n.sketchOptions=o,n.distance="end"===t.action?d:Rt(this._graphicState.isDraped,i*a.selectedArrow,e,a.plane,this._editGeometryOperations.data.coordinateHelper),this._updateTooltipAreaOrTotalLength(n),this._latestTooltipInfo=n}else this._latestTooltipInfo=null;return n.info=o.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t}}_cleanEdgeOffsetCollapsedEdges(t){const e=t.handle.leftVertex.leftEdge?.leftVertex,i=t.handle.leftVertex,a=t.handle.rightVertex.rightEdge?.rightVertex,n=t.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,s=[];if(e&&o.distance(e.pos,i.pos)<Xt){const t=this._getManipulatorInfoFromHandle(i);null!=t&&s.push(t)}if(o.distance(i.pos,n.pos)<Xt||a&&o.distance(a.pos,n.pos)<Xt){const t=this._getManipulatorInfoFromHandle(n);null!=t&&s.push(t)}s.length&&this._removeVertices(s)}_computeVertexManipulatorSizeAndOutline(t){const e=t.size/2,i=e+t.collisionPadding;return{size:e/i,outlineSize:(e+t.outlineSize)/i}}_createVertexOrEdgeManipulator(t,e=D(this.graphic),i=!1){const{view:a}=this,n=this._settings;if("edge"===t.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(t,e);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:t,outlineSize:e}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=ht(this._vertexManipulatorMaterial,t,16,16),this._vertexManipulatorOutlineGeometry=ht(this._vertexManipulatorOutlineMaterial,e,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:t,outlineSize:e}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=ht(this._edgeManipulatorMaterial,t,16,16),this._edgeManipulatorOutlineGeometry=ht(this._edgeManipulatorOutlineMaterial,e,16,16)}const{geometry:o}=this.graphic,r=o?.type,l="point"===r||"mesh"===r?[]:[new N(this._vertexManipulatorGeometry.instantiate(),Zt.Vertex|ft.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate(),Zt.Vertex|ft.Unfocused|ft.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Zt.Vertex|ft.Focused|ft.Unselected),new N(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),ft.Selected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),ft.Selected|ft.Unfocused),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),ft.Selected|ft.Focused)];this.enableMidpoints&&l.push(new N(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Zt.Edge|ft.Focused|ft.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Zt.Edge|ft.Focused|ft.Unselected),new N(this._edgeManipulatorGeometry.instantiate(),Zt.Edge|ft.Unfocused|ft.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate(),Zt.Edge|ft.Unfocused|ft.Unselected));const p=new k({view:a,renderObjects:l,elevationInfo:e,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});p.selected=i,this._setTypeSpecificManipulatorSettings(p,t,e);const d="edge"===t.type?{manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:p,handle:t,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(p),this._updateManipulatorPosition(d),"edge"===d.type){const t=[];for(const e of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(e);null!=i&&t.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=s(t),this._manipulatorHandles.add(d.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const u=mt(p,((t,i,a,n)=>{let o=null;const{snappingStep:s,cancelSnapping:r}=Ot({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new xt({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:n,excludeFeature:this.graphic,visualizer:new F}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((e=>(this._onDragCancel(!t.metadata.deleting,(()=>o=h(o))),e))).next(r),i.next((t=>this._trackNumDragging(t))).next((t=>{if("start"===t.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const e=this._splitEdgeManipulator(d);return{...t,info:e,snapOrigin:e.handle.pos}}return{...t,info:d,snapOrigin:d.handle.pos}})).next(gt(this.view,t.elevationAlignedLocation)).next(Y(this.view,this.graphic,t.elevationAlignedLocation,t.location.spatialReference,this.graphic)).next(ut(this.view,e,this.graphic)).next(...s).next(ct()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(o=h(o)),this._updateTranslateVertexTooltip(t,$.XY,e)}))}));return this._manipulatorHandles.add([u,p.events.on("immediate-click",(t=>this._manipulatorClickCallback(t,d))),p.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),p.events.on("focus-changed",(({action:t})=>{"focus"===t&&"edge"!==d.type?this._updateTranslateVertexTooltip(p,$.XY):this._hideTooltip()}))],p),this.emit("manipulators-changed"),d}_trackNumDragging(t){switch(t.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return t}_onDragCancel(t=!0,e){switch(this._numDragging--,t&&(this.undo(),this.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._hideTooltip(),this._reshapeEventState){case Yt.NONE:break;case Yt.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Yt.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(Yt.NONE)}_setTypeSpecificManipulatorSettings(t,e,i){const{graphic:a}=this,n=this._settings;switch(e.type){case"vertex":{t.state=Zt.Vertex,t.selectable=!0,t.cursor="move",t.collisionPriority=2;const{size:e,collisionPadding:o}=n.manipulators.vertex;t.radius=e/2+o,t.elevationInfo=i;const{geometry:s}=a,r=s?.type;t.interactive=null!=r&&"point"!==r&&"mesh"!==r;break}case"edge":{t.state=Zt.Edge,t.selectable=!1,t.cursor="copy",t.collisionPriority=-1;const{size:e,collisionPadding:o}=n.manipulators.edge;t.radius=e/2+o,t.elevationInfo="on-the-ground"!==i.mode||j(a.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(t,e){return t.events.on("grab-changed",(i=>this._onGrabStateChanged(t,e,i.action,i.pointerType)))}_onGrabStateChanged(t,e,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)e&&this._updateSelection(t),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Yt.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((t=>{const{manipulator:e}=t,{geometry:i}=this.graphic,a=i?.type;e.interactive=e.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in t&&(t.edgeManipulator.interactive=t.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((t=>{t.interactive=t.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const t of this._manipulatorInfos)t.manipulator.grabbing||(t.manipulator.selected=!1)}_updateSelection(t){t.grabbing&&!t.selected&&t.selectable&&(this._clearSelection(),t.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(t){null!=t&&(t.manipulator.metadata.deleting=!0,this.manipulators.remove(t.manipulator),this._manipulatorHandles.remove(t.manipulator),i(this._manipulatorInfos,t),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(t){if(t)for(const e of this._manipulatorInfos)if(t===e.handle)return e;return null}_updateManipulatorPosition(t){if(null==t)return;const e=this._editGeometryOperations;if("vertex"===t.type)t.manipulator.location=e.data.coordinateHelper.vectorToDehydratedPoint(t.handle.pos,Ft),t.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=t.manipulator.renderLocation);else if("edge"===t.type){const i=this._getManipulatorInfoFromHandle(t.handle.leftVertex),a=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if(null!=t.manipulator.elevationInfo&&"on-the-ground"===t.manipulator.elevationInfo.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;t.manipulator.location=L(r,l,p,e.data.spatialReference)}else O(zt,n.renderLocation,o.renderLocation,.5),t.manipulator.renderLocation=zt}}_splitEdgeManipulator(t,e=.5){const i=this._editGeometryOperations,a=i.splitEdge(t.handle,e).createdVertex;t.locationUpdateHandle=h(t.locationUpdateHandle);const n=D(this.graphic);let o;this.enableEdgeOffset?(this._removeManipulator(t),o=this._createVertexOrEdgeManipulator(a)):(o=t,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(t.manipulator,t.handle,n)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,$.XY),this._updateSelection(t.manipulator);const s=this._updateEventState(Yt.RESHAPING),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(Yt.NONE),o}_updateMoveManipulationPosition(){const t=b(zt,0,0,0);let e=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(e++,E(t,t,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===e){const t=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=t,this._moveManipulation.xyAxisManipulation.available=t,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=t,this._moveManipulation.zManipulation.available=t&&this.enableZShape&&K(this.graphic),this._moveManipulation.angle=q(this.graphic.geometry),this._moveManipulation.radius=tt.radiusForSymbol(this.graphic.symbol)}else{const t=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=t,this._moveManipulation.xyAxisManipulation.available=t,this._moveManipulation.zManipulation.available=t&&this.enableZVertex&&K(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=t&&1!==e;let i=0;if(null!=a){const t=a.handle.pos,e=null!=n?n.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;e&&o?this._moveManipulation.xyAxisManipulation.available=!1:e?i=Nt(e,t):o&&(i=Nt(t,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=Q}0!==e&&i?(G(t,t,1/e),Ft.spatialReference=this._editGeometryOperations.data.spatialReference,Ft.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(t,Ft),this._moveManipulation.elevationAlignedLocation=Ft):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(t){const e=new Array,i=this._editGeometryOperations;for(const a of t){const t=a.handle.component;if("vertex"===a.type&&i.canRemoveVertex(t)){e.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&t.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(t.edges[0]))}}if(e.length>0){const t=e.map((t=>{const e=i.data.components.indexOf(t.component);return{coordinates:i.data.coordinateHelper.vectorToArray(t.pos),componentIndex:e,vertexIndex:t.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Yt.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:t.map((t=>t.coordinates)),vertices:t}),this.destroyed)return;if(a&&(this._updateEventState(Yt.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(t,e,i=("start"===e.action?yt.NEW_STEP:yt.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(t.map((t=>t.handle)),e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of t)this._updateManipulatorPosition(n)}_offsetEdge(t,e){if(null==e.operation||null==e.signedDistance)return;const i=this._editGeometryOperations,a=e.operation.clone();a.distance=e.signedDistance,i.updateVertices([t.handle.leftVertex,t.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.rightVertex))}_manipulatorClickCallback(t,e){t.shiftKey||this._clearSelection(),"vertex"===e.type&&(e.manipulator.selected=!e.manipulator.selected,t.button===dt.Right&&this._removeVertices([e])),"edge"===e.type&&t.button===dt.Left&&this._splitEdgeManipulator(e),t.stopPropagation()}_updateTranslateTooltip(t,e){const i=this._manipulatorInfos.filter((t=>"vertex"===t.type&&t.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,t,e):this._updateTranslateGraphicTooltip(t,e)}_updateTranslateGraphicTooltip(t,e){const{sketchOptions:i,tooltip:a}=this;switch(t){case $.XY:this._latestTooltipInfo=this._translateGraphicTooltipInfo??=new St({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,((t,e)=>Lt(t,e)));break;case $.XY_AXIS:this._latestTooltipInfo=this._translateGraphicXYTooltipInfo??=new It({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,((t,i)=>u(Lt(t,i),et(e))));break;case $.Z:this._latestTooltipInfo=this._translateGraphicZTooltipInfo??=new Gt({sketchOptions:i}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,e,jt)}this._latestTooltipInfo.sketchOptions=i,a.info=i.tooltips.effectiveEnabled?this._latestTooltipInfo:null}_updateTranslateVertexTooltip(t,e,i){const{sketchOptions:a,tooltip:n}=this;switch(e){case $.XY:this._latestTooltipInfo=this._translateVertexTooltipInfo??=new Ht({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,((t,e)=>Lt(t,e))),this._updateTooltipAreaOrTotalLength(this._latestTooltipInfo);break;case $.XY_AXIS:this._latestTooltipInfo=this._translateVertexXYTooltipInfo??=new wt({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,((t,e)=>u(Lt(t,e),et(i)))),this._updateTooltipAreaOrTotalLength(this._latestTooltipInfo);break;case $.Z:this._latestTooltipInfo=this._translateVertexZTooltipInfo??=new Tt({sketchOptions:a}),this._updateTranslateTooltipDistance(this._latestTooltipInfo,i,jt)}const o=kt(t.location);this._latestTooltipInfo.elevation=null!=o?Vt({actual:o}):null,this._latestTooltipInfo.sketchOptions=a,n.info=a.tooltips.effectiveEnabled?this._latestTooltipInfo:null}_updateTranslateTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:n}=e,o=i(a,n);t.distance=null!=o?o:d}else t.distance=d}_updateTooltipAreaOrTotalLength(t){const{geometry:e}=this.graphic;if(null==e)return t.area=null,void(t.totalLength=null);t.area="polygon"===e.type?At(e):null,t.totalLength="polyline"===e.type?Dt(e):null}_hideTooltip(){this.tooltip.clear(),this._latestTooltipInfo=null}get test(){return{segmentLabels:this._segmentLabels,manipulatorInfos:this._manipulatorInfos}}};function Nt(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])+Math.PI/2}function Rt(t,e,i,a,n){if(t){const t=n.toXYZ(n.pointToVector(i)),o=V(a,t,A.get()),s=Pt(o,t,n.spatialReference);if(null!=s)return c(s.value*Math.sign(e),s.unit)}return c(e*_(i.spatialReference),"meters")}t([f()],Ct.prototype,"_editGeometryOperations",void 0),t([f()],Ct.prototype,"_segmentLabels",void 0),t([f({constructOnly:!0})],Ct.prototype,"tool",void 0),t([f()],Ct.prototype,"tooltip",void 0),t([f()],Ct.prototype,"inputGeometry",null),t([f()],Ct.prototype,"outputGeometry",void 0),t([f({readOnly:!0})],Ct.prototype,"updating",null),t([f()],Ct.prototype,"manipulators",null),t([f()],Ct.prototype,"view",null),t([f()],Ct.prototype,"graphic",null),t([f()],Ct.prototype,"enableZShape",null),t([f()],Ct.prototype,"enableZVertex",null),t([f()],Ct.prototype,"enableMoveGraphic",null),t([f()],Ct.prototype,"enableMidpoints",null),t([f()],Ct.prototype,"enableEdgeOffset",null),t([f()],Ct.prototype,"sketchOptions",null),t([f()],Ct.prototype,"_accentColor",null),Ct=t([v("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Ct);const Ft=L(0,0,void 0,Ut.WGS84),zt=S(),Xt=1e-6;var Zt,Yt,qt;!function(t){t.Vertex=vt.Custom1,t.Edge=vt.Custom2}(Zt||(Zt={})),function(t){t[t.NONE=0]="NONE",t[t.MOVING=1]="MOVING",t[t.RESHAPING=2]="RESHAPING"}(Yt||(Yt={})),function(t){t[t.ALL=0]="ALL",t[t.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(qt||(qt={}));export{Ct as ReshapeOperation};
@@ -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{createRenderScreenPointArray3 as e}from"../../../../../core/screenUtils.js";import{fromValues as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as o,D as n,o as t,f as s}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getNormal as i,fromPositionAndNormal as l,create as d}from"../../../../../geometry/support/plane.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{PlaneType as u,OffsetEdgeVertex as a}from"../../../../interactive/editGeometry/operations/OffsetEdgeVertex.js";function m(e,r,o){const n="on-the-ground"===o.mode?u.XY:u.XYZ;return new a(e,n,r,0)}function p(e,r,n){const t=c();if(!e.renderCoordsHelper.toRenderCoords(r,t))return null;const s=j(e,r,i(n.plane)),f=j(e,r,n.edgeDirection);if(null==s||null==f)return null;const u=o(c(),s,f);return l(t,u,d())}function j(e,r,o){const t=f(r.x+o[0],r.y+o[1],r.z+o[2],r.spatialReference),s=c(),i=c();return e.renderCoordsHelper.toRenderCoords(r,s)&&e.renderCoordsHelper.toRenderCoords(t,i)?n(i,s,i):null}function g(e,t,s){const l=i(e),d=n(c(),t,s),f=o(c(),d,l),u=o(c(),d,f);return r(d[0],d[1],d[2],0,f[0],f[1],f[2],0,u[0],u[1],u[2],0,0,0,0,1)}function C(r,o,n){const c=n.projectToRenderScreen(r,e()),i=n.projectToRenderScreen(o,e());return null!=c&&null!=i?t(s(c,c,i)):0}export{p as createEdgeOffsetIntersectionPlane,m as createEdgeOffsetOperation,g as edgeOffsetRotationMatrix,C as screenEdgeLengthSquared};
5
+ import{createRenderScreenPointArray3 as e}from"../../../../../core/screenUtils.js";import{fromValues as r}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{b as o,E as n,p as t,f as s}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getNormal as i,fromPositionAndNormal as l,create as d}from"../../../../../geometry/support/plane.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{PlaneType as u,OffsetEdgeVertex as p}from"../../../../interactive/editGeometry/operations/OffsetEdgeVertex.js";function a(e,r,o){const n="on-the-ground"===o.mode?u.XY:u.XYZ;return new p(e,n,r,0)}function m(e,r,n){const t=c();if(!e.renderCoordsHelper.toRenderCoords(r,t))return null;const s=j(e,r,i(n.plane)),f=j(e,r,n.edgeDirection);if(null==s||null==f)return null;const u=o(c(),s,f);return l(t,u,d())}function j(e,r,o){const t=f(r.x+o[0],r.y+o[1],r.z+o[2],r.spatialReference),s=c(),i=c();return e.renderCoordsHelper.toRenderCoords(r,s)&&e.renderCoordsHelper.toRenderCoords(t,i)?n(i,s,i):null}function g(e,t,s){const l=i(e),d=n(c(),t,s),f=o(c(),d,l),u=o(c(),d,f);return r(d[0],d[1],d[2],0,f[0],f[1],f[2],0,u[0],u[1],u[2],0,0,0,0,1)}function C(r,o,n){const c=n.projectToRenderScreen(r,e()),i=n.projectToRenderScreen(o,e());return null!=c&&null!=i?t(s(c,c,i)):0}export{m as createEdgeOffsetIntersectionPlane,a as createEdgeOffsetOperation,g as edgeOffsetRotationMatrix,C as screenEdgeLengthSquared};
@@ -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{set as t,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as i,q as a,f as r,l as o,j as n}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as l,c as p}from"../../../../../chunks/boundedPlane.js";import{intersectRay as h}from"../../../../../geometry/support/plane.js";import{sv3d as d}from"../../../../../geometry/support/vectorStacks.js";import{ResizeManipulator as u}from"../../../analysis/Slice/ResizeManipulator.js";import{updateResizeHandle as m,isDiagonalResizeHandle as S,calculateDiagonalResizeHandleScale as _}from"../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as g}from"../dragEventPipeline3D.js";import{ManipulatorType as y}from"../ManipulatorType.js";import{mapPlaneAutoSize2D as f}from"./extentUtils.js";import{fromScreenNormalized as z}from"../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as x}from"../../../../interactive/dragEventPipeline.js";import{AccumulationBehavior as M}from"../../../../interactive/editGeometry/interfaces.js";import{AccumulationType as v}from"../../../../interactive/editGeometry/operations/UpdateVertices.js";import{apply as b}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import{ExtentScaleTooltipInfo as B}from"../../../../interactive/tooltip/ExtentTooltipInfos.js";class j{get zMax(){if(!this._zMaxDirty)return this._zMax;const t=this._editGeometryOperations.data;if(t.geometry.hasZ){const e=t.coordinateHelper;this._zMax=Number.NEGATIVE_INFINITY;for(const s of t.components)for(const t of s.vertices){const s=e.getZ(t.pos)??0;this._zMax=Math.max(s,this._zMax)}}else this._zMax=0;return this._zMaxDirty=!1,this._zMax}constructor(e,i,a,r,o){this._tool=e,this._graphicState=i,this._editGeometryOperations=a,this._bounds=r,this._preserveAspectRatioStep=o,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._scaleTooltipInfo=null,this._displayBoundsStart=l(),this._displayBoundsMarginStart=0,this._startScale=s(),this._endScale=s(),this._sizeStart=null,this._zMax=0,this._zMaxDirty=!0;const n=this._tool,c=n.view;this.resizeManipulators=this._resizeHandles.map((t=>{const e=new u(c,t);return n.addHandles([e.events.on("grab-changed",(t=>this._onResizeGrab(t))),this._createResizeDragPipeline(e,t)]),e})),n.manipulators.addMany(this.resizeManipulators),n.addHandles([n.on("graphic-scale-start",(e=>{t(this._startScale,e.xScale,e.yScale),t(this._endScale,e.xScale,e.yScale)})),n.on("graphic-scale",(e=>{t(this._endScale,e.xScale,e.yScale)})),n.on("graphic-scale-stop",(()=>{t(this._startScale,0,0),t(this._endScale,0,0)})),this._graphicState.on("changed",(()=>{"resize"!==n.inputState?.type&&(this._zMaxDirty=!0)}))])}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()}))}forEachManipulator(t){this.resizeManipulators.forEach((e=>t(e,y.SCALE)))}updateManipulators(t,e){this.resizeManipulators.forEach(((s,i)=>{m(s,this._resizeHandles[i],t,e)}))}getUpdatedTooltipInfo(){return this.resizeManipulators.some((t=>t.focused))?this._computeScaleTooltipInfo():null}_computeScaleTooltipInfo(){const t=this._tool,e=this._scaleTooltipInfo??=new B({sketchOptions:t.sketchOptions}),s=t.graphic.geometry;if(null==s)return null;const i=f(this._bounds.mapBounds,this.zMax,s.spatialReference);return null==i?null:(e.xSize=i.xSize,e.ySize=i.ySize,null!=this._sizeStart&&this.resizeManipulators.some((t=>t.dragging))?(e.xScale=i.xSize.value/this._sizeStart.xSize.value,e.yScale=i.ySize.value/this._sizeStart.ySize.value):(e.xScale=1,e.yScale=1),e)}_onResizeGrab({action:t,screenPoint:e}){const s=this._tool,i=this._bounds;if("start"!==t||!e||!s.graphic.geometry)return;const a=z(s.view.state.camera,e);h(i.displayBounds.plane,a,d.get())&&(i.backupMapBounds(),p(i.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=i.displayBoundsMargin,this._sizeStart=f(i.mapBoundsStart,this.zMax,s.graphic.geometry.spatialReference),s.inputState={type:"resize"})}_createResizeDragPipeline(t,e){const s=this._tool,i=s.graphic;return x(t,((t,a,r)=>{null!=s.inputState&&(a.next((t=>("start"===t.action&&s.emit("graphic-scale-start",{graphic:i,xScale:1,yScale:1}),t))).next(g(s.view,this._displayBoundsStart.plane)).next((t=>({...t,handle:e}))).next(this._resizeDragRenderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(this._resizeDragUpdateGeometry()).next((t=>{const e={graphic:i,xScale:t.factor1,yScale:t.factor2};switch(t.action){case"start":case"update":s.emit("graphic-scale",e);break;case"end":s.inputState=null,s.emit("graphic-scale-stop",e)}return t})),r.next((()=>{null!=s.inputState&&s.emit("graphic-scale-stop",{graphic:i,xScale:1,yScale:1}),s.cancel()})))}))}_resizeDragRenderPlaneToFactors(){const t=this._bounds;return e=>{const s=this._displayBoundsStart,c=e.handle.direction,l=t.displayBoundsMargin,p=this._displayBoundsMarginStart,h=i(d.get(),s.origin);a(h,h,s.basis1,-c[0]),a(h,h,s.basis2,-c[1]);const u=r(d.get(),e.renderEnd,h),m=r(d.get(),e.renderStart,h),g=S(e.handle),y=_(s),f=_(t.displayBounds)/y,z=(t,e)=>{if(0===t)return 1;let s=o(e),i=.5*t*n(e,u)/s;const a=i<0?-1:1;if(g){i+=(s-.5*t*n(e,m)/s)*a*f}const r=s<1.5*p?1:E;return s=Math.max(s-p,E),a>0&&(i-=l),a*Math.max(a*(i/s),r)};return{...e,factor1:z(c[0],s.basis1),factor2:z(c[1],s.basis2)}}}_resizeDragUpdateGeometry(){const r=this._tool,o=this._bounds;return n=>{const l=i(c(),o.mapBoundsStart.origin);a(l,l,o.mapBoundsStart.basis1,-n.handle.direction[0]),a(l,l,o.mapBoundsStart.basis2,-n.handle.direction[1]);const h=t(s(),o.mapBoundsStart.basis1[0],o.mapBoundsStart.basis1[1]);e(h,h);const d=[];for(const t of this._editGeometryOperations.data.components)d.push(...t.vertices);const u="start"===n.action?M.NEW_STEP:M.ACCUMULATE_STEPS,m=this._editGeometryOperations.scaleVertices(d,l,h,n.factor1,n.factor2,u,v.REPLACE);return p(o.mapBoundsStart,o.mapBounds),b(m,o.mapBounds),r.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}const E=1e-6;export{j as ExtentScale,E as scaleEpsilon};
5
+ import{set as t,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as i,r as a,f as r,l as o,k as n}from"../../../../../chunks/vec32.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as l,c as p}from"../../../../../chunks/boundedPlane.js";import{intersectRay as h}from"../../../../../geometry/support/plane.js";import{sv3d as d}from"../../../../../geometry/support/vectorStacks.js";import{ResizeManipulator as u}from"../../../analysis/Slice/ResizeManipulator.js";import{updateResizeHandle as m,isDiagonalResizeHandle as S,calculateDiagonalResizeHandleScale as _}from"../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as g}from"../dragEventPipeline3D.js";import{ManipulatorType as y}from"../ManipulatorType.js";import{mapPlaneAutoSize2D as f}from"./extentUtils.js";import{fromScreenNormalized as z}from"../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as x}from"../../../../interactive/dragEventPipeline.js";import{AccumulationBehavior as M}from"../../../../interactive/editGeometry/interfaces.js";import{AccumulationType as v}from"../../../../interactive/editGeometry/operations/UpdateVertices.js";import{apply as b}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import{ExtentScaleTooltipInfo as B}from"../../../../interactive/tooltip/ExtentTooltipInfos.js";class j{get zMax(){if(!this._zMaxDirty)return this._zMax;const t=this._editGeometryOperations.data;if(t.geometry.hasZ){const e=t.coordinateHelper;this._zMax=Number.NEGATIVE_INFINITY;for(const s of t.components)for(const t of s.vertices){const s=e.getZ(t.pos)??0;this._zMax=Math.max(s,this._zMax)}}else this._zMax=0;return this._zMaxDirty=!1,this._zMax}constructor(e,i,a,r,o){this._tool=e,this._graphicState=i,this._editGeometryOperations=a,this._bounds=r,this._preserveAspectRatioStep=o,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._scaleTooltipInfo=null,this._displayBoundsStart=l(),this._displayBoundsMarginStart=0,this._startScale=s(),this._endScale=s(),this._sizeStart=null,this._zMax=0,this._zMaxDirty=!0;const n=this._tool,c=n.view;this.resizeManipulators=this._resizeHandles.map((t=>{const e=new u(c,t);return n.addHandles([e.events.on("grab-changed",(t=>this._onResizeGrab(t))),this._createResizeDragPipeline(e,t)]),e})),n.manipulators.addMany(this.resizeManipulators),n.addHandles([n.on("graphic-scale-start",(e=>{t(this._startScale,e.xScale,e.yScale),t(this._endScale,e.xScale,e.yScale)})),n.on("graphic-scale",(e=>{t(this._endScale,e.xScale,e.yScale)})),n.on("graphic-scale-stop",(()=>{t(this._startScale,0,0),t(this._endScale,0,0)})),this._graphicState.on("changed",(()=>{"resize"!==n.inputState?.type&&(this._zMaxDirty=!0)}))])}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()}))}forEachManipulator(t){this.resizeManipulators.forEach((e=>t(e,y.SCALE)))}updateManipulators(t,e){this.resizeManipulators.forEach(((s,i)=>{m(s,this._resizeHandles[i],t,e)}))}getUpdatedTooltipInfo(){return this.resizeManipulators.some((t=>t.focused))?this._computeScaleTooltipInfo():null}_computeScaleTooltipInfo(){const t=this._tool,e=this._scaleTooltipInfo??=new B({sketchOptions:t.sketchOptions}),s=t.graphic.geometry;if(null==s)return null;const i=f(this._bounds.mapBounds,this.zMax,s.spatialReference);return null==i?null:(e.xSize=i.xSize,e.ySize=i.ySize,null!=this._sizeStart&&this.resizeManipulators.some((t=>t.dragging))?(e.xScale=i.xSize.value/this._sizeStart.xSize.value,e.yScale=i.ySize.value/this._sizeStart.ySize.value):(e.xScale=1,e.yScale=1),e)}_onResizeGrab({action:t,screenPoint:e}){const s=this._tool,i=this._bounds;if("start"!==t||!e||!s.graphic.geometry)return;const a=z(s.view.state.camera,e);h(i.displayBounds.plane,a,d.get())&&(i.backupMapBounds(),p(i.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=i.displayBoundsMargin,this._sizeStart=f(i.mapBoundsStart,this.zMax,s.graphic.geometry.spatialReference),s.inputState={type:"resize"})}_createResizeDragPipeline(t,e){const s=this._tool,i=s.graphic;return x(t,((t,a,r)=>{null!=s.inputState&&(a.next((t=>("start"===t.action&&s.emit("graphic-scale-start",{graphic:i,xScale:1,yScale:1}),t))).next(g(s.view,this._displayBoundsStart.plane)).next((t=>({...t,handle:e}))).next(this._resizeDragRenderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(this._resizeDragUpdateGeometry()).next((t=>{const e={graphic:i,xScale:t.factor1,yScale:t.factor2};switch(t.action){case"start":case"update":s.emit("graphic-scale",e);break;case"end":s.inputState=null,s.emit("graphic-scale-stop",e)}return t})),r.next((()=>{null!=s.inputState&&s.emit("graphic-scale-stop",{graphic:i,xScale:1,yScale:1}),s.cancel()})))}))}_resizeDragRenderPlaneToFactors(){const t=this._bounds;return e=>{const s=this._displayBoundsStart,c=e.handle.direction,l=t.displayBoundsMargin,p=this._displayBoundsMarginStart,h=i(d.get(),s.origin);a(h,h,s.basis1,-c[0]),a(h,h,s.basis2,-c[1]);const u=r(d.get(),e.renderEnd,h),m=r(d.get(),e.renderStart,h),g=S(e.handle),y=_(s),f=_(t.displayBounds)/y,z=(t,e)=>{if(0===t)return 1;let s=o(e),i=.5*t*n(e,u)/s;const a=i<0?-1:1;if(g){i+=(s-.5*t*n(e,m)/s)*a*f}const r=s<1.5*p?1:E;return s=Math.max(s-p,E),a>0&&(i-=l),a*Math.max(a*(i/s),r)};return{...e,factor1:z(c[0],s.basis1),factor2:z(c[1],s.basis2)}}}_resizeDragUpdateGeometry(){const r=this._tool,o=this._bounds;return n=>{const l=i(c(),o.mapBoundsStart.origin);a(l,l,o.mapBoundsStart.basis1,-n.handle.direction[0]),a(l,l,o.mapBoundsStart.basis2,-n.handle.direction[1]);const h=t(s(),o.mapBoundsStart.basis1[0],o.mapBoundsStart.basis1[1]);e(h,h);const d=[];for(const t of this._editGeometryOperations.data.components)d.push(...t.vertices);const u="start"===n.action?M.NEW_STEP:M.ACCUMULATE_STEPS,m=this._editGeometryOperations.scaleVertices(d,l,h,n.factor1,n.factor2,u,v.REPLACE);return p(o.mapBoundsStart,o.mapBounds),b(m,o.mapBounds),r.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}const E=1e-6;export{j as ExtentScale,E as scaleEpsilon};
@@ -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{getMetersPerCartesianUnitForSR as s,getMetersPerUnitForSR as t}from"../../../../../core/unitUtils.js";import{scale as i}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as o,f as e,k as a,b as r,n,h as c,j as p,l,q as m}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as u,u as b}from"../../../../../chunks/boundedPlane.js";import{sv3d as h}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as f}from"../../../../../support/elevationInfoUtils.js";import{mainAxis as B}from"../geometryUtils.js";import{evaluateElevationAlignmentAtPoint as y}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as v}from"../../../layers/graphics/ElevationContext.js";import{calculateOrientedBounds as j}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import{autoSize2D as R}from"../../../../support/extentUtils.js";class C{constructor(s,t,i){this._tool=s,this._onDisplayBoundsChanged=t,this.mapBounds=g(),this.mapBoundsStart=g(),this.displayBounds=g(),this._calculateMapBounds(i)}get displayBoundsMargin(){const{view:s,graphic:t}=this._tool,i=s.pointsOfInterest?.centerOnSurfaceFrequent.location??t.geometry?.extent?.center;return i?_*s.pixelSizeAt(i):0}backupMapBounds(){u(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged()}_calculateMapBounds(o){const{view:e,attachmentOrigin:a}=this._tool,r=o.geometry,n=B(r);i(n,n,-1);const c=e.spatialReference,p=r.spatialReference,l=a?e.pixelSizeAt(a)*s(c)/t(p):0;j(n,o,x*l,this.mapBounds)}_calculateDisplayBounds(){const{view:s,attachmentOrigin:t,graphic:i}=this._tool;if(!i.geometry)return;const o=t?.z??y(this.mapBounds.origin,s.elevationProvider,v.fromElevationInfo(f(i)),s.renderCoordsHelper),e=u(this.mapBounds);e.origin[2]=o??0,S(e,s.renderCoordsHelper,i.geometry.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const _=10,x=80;function S(s,t,i,m=0,d){d||(d=g()),t.toRenderCoords(s.origin,i,d.origin);const u=h.get();o(u,s.origin,s.basis1),o(u,u,s.basis2),t.toRenderCoords(u,i,u);const f=h.get();o(f,s.origin,s.basis1),e(f,f,s.basis2),t.toRenderCoords(f,i,f);const B=h.get();e(B,s.origin,s.basis1),e(B,B,s.basis2),t.toRenderCoords(B,i,B);const y=h.get();e(y,s.origin,s.basis1),o(y,y,s.basis2),t.toRenderCoords(y,i,y);const v=a(h.get(),u,f,.5);e(v,v,d.origin);const j=a(h.get(),B,y,.5);e(j,d.origin,j),a(d.basis1,v,j,.5);const R=a(h.get(),y,u,.5);e(R,R,d.origin);const C=a(h.get(),f,B,.5);e(C,d.origin,C),a(d.basis2,R,C,.5);const _=r(h.get(),d.basis1,d.basis2),x=r(_,_,d.basis1);return n(x,x),c(d.basis2,x,p(d.basis2,x)),c(d.basis1,d.basis1,1+m/l(d.basis1)),c(d.basis2,d.basis2,1+m/l(d.basis2)),b(d),d}function U(s,t,i){return e(O,e(O,s.origin,s.basis1),s.basis2),m(M,O,s.basis1,2),m(D,M,s.basis2,2),m(k,O,s.basis2,2),O[2]=M[2]=D[2]=k[2]=t,R({topLeft:k,topRight:D,bottomRight:M,bottomLeft:O,spatialReference:i})}const k=d(),D=d(),M=d(),O=d();export{C as TransformBounds,U as mapPlaneAutoSize2D};
5
+ import{getMetersPerCartesianUnitForSR as s,getMetersPerUnitForSR as t}from"../../../../../core/unitUtils.js";import{scale as i}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as o,f as e,m as r,b as a,n,h as c,k as p,l,r as m}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as u,u as b}from"../../../../../chunks/boundedPlane.js";import{sv3d as h}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as f}from"../../../../../support/elevationInfoUtils.js";import{mainAxis as B}from"../geometryUtils.js";import{evaluateElevationAlignmentAtPoint as y}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as v}from"../../../layers/graphics/ElevationContext.js";import{calculateOrientedBounds as j}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import{autoSize2D as R}from"../../../../support/extentUtils.js";class C{constructor(s,t,i){this._tool=s,this._onDisplayBoundsChanged=t,this.mapBounds=g(),this.mapBoundsStart=g(),this.displayBounds=g(),this._calculateMapBounds(i)}get displayBoundsMargin(){const{view:s,graphic:t}=this._tool,i=s.pointsOfInterest?.centerOnSurfaceFrequent.location??t.geometry?.extent?.center;return i?_*s.pixelSizeAt(i):0}backupMapBounds(){u(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged()}_calculateMapBounds(o){const{view:e,attachmentOrigin:r}=this._tool,a=o.geometry,n=B(a);i(n,n,-1);const c=e.spatialReference,p=a.spatialReference,l=r?e.pixelSizeAt(r)*s(c)/t(p):0;j(n,o,x*l,this.mapBounds)}_calculateDisplayBounds(){const{view:s,attachmentOrigin:t,graphic:i}=this._tool;if(!i.geometry)return;const o=t?.z??y(this.mapBounds.origin,s.elevationProvider,v.fromElevationInfo(f(i)),s.renderCoordsHelper),e=u(this.mapBounds);e.origin[2]=o??0,S(e,s.renderCoordsHelper,i.geometry.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const _=10,x=80;function S(s,t,i,m=0,d){d||(d=g()),t.toRenderCoords(s.origin,i,d.origin);const u=h.get();o(u,s.origin,s.basis1),o(u,u,s.basis2),t.toRenderCoords(u,i,u);const f=h.get();o(f,s.origin,s.basis1),e(f,f,s.basis2),t.toRenderCoords(f,i,f);const B=h.get();e(B,s.origin,s.basis1),e(B,B,s.basis2),t.toRenderCoords(B,i,B);const y=h.get();e(y,s.origin,s.basis1),o(y,y,s.basis2),t.toRenderCoords(y,i,y);const v=r(h.get(),u,f,.5);e(v,v,d.origin);const j=r(h.get(),B,y,.5);e(j,d.origin,j),r(d.basis1,v,j,.5);const R=r(h.get(),y,u,.5);e(R,R,d.origin);const C=r(h.get(),f,B,.5);e(C,d.origin,C),r(d.basis2,R,C,.5);const _=a(h.get(),d.basis1,d.basis2),x=a(_,_,d.basis1);return n(x,x),c(d.basis2,x,p(d.basis2,x)),c(d.basis1,d.basis1,1+m/l(d.basis1)),c(d.basis2,d.basis2,1+m/l(d.basis2)),b(d),d}function U(s,t,i){return e(O,e(O,s.origin,s.basis1),s.basis2),m(M,O,s.basis1,2),m(D,M,s.basis2,2),m(k,O,s.basis2,2),O[2]=M[2]=D[2]=k[2]=t,R({topLeft:k,topRight:D,bottomRight:M,bottomLeft:O,spatialReference:i})}const k=d(),D=d(),M=d(),O=d();export{C as TransformBounds,U as mapPlaneAutoSize2D};
@@ -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"../../../../core/has.js";import{c as e,f as t,i as r,E as s}from"../../../../chunks/vec32.js";import{create as i,fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a,c as o}from"../../../../chunks/vec42.js";import{fromValues as l,clone as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as d,fromRay as _,getStart as c,getEnd as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as u}from"../../../../geometry/support/frustum.js";import{create as f,fromPoints as m,pointAt as y}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as D}from"./EngineVisualElement.js";import{LaserlineVisualElement as O}from"./LaserlineVisualElement.js";import{drapedZ as w}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as A}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as j}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends D{constructor(e){super(e),this._ray=g(),this._isWorldDown=!1,this._start=i(),this._end=n(1,0,0),this._width=1,this._color=l(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=l(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=V.LINE,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparent,this._fadedExtensions=T,this._laserline=new O({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>this._recreateDrapedGeometry(e)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(r){this._isWorldDown=!0,e(this._start,r),this.view.renderCoordsHelper.worldUpAtPosition(r,this._end),t(this._end,r,this._end),b(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,r(this._start,t)||(e(this._start,t),b(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,r(this._end,t)||(e(this._end,t),b(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){null!=e&&null!=this._stippleOffColor&&a(e,this._stippleOffColor)||(this._stippleOffColor=null!=e?h(e):null,this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&null!=this._laserlineStyle&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??T,this.recreateGeometry()}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,hasPolygonOffset:this._polygonOffset,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){const t=new x(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_destroyExternalResources(e){e.geometries=[]}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const s=this._createGeometry(e);r.push(s),t.addGeometry(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new x(this.materialParameters);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){const t=this._createGeometry(e);return this._updateVerticesDraped(t),new A(t)}_createGeometry(e){const t=this.extensionType===V.FADED,r=t?[i(),i(),i(),i()]:[i(),i()];return E(e,r,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===V.FADED?this._updateLineSegmentFinite(S):this._updateLineSegmentInfinite(this._extensionType,S)}_updateLineSegmentFinite(e){return m(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){const r=this.view.state.camera;switch(_(this._ray,G),e){case V.LINE:G.c0=-Number.MAX_VALUE;break;case V.RAY:case V.GROUND_RAY:{const e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,"ground")??0,r=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&r<t&&s(G.ray.direction,G.ray.direction),this._extensionType===V.GROUND_RAY&&null!=t&&(G.c1=Math.abs(r-t));break}}if(!u(r.frustum,G))return this._updateLineSegmentFinite(t);const i=c(G,P),n=p(G,v);return m(i,n,t)}_updateVertexAttributesObject3D(e,t){const r=e.geometries[0].getMutableAttribute(j.POSITION)?.data;if(!r)return;let s=0;for(const i of this._lineVertices(t))r[s++]=i[0],r[s++]=i[1],r[s++]=i[2];e.geometryVertexAttributeUpdated(e.geometries[0],j.POSITION)}_updateVertexAttributesDraped(e,t){const r=e.getMutableAttribute(j.POSITION)?.data;if(!r)return;let s=0;for(const i of this._lineVertices(t))r[s++]=i[0],r[s++]=i[1],r[s++]=w;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===V.FADED?(yield y(e,-this.fadedExtensions.start,P),yield y(e,0,P),yield y(e,1,P),yield y(e,1+this.fadedExtensions.end,P)):(yield y(e,0,P),yield y(e,1,P))}}const G=d(),P=i(),v=i(),S=f();var V;!function(e){e[e.LINE=0]="LINE",e[e.RAY=1]="RAY",e[e.GROUND_RAY=2]="GROUND_RAY",e[e.FADED=3]="FADED"}(V||(V={}));const M=1/3,T={start:M,end:M};export{C as ExtendedLineVisualElement,V as ExtensionType};
5
+ import"../../../../core/has.js";import{c as e,f as t,j as r,F as s}from"../../../../chunks/vec32.js";import{create as i,fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a,c as o}from"../../../../chunks/vec42.js";import{fromValues as l,clone as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as d,fromRay as _,getStart as c,getEnd as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as u}from"../../../../geometry/support/frustum.js";import{create as f,fromPoints as m,pointAt as y}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPoints as b}from"../../../../geometry/support/ray.js";import{EngineVisualElement as D}from"./EngineVisualElement.js";import{LaserlineVisualElement as O}from"./LaserlineVisualElement.js";import{drapedZ as w}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as A}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends D{constructor(e){super(e),this._ray=g(),this._isWorldDown=!1,this._start=i(),this._end=n(1,0,0),this._width=1,this._color=l(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=l(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=V.LINE,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparent,this._fadedExtensions=T,this._laserline=new O({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>this._recreateDrapedGeometry(e)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(r){this._isWorldDown=!0,e(this._start,r),this.view.renderCoordsHelper.worldUpAtPosition(r,this._end),t(this._end,r,this._end),b(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,r(this._start,t)||(e(this._start,t),b(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,r(this._end,t)||(e(this._end,t),b(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){null!=e&&null!=this._stippleOffColor&&a(e,this._stippleOffColor)||(this._stippleOffColor=null!=e?h(e):null,this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&null!=this._laserlineStyle&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??T,this.recreateGeometry()}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,hasPolygonOffset:this._polygonOffset,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){const t=new x(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_destroyExternalResources(e){e.geometries=[]}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const s=this._createGeometry(e);r.push(s),t.addGeometry(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new x(this.materialParameters);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){const t=this._createGeometry(e);return this._updateVerticesDraped(t),new j(t)}_createGeometry(e){const t=this.extensionType===V.FADED,r=t?[i(),i(),i(),i()]:[i(),i()];return E(e,r,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===V.FADED?this._updateLineSegmentFinite(S):this._updateLineSegmentInfinite(this._extensionType,S)}_updateLineSegmentFinite(e){return m(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){const r=this.view.state.camera;switch(_(this._ray,G),e){case V.LINE:G.c0=-Number.MAX_VALUE;break;case V.RAY:case V.GROUND_RAY:{const e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,"ground")??0,r=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&r<t&&s(G.ray.direction,G.ray.direction),this._extensionType===V.GROUND_RAY&&null!=t&&(G.c1=Math.abs(r-t));break}}if(!u(r.frustum,G))return this._updateLineSegmentFinite(t);const i=c(G,P),n=p(G,v);return m(i,n,t)}_updateVertexAttributesObject3D(e,t){const r=e.geometries[0].getMutableAttribute(A.POSITION)?.data;if(!r)return;let s=0;for(const i of this._lineVertices(t))r[s++]=i[0],r[s++]=i[1],r[s++]=i[2];e.geometryVertexAttributeUpdated(e.geometries[0],A.POSITION)}_updateVertexAttributesDraped(e,t){const r=e.getMutableAttribute(A.POSITION)?.data;if(!r)return;let s=0;for(const i of this._lineVertices(t))r[s++]=i[0],r[s++]=i[1],r[s++]=w;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===V.FADED?(yield y(e,-this.fadedExtensions.start,P),yield y(e,0,P),yield y(e,1,P),yield y(e,1+this.fadedExtensions.end,P)):(yield y(e,0,P),yield y(e,1,P))}}const G=d(),P=i(),v=i(),S=f();var V;!function(e){e[e.LINE=0]="LINE",e[e.RAY=1]="RAY",e[e.GROUND_RAY=2]="GROUND_RAY",e[e.FADED=3]="FADED"}(V||(V={}));const M=1/3,T={start:M,end:M};export{C as ExtendedLineVisualElement,V as ExtensionType};
@@ -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{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as s,subtract as i,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as d,c as h,n as m,f as l,g as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as b}from"../../../../chunks/vec42.js";import{fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as O}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as G}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as w}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";class v extends j{constructor(e){super(e),this._location=p(),this._direction=_(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=f(1,0,1,1),this._renderOccluded=G.OccludeAndTransparent,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyObject3DResources(e),recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyDrapedResources(e),recreateGeometry:e=>this._recreateDrapedGeometry(e)}}get location(){return this._location}set location(e){d(this._location,e)||(h(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(h(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){m(this._direction,l(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(b(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}_createObject3DResources(e){const t=new x(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_destroyObject3DResources(e){e.geometries.length=0}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[s,i]=this._createGeometries(e);t.addGeometry(s),t.addGeometry(i),r.push(s),r.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){const t=new x(this.materialParameters),r=e((()=>this.view.state.contentPixelRatio),(()=>{this.drapedResources.recreateGeometry()}));return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:r}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=this._createGeometries(e);return this._updateVerticesDraped(t),t.map((e=>new R(e)))}_createGeometries(e){return[O(e,[p(),p()]),O(e,[p(),p()])]}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,M),u(P,this.location,this.direction),t.projectToScreen(P,I),s(I,i(I,I,M)),this._updateVertexAttributesObject3D(t,e,0,M,I,1),this._updateVertexAttributesObject3D(t,e,1,M,I,-1)}_updateVertexAttributesObject3D(e,r,s,i,o,a){const c=r.geometries[s],n=c.getMutableAttribute(w.POSITION)?.data;if(!n)return;const{start:d,end:h}=this._computeStartEnd(o,i,a,this.offset,this.width,this.length);e.unprojectFromScreen(t(d),P),n[0]=P[0],n[1]=P[1],n[2]=P[2],e.unprojectFromScreen(t(h),P),n[3]=P[0],n[4]=P[1],n[5]=P[2],r.geometryVertexAttributeUpdated(c,w.POSITION)}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:s,width:i,length:o,offset:a}=this,c=E;c.spatialReference=t.renderer.spatialReference,c.x=s[0],c.y=s[1];const n=this.view.overlayPixelSizeInMapUnits(c)*r,d=i*n,h=o*n,m=a*n;this._updateVertexAttributesDraped(e[0],d,h,m,-1),this._updateVertexAttributesDraped(e[1],d,h,m,1)}_updateVertexAttributesDraped(e,t,r,s,i){const o=e.getMutableAttribute(w.POSITION)?.data;if(!o)return;const{location:a,direction:c}=this,{start:n,end:d}=this._computeStartEnd(c,a,i,s,t,r);o[0]=n[0],o[1]=n[1],o[2]=D,o[3]=d[0],o[4]=d[1],o[5]=D,e.invalidateBoundingInfo()}_computeStartEnd(e,t,r,s,i,n){const d=o(V,a(V,e[1]*r,e[0]*-r),s+i/2),h=c(A,c(A,c(A,t,o(A,e,n/2)),d),d);return{start:h,end:c(S,h,o(S,e,-n))}}}const P=p(),V=n(),A=n(),S=n(),M=r(),I=r(),E=y(0,0,void 0,null);export{v as ParallelLineVisualElement};
5
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as s,subtract as i,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as d,c as h,n as m,f as l,g as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as b}from"../../../../chunks/vec42.js";import{fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as O}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as G}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as w}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";class v extends j{constructor(e){super(e),this._location=p(),this._direction=_(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=f(1,0,1,1),this._renderOccluded=G.OccludeAndTransparent,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyObject3DResources(e),recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyDrapedResources(e),recreateGeometry:e=>this._recreateDrapedGeometry(e)}}get location(){return this._location}set location(e){d(this._location,e)||(h(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(h(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){m(this._direction,l(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(b(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}_createObject3DResources(e){const t=new x(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_destroyObject3DResources(e){e.geometries.length=0}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[s,i]=this._createGeometries(e);t.addGeometry(s),t.addGeometry(i),r.push(s),r.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){const t=new x(this.materialParameters),r=e((()=>this.view.state.contentPixelRatio),(()=>{this.drapedResources.recreateGeometry()}));return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:r}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=this._createGeometries(e);return this._updateVerticesDraped(t),t.map((e=>new R(e)))}_createGeometries(e){return[O(e,[p(),p()]),O(e,[p(),p()])]}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,M),u(P,this.location,this.direction),t.projectToScreen(P,I),s(I,i(I,I,M)),this._updateVertexAttributesObject3D(t,e,0,M,I,1),this._updateVertexAttributesObject3D(t,e,1,M,I,-1)}_updateVertexAttributesObject3D(e,r,s,i,o,a){const c=r.geometries[s],n=c.getMutableAttribute(w.POSITION)?.data;if(!n)return;const{start:d,end:h}=this._computeStartEnd(o,i,a,this.offset,this.width,this.length);e.unprojectFromScreen(t(d),P),n[0]=P[0],n[1]=P[1],n[2]=P[2],e.unprojectFromScreen(t(h),P),n[3]=P[0],n[4]=P[1],n[5]=P[2],r.geometryVertexAttributeUpdated(c,w.POSITION)}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:s,width:i,length:o,offset:a}=this,c=E;c.spatialReference=t.renderer.spatialReference,c.x=s[0],c.y=s[1];const n=this.view.overlayPixelSizeInMapUnits(c)*r,d=i*n,h=o*n,m=a*n;this._updateVertexAttributesDraped(e[0],d,h,m,-1),this._updateVertexAttributesDraped(e[1],d,h,m,1)}_updateVertexAttributesDraped(e,t,r,s,i){const o=e.getMutableAttribute(w.POSITION)?.data;if(!o)return;const{location:a,direction:c}=this,{start:n,end:d}=this._computeStartEnd(c,a,i,s,t,r);o[0]=n[0],o[1]=n[1],o[2]=D,o[3]=d[0],o[4]=d[1],o[5]=D,e.invalidateBoundingInfo()}_computeStartEnd(e,t,r,s,i,n){const d=o(V,a(V,e[1]*r,e[0]*-r),s+i/2),h=c(A,c(A,c(A,t,o(A,e,n/2)),d),d);return{start:h,end:c(S,h,o(S,e,-n))}}}const P=p(),V=n(),A=n(),S=n(),M=r(),I=r(),E=y(0,0,void 0,null);export{v as ParallelLineVisualElement};