@arcgis/core 5.2.0-next.48 → 5.2.0-next.49

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 (190) hide show
  1. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.d.ts +33 -0
  2. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.js +2 -0
  3. package/arcgisGlobal.d.ts +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +1 -0
  6. package/assets/esri/core/workers/chunks/0474af7687466d8befd2.js +1 -0
  7. package/assets/esri/core/workers/chunks/{f9b2727b41943d83d4ca.js → 0a413d917f3d19440fc1.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0b2ca406761c63529a6a.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c369d4266f38e9ea6592.js → 1119a33245138e7b3914.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6fbcf1b85461c6c6c127.js → 172571397c66f992d08c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/18edf2846d7546285e5e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7759a489205a874e13bb.js → 1b0557fcb058fc450230.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{7d0ff52748fd4eb0334d.js → 1bc45872d22d61dbd7d1.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{835643f716f7058a2722.js → 1cf8fb704c48ac3d3b15.js} +1 -1
  15. package/assets/esri/core/workers/chunks/25cb56c3b538d00e7693.js +1 -0
  16. package/assets/esri/core/workers/chunks/{2c0d92c0e3511775401a.js → 35cbf00f0c37a86517af.js} +1 -1
  17. package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +1 -0
  18. package/assets/esri/core/workers/chunks/3af2b9d6d5466cb2b957.js +256 -0
  19. package/assets/esri/core/workers/chunks/{c3766d98f0a70897647f.js → 3bc2943035391b44d4cf.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{bd8b180c61a80e60568c.js → 40f7bb0ebd918d76f078.js} +1 -1
  21. package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +1 -0
  22. package/assets/esri/core/workers/chunks/{821176ee3be724621bb0.js → 461c2de938bf4c9b1442.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +29 -0
  24. package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +1 -0
  25. package/assets/esri/core/workers/chunks/547a2fe53139f705f95e.js +1 -0
  26. package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4d9433f127aef76f3449.js → 5dbd28fce73751d2d1aa.js} +1 -1
  28. package/assets/esri/core/workers/chunks/5ec8b02e097cf6718462.js +1 -0
  29. package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +1 -0
  30. package/assets/esri/core/workers/chunks/63e3d338751240479335.js +1 -0
  31. package/assets/esri/core/workers/chunks/6ccd5fa5e35dc70fcd5d.js +1 -0
  32. package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +1 -0
  33. package/assets/esri/core/workers/chunks/{68d898037feb0aee3138.js → 78add8e6b54b51eaa299.js} +1 -1
  34. package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +1 -0
  35. package/assets/esri/core/workers/chunks/7f2f2a92dce3f68e579b.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e7e3ea7af928b49b226c.js → 801a664f21e0218bc705.js} +1 -1
  37. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +1 -0
  38. package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +1 -0
  39. package/assets/esri/core/workers/chunks/{71ce1009dadcae8f8094.js → 95b3b8fe45ef4ac6b277.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{78918035144c3c76df71.js → 96cec8a02ca96175d602.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{bab71e1b8b93d09d4809.js → 99eccf9ce53582cfa5b5.js} +1 -1
  42. package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +1 -0
  43. package/assets/esri/core/workers/chunks/{ff2c4f648f77850922d5.js → 9e474465d069cb9e94f5.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{ae9f9e975d7a9d442fa5.js → ab5aa4280ed0cb7fcbe9.js} +1 -1
  45. package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +1 -0
  46. package/assets/esri/core/workers/chunks/{fed6c75485601cd3afa1.js → baac90da0703891d59c4.js} +1 -1
  47. package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b30237361d87cf982e41.js → d1af0bd611a3dc549858.js} +64 -59
  49. package/assets/esri/core/workers/chunks/d2cb3d5ef0a9285afb78.js +1 -0
  50. package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +1 -0
  51. package/assets/esri/core/workers/chunks/dc1787d88b11ed985159.js +1 -0
  52. package/assets/esri/core/workers/chunks/{399e23d777a043efa9f1.js → dd95f50dac3f33cdb6d2.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ddb92c815d17c67a45e6.js +1 -0
  54. package/assets/esri/core/workers/chunks/{52efa4ded11c1e71f04f.js → e2e2162adbfb9b46bede.js} +1 -1
  55. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +1 -0
  56. package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +1 -0
  57. package/assets/esri/core/workers/chunks/edf87407dd20685c82ab.js +1 -0
  58. package/assets/esri/core/workers/chunks/{be6caade351e89f84251.js → ee7c8a7f384ea6393487.js} +107 -82
  59. package/assets/esri/core/workers/chunks/f1299b4fc760ccca1518.js +1 -0
  60. package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +1 -0
  61. package/assets/esri/core/workers/chunks/fc639c730115e07a4a1a.js +1 -0
  62. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  63. package/chunks/Component.glsl.js +104 -67
  64. package/chunks/LineMarker.glsl.js +31 -31
  65. package/chunks/RibbonLine.glsl.js +60 -49
  66. package/chunks/dxt_encoder.js +1 -1
  67. package/chunks/vec3.js +1 -1
  68. package/config.js +1 -1
  69. package/core/has.js +1 -1
  70. package/geometry/support/aaBoundingBox.js +1 -1
  71. package/geometry/support/buffer/math/vec3.js +1 -1
  72. package/geometry/support/frustum.js +1 -1
  73. package/geometry/support/meshUtils/extent.js +1 -1
  74. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  75. package/kernel.js +1 -1
  76. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  77. package/layers/orientedImagery/transformations/utils.js +1 -1
  78. package/package.json +1 -1
  79. package/support/revision.js +1 -1
  80. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  81. package/symbols/cim/CIMSymbolHelper.js +1 -1
  82. package/symbols/cim/TextRasterizer.js +1 -1
  83. package/symbols/cim/cimAnalyzer.js +1 -1
  84. package/symbols/cim/richTextUtils.js +2 -0
  85. package/views/2d/engine/webgl/TextureManager.js +1 -1
  86. package/views/2d/engine/webgl/definitions.js +1 -1
  87. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  88. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  90. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  91. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  92. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  93. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  94. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  95. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  96. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  97. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  98. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  99. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  100. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  101. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  102. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  103. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  104. package/views/3d/focusAreaUtils.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  108. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  109. package/views/3d/layers/i3s/meshUtils.js +1 -1
  110. package/views/3d/webgl/RenderCamera.js +1 -1
  111. package/views/3d/webgl/RenderNode.js +1 -1
  112. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  113. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  114. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  115. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +36 -25
  116. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +17 -10
  117. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  118. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  119. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
  120. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  121. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  122. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  123. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  124. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  125. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  128. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +8 -5
  129. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  130. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  131. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  132. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  133. package/views/SceneView.js +1 -1
  134. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  135. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  136. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  137. package/views/selection/SelectionOperation.js +1 -1
  138. package/views/support/DefaultsFromMap.js +1 -1
  139. package/views/support/LayerViewManager.js +1 -1
  140. package/views/support/TextureCompressionWorker.js +1 -1
  141. package/views/webgl/RenderingContext.js +1 -1
  142. package/widgets/Editor.js +1 -1
  143. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  144. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  145. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  146. package/widgets/PanoramicViewer/support/PanoramicTileNode.d.ts +63 -0
  147. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  148. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.d.ts +66 -0
  149. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  150. package/widgets/PanoramicViewer/utils.js +1 -1
  151. package/widgets/Sketch/VisibleElements.d.ts +0 -10
  152. package/widgets/Sketch.js +1 -1
  153. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  154. package/widgets/support/SelectionToolbar.js +1 -1
  155. package/widgets/support/Selector3D/selectorUtils.js +2 -0
  156. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +0 -1
  157. package/assets/esri/core/workers/chunks/0f674c625f24ac73e25a.js +0 -1
  158. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +0 -29
  159. package/assets/esri/core/workers/chunks/1843a762f7051f61af43.js +0 -1
  160. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +0 -1
  161. package/assets/esri/core/workers/chunks/2015f4def2ef201bdab8.js +0 -1
  162. package/assets/esri/core/workers/chunks/20c363a113dc068de9e0.js +0 -1
  163. package/assets/esri/core/workers/chunks/24d936d459c538187af6.js +0 -1
  164. package/assets/esri/core/workers/chunks/272c8ab189217240d05f.js +0 -1
  165. package/assets/esri/core/workers/chunks/2e121eac97ae72a8b49a.js +0 -1
  166. package/assets/esri/core/workers/chunks/327899182a4dace428eb.js +0 -1
  167. package/assets/esri/core/workers/chunks/32ca15d928d51b380068.js +0 -1
  168. package/assets/esri/core/workers/chunks/3e1a7e4c674057807e3a.js +0 -1
  169. package/assets/esri/core/workers/chunks/4e2baa60c5d5197b2271.js +0 -1
  170. package/assets/esri/core/workers/chunks/519c0b51b1ba42fb71d7.js +0 -1
  171. package/assets/esri/core/workers/chunks/57fa3c0e7892c2eef3ee.js +0 -261
  172. package/assets/esri/core/workers/chunks/68b615bbd27fadcfcb66.js +0 -1
  173. package/assets/esri/core/workers/chunks/69d740ab18510156f5d6.js +0 -1
  174. package/assets/esri/core/workers/chunks/8d21f3d6edbcd7b335d0.js +0 -1
  175. package/assets/esri/core/workers/chunks/9a97f6cda2f36941efae.js +0 -1
  176. package/assets/esri/core/workers/chunks/9ceeae787dc7c194d60e.js +0 -1
  177. package/assets/esri/core/workers/chunks/a90f7b1c6c69b6033b4c.js +0 -1
  178. package/assets/esri/core/workers/chunks/b32bdf5730953c2fb16b.js +0 -1
  179. package/assets/esri/core/workers/chunks/b5d23efa584c74955d5b.js +0 -1
  180. package/assets/esri/core/workers/chunks/b83f2bbd634f57a5e8f9.js +0 -1
  181. package/assets/esri/core/workers/chunks/bb8e9b8343b83dd1ba3c.js +0 -1
  182. package/assets/esri/core/workers/chunks/bef1990159c0e49e7d27.js +0 -1
  183. package/assets/esri/core/workers/chunks/bf287f0e2ecb4532dc00.js +0 -1
  184. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +0 -1
  185. package/assets/esri/core/workers/chunks/cba3316910ff088f4d77.js +0 -1
  186. package/assets/esri/core/workers/chunks/de9573871f64c01e9f01.js +0 -1
  187. package/assets/esri/core/workers/chunks/e232459f0b00110e07ac.js +0 -1
  188. package/assets/esri/core/workers/chunks/ee6bb6cd16f99421c76b.js +0 -1
  189. package/assets/esri/core/workers/chunks/fd2ba6f76645ba503cbb.js +0 -1
  190. package/views/3d/analysis/Viewshed/ViewshedTool2.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{handlesGroup as i}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import a from"../../../../core/ReactiveSet.js";import{watch as s,initial as o,when as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{create as h,fromPoints as p}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as u}from"./LineOfSightAggregateManipulatedObject3D.js";import{LineOfSightInteractionVisuals as d}from"./LineOfSightInteractionVisuals.js";import{ReshapeTool3D as g}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import _ from"../../../interactive/sketch/SketchOptions.js";import{acquire as v}from"../../../interactive/snapping/SnappingManagerPool.js";const b=Symbol("line-of-sight-reshape-line-of-sight-manipulators"),M=Symbol("line-of-sight-reshape-tool-operations"),f=h();let m=class extends t{constructor(e){super(e),this.visible=!0,this.isParentToolInteracting=!1,this._selectedManipulators=new a,this._grabbedManipulator=null,this._interactionVisuals=null,this._snappingManagerResult=v(e.view),this._object=new u({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new g({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,snapToScene:!0,sketchOptions:new _({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._interactionVisuals=new d({view:this.view}),this.addHandles([this._snappingManagerResult,this._connectReshapeEvents(),this._connectActiveState(),this._connectManipulators(),this._connectGrabbedManipulator(),this._connectObjectInteracting(),this._connectOperations()])}destroy(){this.stop(),this.removeHandles(b),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._interactionVisuals=n(this._interactionVisuals),this._selectedManipulators.clear()}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}activate(){this._reshapeTool.visible=this.visible,this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.observerManipulator}hasManipulatorAt(e,t){for(const i of this._object.lineOfSightManipulators)if(y(i,e,t))return!0;return!1}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection(),this._selectedManipulators.clear(),this._grabbedManipulator=null}get hasSelection(){return this._selectedManipulators.size>0}get _objectInteracting(){return this.analysisViewData.visible&&(this.isParentToolInteracting||this.hasSelection)}applySelection(e){const t="observer"===e.type?this._object.observerManipulator:this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this.snappingManager?.doneSnapping(),this.clearSelection()}undo(){this._reshapeTool.undo()}_connectReshapeEvents(){return i([this._reshapeTool.events.on("reshape",e=>{if(1===this._selectedManipulators.size){if("reshape-start"===e.type){const e=this._selectedManipulators.values().next().value;this._grabbedManipulator??=e}"reshape-stop"===e.type&&(this._grabbedManipulator=null)}}),this._reshapeTool.on("cancel",()=>this.clearSelection()),this._reshapeTool.events.on("before-vertex-remove",e=>{let t=this.analysis.targets.length;for(const i of e.vertices){if(0===i.componentIndex)return void e.preventDefault();if(t-=1,0===t)return void e.preventDefault()}})])}_connectActiveState(){return s(()=>this.active,e=>{e||this._reshapeTool.snappingManager?.doneSnapping()},o)}_connectManipulators(){return s(()=>this._object.lineOfSightManipulators,e=>{this.removeHandles(b),this._selectedManipulators.batch(()=>{this._selectedManipulators.clear();for(const t of e)t.selected&&this._selectedManipulators.add(t)}),this.addHandles(e.map(e=>this._connectManipulator(e)),b)},o)}_connectManipulator(e){return i([e.events.on("grab-changed",t=>{if("start"===t.action){this._selectedManipulators.add(e),this._grabbedManipulator??=e;const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,a=this.visible,s=this._grabbedManipulator;if(s!==e)return;if(null==this._interactionVisuals||!t||!a||!i||null==n)return void this._hideLaserLine();this._interactionVisuals.update({target:s.renderLocation,lineVerticalPlaneSegment:s===n?null:p(n.renderLocation,s.renderLocation,f),visible:!0})}"end"===t.action&&(this._grabbedManipulator=null)}),e.events.on("select-changed",({action:t})=>{"select"===t?this._selectedManipulators.add(e):this._selectedManipulators.delete(e)}),e.events.on("location-update",()=>{const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,a=this.visible,s=this._grabbedManipulator;s===e&&(null!=this._interactionVisuals&&t&&a&&i&&null!=n?this._interactionVisuals.update({target:s.renderLocation,lineVerticalPlaneSegment:s===n?null:p(n.renderLocation,s.renderLocation,f),visible:!0}):this._hideLaserLine())})])}_connectGrabbedManipulator(){return r(()=>null==this._grabbedManipulator,()=>{this._hideLaserLine()})}_connectObjectInteracting(){return s(()=>this._objectInteracting,e=>{this._object.interacting=e},o)}_connectOperations(){return s(()=>this._object.operations,e=>{this.removeHandles(M),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],M),this.notifyChange("canUndo"),this.notifyChange("canRedo")},o)}_hideLaserLine(){this._interactionVisuals?.hide()}};function y(e,t,i){return!0===e?.interactive&&e.consumesClicks&&null!=e.intersectionDistance(t,i)}e([l({constructOnly:!0})],m.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],m.prototype,"analysis",void 0),e([l({constructOnly:!0})],m.prototype,"intersector",void 0),e([l({constructOnly:!0})],m.prototype,"view",void 0),e([l()],m.prototype,"visible",void 0),e([l()],m.prototype,"isParentToolInteracting",void 0),e([l()],m.prototype,"_grabbedManipulator",void 0),e([l()],m.prototype,"active",null),e([l()],m.prototype,"canRedo",null),e([l()],m.prototype,"canUndo",null),e([l()],m.prototype,"updating",null),e([l()],m.prototype,"hasSelection",null),e([l()],m.prototype,"_objectInteracting",null),m=e([c("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],m);export{m as LineOfSightReshapeTool3D};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{handlesGroup as i}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import s from"../../../../core/ReactiveSet.js";import{watch as a,initial as o,when as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{create as h,fromPoints as p}from"../../../../geometry/support/lineSegment.js";import{LineOfSightAggregateManipulatedObject3D as u}from"./LineOfSightAggregateManipulatedObject3D.js";import{LineOfSightInteractionVisuals as d}from"./LineOfSightInteractionVisuals.js";import{ReshapeTool3D as g}from"../../interactive/editingTools/reshape/ReshapeTool3D.js";import _ from"../../../interactive/sketch/SketchOptions.js";import{acquire as v}from"../../../interactive/snapping/SnappingManagerPool.js";const b=Symbol("line-of-sight-reshape-line-of-sight-manipulators"),M=Symbol("line-of-sight-reshape-tool-operations"),f=h();let m=class extends t{get visible(){return this._get("visible")??!0}set visible(e){this._set("visible",e),null!=this._reshapeTool&&(this._reshapeTool.visible=e)}constructor(e){super(e),this.isParentToolInteracting=!1,this._selectedManipulators=new s,this._grabbedManipulator=null,this._interactionVisuals=null,this._snappingManagerResult=v(e.view),this._object=new u({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:e.intersector,view:e.view}),this._reshapeTool=new g({autoHideManipulators:!1,enableDeleteVertices:!0,enableEdgeOffset:!1,enableMidpoints:!1,enableMoveObject:!1,object:this._object,snapToScene:!0,sketchOptions:new _({tooltips:{enabled:!0}}),snappingManager:this._snappingManagerResult.snappingManager,view:e.view})}initialize(){this.view.tools.add(this._reshapeTool),this._interactionVisuals=new d({view:this.view}),this.addHandles([this._snappingManagerResult,this._connectReshapeEvents(),this._connectActiveState(),this._connectManipulators(),this._connectGrabbedManipulator(),this._connectObjectInteracting(),this._connectOperations()])}destroy(){this.stop(),this.removeHandles(b),this.view.tools.remove(this._reshapeTool),this._reshapeTool.destroy(),this._object.destroy(),this._interactionVisuals=n(this._interactionVisuals),this._selectedManipulators.clear()}get active(){return this._reshapeTool.active}get canRedo(){return this._reshapeTool.canRedo}get canUndo(){return this._reshapeTool.canUndo}get updating(){return this._reshapeTool.updating}get snappingManager(){return this.active?this._reshapeTool.snappingManager:null}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}activate(){this.view.activeTool!==this._reshapeTool&&(this.view.activeTool=this._reshapeTool),this._reshapeTool.activate()}getTargetManipulator(e){return this._object.getTargetManipulator(e)}getObserverManipulator(){return this._object.observerManipulator}hasManipulatorAt(e,t){for(const i of this._object.lineOfSightManipulators)if(y(i,e,t))return!0;return!1}redo(){this._reshapeTool.redo()}clearSelection(){this._reshapeTool.clearSelection(),this._selectedManipulators.clear(),this._grabbedManipulator=null}get hasSelection(){return this._selectedManipulators.size>0}get _objectInteracting(){return this.analysisViewData.visible&&(this.isParentToolInteracting||this.hasSelection)}applySelection(e){const t="observer"===e.type?this._object.observerManipulator:this._object.getTargetManipulator(e.target);return null!=t&&this._reshapeTool.selectManipulator(t)}setEditableFlag(e,t){this._reshapeTool.setEditableFlag(e,t)}stop(){this.view.activeTool===this._reshapeTool&&(this.view.activeTool=null),this.snappingManager?.doneSnapping(),this.clearSelection()}undo(){this._reshapeTool.undo()}_connectReshapeEvents(){return i([this._reshapeTool.events.on("reshape",e=>{if(1===this._selectedManipulators.size){if("reshape-start"===e.type){const e=this._selectedManipulators.values().next().value;this._grabbedManipulator??=e}"reshape-stop"===e.type&&(this._grabbedManipulator=null)}}),this._reshapeTool.on("cancel",()=>this.clearSelection()),this._reshapeTool.events.on("before-vertex-remove",e=>{let t=this.analysis.targets.length;for(const i of e.vertices){if(0===i.componentIndex)return void e.preventDefault();if(t-=1,0===t)return void e.preventDefault()}})])}_connectActiveState(){return a(()=>this.active,e=>{e||this._reshapeTool.snappingManager?.doneSnapping()},o)}_connectManipulators(){return a(()=>this._object.lineOfSightManipulators,e=>{this.removeHandles(b),this._selectedManipulators.batch(()=>{this._selectedManipulators.clear();for(const t of e)t.selected&&this._selectedManipulators.add(t)}),this.addHandles(e.map(e=>this._connectManipulator(e)),b)},o)}_connectManipulator(e){return i([e.events.on("grab-changed",t=>{if("start"===t.action){this._selectedManipulators.add(e),this._grabbedManipulator??=e;const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,s=this.visible,a=this._grabbedManipulator;if(a!==e)return;if(null==this._interactionVisuals||!t||!s||!i||null==n)return void this._hideLaserLine();this._interactionVisuals.update({target:a.renderLocation,lineVerticalPlaneSegment:a===n?null:p(n.renderLocation,a.renderLocation,f),visible:!0})}"end"===t.action&&(this._grabbedManipulator=null)}),e.events.on("select-changed",({action:t})=>{"select"===t?this._selectedManipulators.add(e):this._selectedManipulators.delete(e)}),e.events.on("location-update",()=>{const t=this.active,i=this.analysisViewData.visible,n=this._object.observerManipulator,s=this.visible,a=this._grabbedManipulator;a===e&&(null!=this._interactionVisuals&&t&&s&&i&&null!=n?this._interactionVisuals.update({target:a.renderLocation,lineVerticalPlaneSegment:a===n?null:p(n.renderLocation,a.renderLocation,f),visible:!0}):this._hideLaserLine())})])}_connectGrabbedManipulator(){return r(()=>null==this._grabbedManipulator,()=>{this._hideLaserLine()})}_connectObjectInteracting(){return a(()=>this._objectInteracting,e=>{this._object.interacting=e},o)}_connectOperations(){return a(()=>this._object.operations,e=>{this.removeHandles(M),null!=e&&this.addHandles([e.on("can-redo-change",()=>this.notifyChange("canRedo")),e.on("can-undo-change",()=>this.notifyChange("canUndo"))],M),this.notifyChange("canUndo"),this.notifyChange("canRedo")},o)}_hideLaserLine(){this._interactionVisuals?.hide()}};function y(e,t,i){return!0===e?.interactive&&e.consumesClicks&&null!=e.intersectionDistance(t,i)}e([l({constructOnly:!0})],m.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],m.prototype,"analysis",void 0),e([l({constructOnly:!0})],m.prototype,"intersector",void 0),e([l({constructOnly:!0})],m.prototype,"view",void 0),e([l()],m.prototype,"visible",null),e([l()],m.prototype,"isParentToolInteracting",void 0),e([l()],m.prototype,"_grabbedManipulator",void 0),e([l()],m.prototype,"active",null),e([l()],m.prototype,"canRedo",null),e([l()],m.prototype,"canUndo",null),e([l()],m.prototype,"updating",null),e([l()],m.prototype,"hasSelection",null),e([l()],m.prototype,"_objectInteracting",null),m=e([c("esri.views.3d.analysis.LineOfSight.LineOfSightReshapeTool3D")],m);export{m as LineOfSightReshapeTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../Color.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";const r=2,o=4,s=i(2),c=1.5;class n{constructor(){this.collisionRadius=5,this.fovUnfocusedArcWidth=o,this.fovFocusedArcWidth=r*this.fovUnfocusedArcWidth,this.scaleOrientSize=90,this.scaleOrientHandleRadius=.025,this.scaleOrientMinDistance=1,this.scaleOrientArrowTipLength=.3,this.scaleOrientArrowTipFocusMultiplier=r/1.5,this.observerSize=5,this.hoverTimeoutMilliseconds=1e3,this.viewAngleThreshold=10}getFovArcWidth(e){return e?this.fovFocusedArcWidth:this.fovUnfocusedArcWidth}getScaleOrientArrowTipLength(e){return this.scaleOrientArrowTipLength*(e?this.scaleOrientArrowTipFocusMultiplier:1)}}const l=new n;class h{constructor(){this.frameWidthNotSelected=.3,this.frameWidthSelected=1,this.frameColor=new e([255,255,255,.99]),this.observerPointConfiguration={size:6,pixelSnappingEnabled:!1,primitive:"circle",outlineSize:0,color:new e([3,252,111,1]).toUnitRGBA()},this.observerStagedPointConfiguration={size:10,outlineColor:new e([0,0,0,0]).toUnitRGBA(),renderOccluded:4},this.shapeMaterialParameters={color:t(.33,.33,.33,.25),renderOccluded:1,cullFace:2,writeDepth:!1}}}const a=new h;export{s as arcAnglePerSegment,c as creationVerticalOffset,l as viewshedToolManipulatorConfiguration,a as viewshedVisualizationConfiguration};
2
+ import e from"../../../../Color.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";const r=2,o=4,s=i(2);class c{constructor(){this.collisionRadius=5,this.fovUnfocusedArcWidth=o,this.fovFocusedArcWidth=r*this.fovUnfocusedArcWidth,this.scaleOrientSize=90,this.scaleOrientHandleRadius=.025,this.scaleOrientMinDistance=1,this.scaleOrientArrowTipLength=.3,this.scaleOrientArrowTipFocusMultiplier=r/1.5,this.observerSize=5,this.hoverTimeoutMilliseconds=1e3,this.viewAngleThreshold=10}getFovArcWidth(e){return e?this.fovFocusedArcWidth:this.fovUnfocusedArcWidth}getScaleOrientArrowTipLength(e){return this.scaleOrientArrowTipLength*(e?this.scaleOrientArrowTipFocusMultiplier:1)}}const n=new c;class l{constructor(){this.frameWidthNotSelected=.3,this.frameWidthSelected=1,this.frameColor=new e([255,255,255,.99]),this.observerPointConfiguration={size:6,pixelSnappingEnabled:!1,primitive:"circle",outlineSize:0,color:new e([3,252,111,1]).toUnitRGBA()},this.observerStagedPointConfiguration={size:10,outlineColor:new e([0,0,0,0]).toUnitRGBA(),renderOccluded:4},this.shapeMaterialParameters={color:t(.33,.33,.33,.25),renderOccluded:1,cullFace:2,writeDepth:!1}}}const h=new l;export{s as arcAnglePerSegment,n as viewshedToolManipulatorConfiguration,h as viewshedVisualizationConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Collection.js";import"../../../../core/has.js";import{mapCollection as i}from"../../../../core/mapCollectionUtils.js";import{destroyMaybe as o,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as l,initial as r}from"../../../../core/reactiveUtils.js";import{property as a,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{ViewshedInteractionVisuals as c}from"./ViewshedInteractionVisuals.js";import{ViewshedObserverManipulatedObject3D as d}from"./ViewshedObserverManipulatedObject3D.js";import{ViewshedSnappingController as u}from"./ViewshedSnappingController.js";import{ViewshedSubTool as h}from"./ViewshedSubTool.js";import{findSubTool as b}from"./viewshedSubToolUtils.js";import{connectTooltipToManipulatedObject as v}from"../../interactive/editingTools/tooltipUtils3D.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{sketchKeys as _}from"../../../interactive/keybindings.js";import g from"../../../interactive/sketch/SketchOptions.js";import{enterInputModeIfAvailable as m,makeTooltip as y}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as w}from"../../../interactive/tooltip/infos/MovePointTooltipInfo.js";let V=class extends T{constructor(e){super(e),this.subToolHandles=new t,this.removeIncompleteOnCancel=!1,this.automaticManipulatorSelection=!1,this.multiTouchEnabled=!1,this.creating=!1,this.isPlacingTarget=!1,this._selectedManipulator=null,this._observerTooltipSketchOptions=new g({tooltips:{enabled:!0}}),this._observerTooltipConnectionHandle=null,this._observerTooltipObject=null}initialize(){const{view:e}=this;this._interactionVisuals=new c({view:e}),this._snappingController=new u({view:e}),this._initializeObserverTooltip(e);const t=this.analysisViewData.viewshedComputedDataHandles;this.subToolHandles=i(()=>t,({viewshedComputedData:e})=>{const t=new h({analysis:this.analysis,analysisViewData:this.analysisViewData,parentTool:this,view:this.view,viewshedComputedData:e});return{subTool:t,remove:()=>{this.selectedViewshed===e.viewshed&&(this.selectedViewshed=null),t.destroy()}}}),this.addHandles([n(()=>this.firstGrabbedManipulator,e=>{if(null!=e){const t=this._findSubTool(e)?.viewshed;this.selectedViewshed=t,this._selectManipulator(e)}else this._selectedSubTool?.onManipulatorSelectionChanged()},l),n(()=>{const e=this.selectedViewshedComputedData;return null==e?null:{subTool:this._selectedSubTool,observer:e.elevationAlignedObserverRenderSpace,target:e.elevationAlignedTargetRenderSpace}},e=>{if(null==e)return;const{subTool:t,observer:i,target:o}=e;t?.moveInteractionState.dragging?this._updateInteractionVisualsLocation(i,!0):t?.scaleOrientInteractionState.dragging&&this._updateInteractionVisualsLocation(o,!1)},r),n(()=>this.analysisViewData.visible,()=>this.updateInteractionVisualsVisibility(),r),n(()=>this.selectedViewshed,e=>{const t=this._selectedManipulator,i=this._selectedSubTool;this._connectObserverTooltip(i),null==e?this._selectManipulator(null):null!=t&&i.hasManipulator(t)||this._selectManipulator(i.discManipulator)},r)])}destroy(){this._selectManipulator(null),this._disconnectObserverTooltip(),o(this.subToolHandles),o(this._interactionVisuals),o(this._snappingController),o(this._observerTooltip)}get updating(){return this.subToolHandles.some(({subTool:e})=>e.updating)||this._snappingController?.updating}get grabbing(){return this.subToolHandles.some(({subTool:e})=>e.grabbing)}get cursor(){return null}get selectedViewshed(){return this.analysisViewData.selectedViewshed}set selectedViewshed(e){this.analysisViewData.selectedViewshed=e}get selectedViewshedComputedData(){return this._selectedSubTool?.viewshedComputedData}onManipulatorSelectionChanged(){this.subToolHandles.forEach(({subTool:e})=>e.onManipulatorSelectionChanged())}updateInteractionVisualsVisibility(e=!1){const t=this._selectedSubTool,i=this.selectedViewshedComputedData;if(null==t||null==i)return void this._interactionVisuals?.setVisibility(!1);const o=t.moveInteractionState,s=e?o.grabbing:o.dragging,n=t.scaleOrientInteractionState,l=e?n.grabbing:n.dragging;if(!(this.analysisViewData.visible&&(s||l)))return void this._interactionVisuals?.setVisibility(!1);const r=s?i.elevationAlignedObserverRenderSpace:i.elevationAlignedTargetRenderSpace;this._interactionVisuals?.update({location:r,laserlineVisible:!0,verticalLineVisible:s,intersectsWorldUp:s})}createObserverMoveSnappingPipeline(e,t,i){return this._snappingController.createObserverMoveSnappingPipeline(e,t,i)}onActivate(){this.updateInteractionVisualsVisibility()}onDeactivate(){this.updateInteractionVisualsVisibility()}onInputEvent(e){if(!this.destroyed&&!m(e,this._observerTooltip))switch(e.type){case"key-down":_.cancel===e.key?this._cancelKeyHandler(e):_.delete.includes(e.key)&&this._deleteKeyHandler(e);break;case"hold":this.updateInteractionVisualsVisibility(!0)}}_updateInteractionVisualsLocation(e,t){this._interactionVisuals?.updateLocation(e,t)}_initializeObserverTooltip(e){const t=this._observerTooltipSketchOptions;this._observerTooltip=y(()=>({view:e,options:t.tooltips})),this._observerTooltipInfo=new w({sketchOptions:t,viewType:e.type})}_connectObserverTooltip(e){if(this._disconnectObserverTooltip(),null==e)return void this._observerTooltip.clear();const t=new d({view:this.view,subTool:e});this._observerTooltipObject=t,this._observerTooltipConnectionHandle=v(this._observerTooltip,t,()=>({sketchOptions:this._observerTooltipSketchOptions,activeTooltipInfo:this._observerTooltipInfo,callbacks:{onBeforeUpdate:()=>this.updateInteractionVisualsVisibility(),onMoveStart:()=>{},onMove:()=>{},onMoveStop:()=>{},onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}}}))}_disconnectObserverTooltip(){this._observerTooltipConnectionHandle=s(this._observerTooltipConnectionHandle),this._observerTooltipObject=o(this._observerTooltipObject)}_cancelKeyHandler(e){this.grabbing||(this.selectedViewshed=null,e.stopPropagation())}_deleteKeyHandler(e){const t=this.selectedViewshed;null!=t&&(this.analysis.viewsheds.remove(t),e.stopPropagation())}get _selectedSubTool(){return this._findSubTool(this.selectedViewshed)}_findSubTool(e){return b(this.subToolHandles,e)}_selectManipulator(e){const t=this._selectedManipulator;t!==e&&(this._selectedManipulator=e,null!=t&&(t.selected=!1),null!=e&&(e.selected=!0),this._findSubTool(t)?.onManipulatorSelectionChanged(),this._selectedSubTool?.onManipulatorSelectionChanged())}get test(){}};e([a({constructOnly:!0})],V.prototype,"analysis",void 0),e([a({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],V.prototype,"view",void 0),e([a()],V.prototype,"subToolHandles",void 0),e([a()],V.prototype,"removeIncompleteOnCancel",void 0),e([a()],V.prototype,"automaticManipulatorSelection",void 0),e([a()],V.prototype,"multiTouchEnabled",void 0),e([a()],V.prototype,"creating",void 0),e([a()],V.prototype,"isPlacingTarget",void 0),e([a()],V.prototype,"_selectedManipulator",void 0),e([a()],V.prototype,"_interactionVisuals",void 0),e([a()],V.prototype,"_snappingController",void 0),e([a()],V.prototype,"_observerTooltip",void 0),e([a()],V.prototype,"_observerTooltipInfo",void 0),e([a()],V.prototype,"updating",null),e([a()],V.prototype,"grabbing",null),e([a()],V.prototype,"cursor",null),e([a()],V.prototype,"selectedViewshed",null),e([a()],V.prototype,"selectedViewshedComputedData",null),e([a()],V.prototype,"_selectedSubTool",null),V=e([p("esri.views.3d.analysis.Viewshed.ViewshedEditTool")],V);export{V as ViewshedEditTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Collection.js";import"../../../../core/has.js";import{mapCollection as i}from"../../../../core/mapCollectionUtils.js";import{destroyMaybe as o,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as l,initial as r}from"../../../../core/reactiveUtils.js";import{property as a,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{ViewshedInteractionVisuals as c}from"./ViewshedInteractionVisuals.js";import{ViewshedObserverManipulatedObject3D as d}from"./ViewshedObserverManipulatedObject3D.js";import{ViewshedSnappingController as u}from"./ViewshedSnappingController.js";import{ViewshedSubTool as h}from"./ViewshedSubTool.js";import{findSubTool as b}from"./viewshedSubToolUtils.js";import{connectTooltipToManipulatedObject as v}from"../../interactive/editingTools/tooltipUtils3D.js";import{InteractiveToolBase as _}from"../../../interactive/InteractiveToolBase.js";import{sketchKeys as T}from"../../../interactive/keybindings.js";import m from"../../../interactive/sketch/SketchOptions.js";import{enterInputModeIfAvailable as g,makeTooltip as w}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as y}from"../../../interactive/tooltip/infos/MovePointTooltipInfo.js";let V=class extends _{constructor(e){super(e),this.subToolHandles=new t,this.removeIncompleteOnCancel=!1,this.automaticManipulatorSelection=!1,this.multiTouchEnabled=!1,this._selectedManipulator=null,this._observerTooltipSketchOptions=new m({tooltips:{enabled:!0}}),this._observerTooltipConnectionHandle=null,this._observerTooltipObject=null}initialize(){const{view:e}=this;this._interactionVisuals=new c({view:e}),this._snappingController=new u({view:e}),this._initializeObserverTooltip(e);const t=this.analysisViewData.viewshedComputedDataHandles;this.subToolHandles=i(()=>t,({viewshedComputedData:e})=>{const t=new h({analysis:this.analysis,analysisViewData:this.analysisViewData,parentTool:this,view:this.view,viewshedComputedData:e});return{subTool:t,remove:()=>{this.selectedViewshed===e.viewshed&&(this.selectedViewshed=null),t.destroy()}}}),this.addHandles([n(()=>this.firstGrabbedManipulator,e=>{if(null!=e){const t=this._findSubTool(e)?.viewshed;this.selectedViewshed=t,this._selectManipulator(e)}else this._selectedSubTool?.onManipulatorSelectionChanged()},l),n(()=>{const e=this.selectedViewshedComputedData;return null==e?null:{subTool:this._selectedSubTool,observer:e.elevationAlignedObserverRenderSpace,target:e.elevationAlignedTargetRenderSpace}},e=>{if(null==e)return;const{subTool:t,observer:i,target:o}=e;t?.moveInteractionState.dragging?this._updateInteractionVisualsLocation(i,!0):t?.scaleOrientInteractionState.dragging&&this._updateInteractionVisualsLocation(o,!1)},r),n(()=>this.analysisViewData.visible,()=>this.updateInteractionVisualsVisibility(),r),n(()=>this.selectedViewshed,e=>{const t=this._selectedManipulator,i=this._selectedSubTool;this._connectObserverTooltip(i),null==e?this._selectManipulator(null):null!=t&&i.hasManipulator(t)||this._selectManipulator(i.discManipulator)},r)])}destroy(){this._selectManipulator(null),this._disconnectObserverTooltip(),o(this.subToolHandles),o(this._interactionVisuals),o(this._snappingController),o(this._observerTooltip)}get updating(){return this.subToolHandles.some(({subTool:e})=>e.updating)||this._snappingController?.updating}get grabbing(){return this.subToolHandles.some(({subTool:e})=>e.grabbing)}get cursor(){return null}get selectedViewshed(){return this.analysisViewData.selectedViewshed}set selectedViewshed(e){this.analysisViewData.selectedViewshed=e}get selectedViewshedComputedData(){return this._selectedSubTool?.viewshedComputedData}onManipulatorSelectionChanged(){this.subToolHandles.forEach(({subTool:e})=>e.onManipulatorSelectionChanged())}updateInteractionVisualsVisibility(e=!1){const t=this._selectedSubTool,i=this.selectedViewshedComputedData;if(null==t||null==i)return void this._interactionVisuals?.setVisibility(!1);const o=t.moveInteractionState,s=e?o.grabbing:o.dragging,n=t.scaleOrientInteractionState,l=e?n.grabbing:n.dragging;if(!(this.analysisViewData.visible&&(s||l)))return void this._interactionVisuals?.setVisibility(!1);const r=s?i.elevationAlignedObserverRenderSpace:i.elevationAlignedTargetRenderSpace;this._interactionVisuals?.update({location:r,laserlineVisible:!0,verticalLineVisible:s,intersectsWorldUp:s})}createObserverMoveSnappingPipeline(e,t,i){return this._snappingController.createObserverMoveSnappingPipeline(e,t,i)}onActivate(){this.updateInteractionVisualsVisibility()}onDeactivate(){this.updateInteractionVisualsVisibility()}onInputEvent(e){if(!this.destroyed&&!g(e,this._observerTooltip))switch(e.type){case"key-down":T.cancel===e.key?this._cancelKeyHandler(e):T.delete.includes(e.key)&&this._deleteKeyHandler(e);break;case"hold":this.updateInteractionVisualsVisibility(!0)}}_updateInteractionVisualsLocation(e,t){this._interactionVisuals?.updateLocation(e,t)}_initializeObserverTooltip(e){const t=this._observerTooltipSketchOptions;this._observerTooltip=w(()=>({view:e,options:t.tooltips})),this._observerTooltipInfo=new y({sketchOptions:t,viewType:e.type})}_connectObserverTooltip(e){if(this._disconnectObserverTooltip(),null==e)return void this._observerTooltip.clear();const t=new d({view:this.view,subTool:e});this._observerTooltipObject=t,this._observerTooltipConnectionHandle=v(this._observerTooltip,t,()=>({sketchOptions:this._observerTooltipSketchOptions,activeTooltipInfo:this._observerTooltipInfo,callbacks:{onBeforeUpdate:()=>this.updateInteractionVisualsVisibility(),onMoveStart:()=>{},onMove:()=>{},onMoveStop:()=>{},onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}}}))}_disconnectObserverTooltip(){this._observerTooltipConnectionHandle=s(this._observerTooltipConnectionHandle),this._observerTooltipObject=o(this._observerTooltipObject)}_cancelKeyHandler(e){this.grabbing||(this.selectedViewshed=null,e.stopPropagation())}_deleteKeyHandler(e){const t=this.selectedViewshed;null!=t&&(this.analysis.viewsheds.remove(t),e.stopPropagation())}get _selectedSubTool(){return this._findSubTool(this.selectedViewshed)}_findSubTool(e){return b(this.subToolHandles,e)}_selectManipulator(e){const t=this._selectedManipulator;t!==e&&(this._selectedManipulator=e,null!=t&&(t.selected=!1),null!=e&&(e.selected=!0),this._findSubTool(t)?.onManipulatorSelectionChanged(),this._selectedSubTool?.onManipulatorSelectionChanged())}get test(){}};e([a({constructOnly:!0})],V.prototype,"analysis",void 0),e([a({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],V.prototype,"view",void 0),e([a()],V.prototype,"subToolHandles",void 0),e([a()],V.prototype,"removeIncompleteOnCancel",void 0),e([a()],V.prototype,"automaticManipulatorSelection",void 0),e([a()],V.prototype,"multiTouchEnabled",void 0),e([a()],V.prototype,"_selectedManipulator",void 0),e([a()],V.prototype,"_interactionVisuals",void 0),e([a()],V.prototype,"_snappingController",void 0),e([a()],V.prototype,"_observerTooltip",void 0),e([a()],V.prototype,"_observerTooltipInfo",void 0),e([a()],V.prototype,"updating",null),e([a()],V.prototype,"grabbing",null),e([a()],V.prototype,"cursor",null),e([a()],V.prototype,"selectedViewshed",null),e([a()],V.prototype,"selectedViewshedComputedData",null),e([a()],V.prototype,"_selectedSubTool",null),V=e([p("esri.views.3d.analysis.Viewshed.ViewshedEditTool")],V);export{V as ViewshedEditTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as M,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewshedToolManipulatorConfiguration as O}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as V,isSideHorizontal as y,flipSide as T}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as D}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as H}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as S}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as C}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as F,sceneSnappingAtProjectedLocation as j,dragManipulatedObject as A}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as x}from"../../../interactive/editGeometry/EditGeometryOperations.js";const P=Symbol("dragHandles"),k=Symbol("hideManipulators"),E=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let I=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new D({view:this.view,tool:this.parentTool}),this._observerManipulator=new H(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(P),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),P))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const{viewshedComputedData:e,parentTool:i,analysisViewData:t}=this,{creating:a,isPlacingTarget:n}=i,o=t.visible&&(e?.valid??!1),r=i.selectedViewshedComputedData===e,s=e?.effectiveElevationInfo.mode,l=o&&(!a||r);return{fovManipulationAvailable:o&&!n,nonFOVManipulationAvailable:l,zManipulationAvailable:l&&"on-the-ground"!==s}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i,zManipulationAvailable:t})=>{this._moveManipulation.available=i,this._moveManipulation.zManipulation.available=t,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(O.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new C({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:S})}_buildObserverDragPipeline(e){const{observer:i,effectiveElevationInfo:t}=e,a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((e,n,o,r,s)=>{r=r.next(F(this,["observer"]));const l=w(i,a);if(null==l)return{steps:o,cancel:r};const p=x.fromGeometry(l,this.view.state.viewingMode),h=this.parentTool.createObserverMoveSnappingPipeline?.(e,s,t);if(null!=h){const{snappingStep:e,cancelSnapping:i}=h;return r=r.next(i),{steps:o=o.next(j(this.view,t)).next(...e).next(A({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}}return{steps:o=o.next(A({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}},t,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(F(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=y(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?T(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return y(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(F(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=R.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(U,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=M(a)*i.metersPerUnit,o=b(a,i.targetDirection)<0?O.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let n=[];const o=e=>{n.push(e.disableDisplay())};e||!a&&i?this.removeHandles(k):(this._scaleOrientManipulation.forEachManipulator(o),this._moveManipulation.forEachManipulator(o),this.addHandles(n,k),n=[]),e||!a&&i||a&&t?this.removeHandles(E):(this._fieldOfViewManipulation.forEachManipulator(o),this.addHandles(n,E)),e||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],I.prototype,"analysis",void 0),e([g({constructOnly:!0})],I.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],I.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],I.prototype,"view",void 0),e([g()],I.prototype,"_forceHoveringTask",void 0),e([g()],I.prototype,"updating",null),e([g()],I.prototype,"viewshed",null),e([g()],I.prototype,"_grabbing",void 0),e([g()],I.prototype,"grabbing",null),e([g()],I.prototype,"viewshedComputedData",void 0),e([g()],I.prototype,"observer",null),e([g()],I.prototype,"elevationAlignedObserverRenderSpace",null),I=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],I);const U=_(),R=new o(0,180);export{I as ViewshedSubTool};
2
+ import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as _,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewshedToolManipulatorConfiguration as O}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as V,isSideHorizontal as y,flipSide as T}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as D}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as H}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as S}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as j}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as C,sceneSnappingAtProjectedLocation as F,dragManipulatedObject as x}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as A}from"../../../interactive/editGeometry/EditGeometryOperations.js";const P=Symbol("dragHandles"),k=Symbol("hideManipulators"),E=Symbol("hideFoVManipulators");let z=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new D({view:this.view,tool:this.parentTool}),this._observerManipulator=new H(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(P),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),P))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const{viewshedComputedData:e,analysisViewData:i}=this,t=i.visible&&(e?.valid??!1),a=e?.effectiveElevationInfo.mode;return{visibleAndValid:t,zManipulationAvailable:t&&"on-the-ground"!==a}},({visibleAndValid:e,zManipulationAvailable:i})=>{this._moveManipulation.available=e,this._moveManipulation.zManipulation.available=i,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(O.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new j({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:S})}_buildObserverDragPipeline(e){const{observer:i,effectiveElevationInfo:t}=e,a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((e,n,o,r,s)=>{r=r.next(C(this,["observer"]));const l=w(i,a);if(null==l)return{steps:o,cancel:r};const p=A.fromGeometry(l,this.view.state.viewingMode),h=this.parentTool.createObserverMoveSnappingPipeline?.(e,s,t);if(null!=h){const{snappingStep:e,cancelSnapping:i}=h;return r=r.next(i),{steps:o=o.next(F(this.view,t)).next(...e).next(x({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}}return{steps:o=o.next(x({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}},t,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(C(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=y(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?T(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return y(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(C(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=U.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(I,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=_(a)*i.metersPerUnit,o=b(a,i.targetDirection)<0?O.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering();let t=[];const a=e=>{t.push(e.disableDisplay())};e||i?this.removeHandles(k):(this._scaleOrientManipulation.forEachManipulator(a),this._moveManipulation.forEachManipulator(a),this.addHandles(t,k),t=[]),e||i?this.removeHandles(E):(this._fieldOfViewManipulation.forEachManipulator(a),this.addHandles(t,E))}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],z.prototype,"analysis",void 0),e([g({constructOnly:!0})],z.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],z.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),e([g()],z.prototype,"_forceHoveringTask",void 0),e([g()],z.prototype,"updating",null),e([g()],z.prototype,"viewshed",null),e([g()],z.prototype,"_grabbing",void 0),e([g()],z.prototype,"grabbing",null),e([g()],z.prototype,"viewshedComputedData",void 0),e([g()],z.prototype,"observer",null),e([g()],z.prototype,"elevationAlignedObserverRenderSpace",null),z=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],z);const I=M(),U=new o(0,180);export{z as ViewshedSubTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as i}from"../../../../core/lang.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{property as l,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as m,set as d,sub as u,len as p,normalize as v,scale as _,angle as V,negate as f,copy as E,add as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,clone as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as C}from"../../../../support/elevationInfoUtils.js";import{isOtherViewshedToolCreating as A}from"./analysisViewRegister.js";import{viewshedVisualizationConfiguration as L,arcAnglePerSegment as D}from"./ViewshedConfiguration.js";import{ViewshedShapeVisualElement as y}from"./ViewshedShapeVisualElement.js";import{LineVisualElement as S}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as j}from"../../interactive/visualElements/PointVisualElement.js";import{VerticesVisualElement as O}from"../../interactive/visualElements/VerticesVisualElement.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let F=class extends t{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:g(),topRight:g(),bottomLeft:g(),bottomRight:g()},this._arcCenterPoints={top:g(),bottom:g(),left:g(),right:g()},this._parallelCenters={top:g(),bottom:g()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},s={...t,stipplePattern:R(2)};this._observerVisualElement=new j({...e,...L.observerPointConfiguration,elevationInfo:C}),this._observerStagedVisualElement=new O({...e,...L.observerStagedPointConfiguration,spatialReference:this.view.renderCoordsHelper.spatialReference,elevationInfo:C}),this._shapeVisualElement=new y({...e,isDecoration:this.isDecoration}),this._frameLinesVisualElement=new S(t),this._leftArcVisualElement=new S(t),this._rightArcVisualElement=new S(t),this._topArcVisualElement=new S(t),this._bottomArcVisualElement=new S(t),this._centralLongitude=new S(s),this._centralLatitude=new S(s),this.addHandles([a(()=>{const e=this.viewshedComputedData,t=this._staged;if(null==e)return null;if(!e.valid)return{viewshedComputedData:e,staged:t,valid:!1};const i=this._viewshedCorners,s=this._arcCenterPoints,r=this._parallelCenters;return e.cornerPoints(i),e.arcCentersPoints(s),e.parallelCenterPoints(r),{viewshedComputedData:e,corners:i,arcCenters:s,parallelCenters:r,staged:t,valid:!0}},e=>{const t=!0===e?.valid,i=!t&&!0===e?.staged;this._forEachVisualElement(e=>e.attached=t),this._observerStagedVisualElement.attached=t||i,(t||i)&&this._updateVisualElements(e)},{initial:!0,equals:i}),a(()=>{const{viewshedComputedData:e}=this,{horizontalFieldOfView:t,verticalFieldOfView:i}=e??{};return{viewshedComputedData:e,horizontalFieldOfView:t,verticalFieldOfView:i}},({viewshedComputedData:e})=>{const{_shapeVisualElement:t}=this;e!==t.viewshedComputedData&&(t.viewshedComputedData=e),this._shapeVisualElement.recreateGeometry()},o),a(()=>{const{interactive:e}=this.analysisViewData;return{visible:this.visible,selected:e&&this._selected,staged:e&&this._staged,horFovNot360:360!==this.viewshedComputedData?.horizontalFieldOfView}},({visible:e,selected:t,staged:i,horFovNot360:s})=>{const r=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const a=e&&(t||s);this._leftArcVisualElement.visible=a,this._rightArcVisualElement.visible=a,this._forEachLineVisualElement(e=>{e.width=r?L.frameWidthSelected:L.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(r?L.frameWidthSelected:L.frameWidthNotSelected),i.visible=e&&t})},o),a(()=>{const{analysisViewData:{interactive:e,effectiveTool:t},_selected:i,_staged:s,visible:r}=this,a=i||s,o=!t?.active&&A(this.view,this.analysisViewData);return{observerVisible:r&&!a&&(!e||(t?.creating??!1)||o),observerStagedVisible:s,color:this._color}},({observerVisible:e,observerStagedVisible:t,color:i})=>{this._observerVisualElement.visible=e,this._observerStagedVisualElement.visible=t,this._forEachLineVisualElement(e=>e.color=i)},o)])}get _color(){const{viewshedComputedData:e,_selected:t,analysisViewData:i}=this;if(null==e)return L.frameColor.toUnitRGBA();const s=i.effectiveTool?.active||i.interactive,r=e.viewshed===i.stagedViewshed;return(s&&(t||r)?this.view.effectiveTheme.accentColor:L.frameColor).toUnitRGBA()}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:e,viewshedComputedData:t}=this,{effectiveTool:i}=e;return null!=i&&i.creating&&e.stagedViewshed===t?.viewshed}destroy(){this._observerVisualElement=r(this._observerVisualElement),this._observerStagedVisualElement=r(this._observerStagedVisualElement),this._shapeVisualElement=r(this._shapeVisualElement),this._frameLinesVisualElement=r(this._frameLinesVisualElement),this._leftArcVisualElement=r(this._leftArcVisualElement),this._rightArcVisualElement=r(this._rightArcVisualElement),this._topArcVisualElement=r(this._topArcVisualElement),this._bottomArcVisualElement=r(this._bottomArcVisualElement),this._centralLongitude=r(this._centralLongitude),this._centralLatitude=r(this._centralLatitude)}_forEachLineVisualElement(e){[this._frameLinesVisualElement,this._leftArcVisualElement,this._rightArcVisualElement,this._topArcVisualElement,this._bottomArcVisualElement,this._centralLatitude,this._centralLongitude].forEach(e)}_forEachVisualElement(e){this._forEachLineVisualElement(e),e(this._observerVisualElement),e(this._observerStagedVisualElement),e(this._shapeVisualElement)}_updateObserverVisualElements(e){const{viewshedComputedData:t}=e,i=g();this.view.renderCoordsHelper.toRenderCoords(t.elevationAlignedObserver,i),this._observerVisualElement.geometry=t.elevationAlignedObserver,this._observerStagedVisualElement.vertices=[i]}_updateVisualElements(e){if(this._updateObserverVisualElements(e),!e.valid)return;const{viewshedComputedData:t,corners:i,arcCenters:s,parallelCenters:r}=e;this._shapeVisualElement.updateTransform(),this._updateFrameLines(t,i),this._updateFrameArcs(t,i,r),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){const i=e.elevationAlignedObserverRenderSpace;this._frameLinesVisualElement.geometry=[[i,t.topLeft],[i,t.topRight],[i,t.bottomLeft],[i,t.bottomRight]]}_updateFrameArcs(e,t,i){const{elevationAlignedObserverRenderSpace:r,rightVector:a,horizontalFieldOfView:o,tiltedUpVector:l}=e,n=s(o),u=g(),p=c();h(p,n/2,l),m(u,a,p),P(this._leftArcVisualElement,r,t.bottomLeft,t.topLeft,"forward",u),h(p,-n/2,l),d(u,0,0,0),m(u,a,p),P(this._rightArcVisualElement,r,t.bottomRight,t.topRight,"forward",u);const v=o>180?"backward":"forward";P(this._topArcVisualElement,i.top,t.topRight,t.topLeft,v,l),P(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,v,l)}_updateCentralHelperArcs(e,t){const i=e.elevationAlignedObserverRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";P(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),P(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function P(e,t,i,s,r,a,o=D){const l=g();u(l,i,t);const n=p(l),d=g();u(d,s,t),v(d,d),_(d,d,n);let C=V(l,d);const A=w(a);"backward"===r&&(f(A,A),C=-(2*Math.PI-C));const L=[],y=Math.ceil(Math.abs(C)/o),S=c();h(S,C/y,A);const j=g();E(j,l);const O=g();E(O,i);for(let h=0;h<y;h++){const e=g();E(e,O),m(j,j,S),b(O,t,j);const i=g();E(i,O),L.push([e,i])}e.geometry=L}e([l()],F.prototype,"view",void 0),e([l({constructOnly:!0})],F.prototype,"isDecoration",void 0),e([l()],F.prototype,"analysisViewData",void 0),e([l()],F.prototype,"viewshedComputedData",void 0),e([l()],F.prototype,"visible",void 0),e([l()],F.prototype,"_color",null),e([l()],F.prototype,"_selected",null),e([l()],F.prototype,"_staged",null),F=e([n("esri.views.3d.analysis.Viewshed.ViewshedSubVisualization")],F);const U=F;export{U as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{equals as i}from"../../../../core/lang.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{property as l,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as c,set as d,sub as u,len as p,normalize as v,scale as _,angle as V,negate as f,copy as E,add as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,clone as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as C}from"../../../../support/elevationInfoUtils.js";import{isOtherViewshedToolCreating as A}from"./analysisViewRegister.js";import{viewshedVisualizationConfiguration as L,arcAnglePerSegment as D}from"./ViewshedConfiguration.js";import{ViewshedShapeVisualElement as y}from"./ViewshedShapeVisualElement.js";import{LineVisualElement as S}from"../../interactive/visualElements/LineVisualElement.js";import{PointVisualElement as j}from"../../interactive/visualElements/PointVisualElement.js";import{VerticesVisualElement as O}from"../../interactive/visualElements/VerticesVisualElement.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let F=class extends t{constructor(e){super(e),this.visible=!0,this._viewshedCorners={topLeft:g(),topRight:g(),bottomLeft:g(),bottomRight:g()},this._arcCenterPoints={top:g(),bottom:g(),left:g(),right:g()},this._parallelCenters={top:g(),bottom:g()}}initialize(){const e={view:this.view,isDecoration:!0},t={...e,color:this._color,renderOccluded:4},s={...t,stipplePattern:R(2)};this._observerVisualElement=new j({...e,...L.observerPointConfiguration,elevationInfo:C}),this._observerStagedVisualElement=new O({...e,...L.observerStagedPointConfiguration,spatialReference:this.view.renderCoordsHelper.spatialReference,elevationInfo:C}),this._shapeVisualElement=new y({...e,isDecoration:this.isDecoration}),this._frameLinesVisualElement=new S(t),this._leftArcVisualElement=new S(t),this._rightArcVisualElement=new S(t),this._topArcVisualElement=new S(t),this._bottomArcVisualElement=new S(t),this._centralLongitude=new S(s),this._centralLatitude=new S(s),this.addHandles([a(()=>{const e=this.viewshedComputedData,t=this._staged;if(null==e)return null;if(!e.valid)return{viewshedComputedData:e,staged:t,valid:!1};const i=this._viewshedCorners,s=this._arcCenterPoints,r=this._parallelCenters;return e.cornerPoints(i),e.arcCentersPoints(s),e.parallelCenterPoints(r),{viewshedComputedData:e,corners:i,arcCenters:s,parallelCenters:r,staged:t,valid:!0}},e=>{const t=!0===e?.valid,i=!t&&!0===e?.staged;this._forEachVisualElement(e=>e.attached=t),this._observerStagedVisualElement.attached=t||i,(t||i)&&this._updateVisualElements(e)},{initial:!0,equals:i}),a(()=>{const{viewshedComputedData:e}=this,{horizontalFieldOfView:t,verticalFieldOfView:i}=e??{};return{viewshedComputedData:e,horizontalFieldOfView:t,verticalFieldOfView:i}},({viewshedComputedData:e})=>{const{_shapeVisualElement:t}=this;e!==t.viewshedComputedData&&(t.viewshedComputedData=e),this._shapeVisualElement.recreateGeometry()},o),a(()=>{const{interactive:e}=this.analysisViewData;return{visible:this.visible,selected:e&&this._selected,staged:e&&this._staged,horFovNot360:360!==this.viewshedComputedData?.horizontalFieldOfView}},({visible:e,selected:t,staged:i,horFovNot360:s})=>{const r=t||i;this._shapeVisualElement.visible=e,this._topArcVisualElement.visible=e,this._bottomArcVisualElement.visible=e,this._frameLinesVisualElement.visible=e&&s;const a=e&&(t||s);this._leftArcVisualElement.visible=a,this._rightArcVisualElement.visible=a,this._forEachLineVisualElement(e=>{e.width=r?L.frameWidthSelected:L.frameWidthNotSelected,e.renderOccluded=t?4:1}),[this._centralLatitude,this._centralLongitude].forEach(i=>{i.width=2*(r?L.frameWidthSelected:L.frameWidthNotSelected),i.visible=e&&t})},o),a(()=>{const{analysisViewData:{interactive:e,toolActive:t,toolCreating:i},_selected:s,_staged:r,visible:a}=this,o=s||r,l=!t&&A(this.view,this.analysisViewData);return{observerVisible:a&&!o&&(!e||i||l),observerStagedVisible:r,color:this._color}},({observerVisible:e,observerStagedVisible:t,color:i})=>{this._observerVisualElement.visible=e,this._observerStagedVisualElement.visible=t,this._forEachLineVisualElement(e=>e.color=i)},o)])}get _color(){const{viewshedComputedData:e,_selected:t,analysisViewData:i}=this;if(null==e)return L.frameColor.toUnitRGBA();const s=i.toolActive||i.interactive,r=e.viewshed===i.stagedViewshed;return(s&&(t||r)?this.view.effectiveTheme.accentColor:L.frameColor).toUnitRGBA()}get _selected(){const{viewshedComputedData:e,analysisViewData:{selectedViewshedComputedData:t}}=this;return null!=e&&e===t}get _staged(){const{analysisViewData:e,viewshedComputedData:t}=this,{toolCreating:i,stagedViewshed:s}=e;return i&&s===t?.viewshed}destroy(){this._observerVisualElement=r(this._observerVisualElement),this._observerStagedVisualElement=r(this._observerStagedVisualElement),this._shapeVisualElement=r(this._shapeVisualElement),this._frameLinesVisualElement=r(this._frameLinesVisualElement),this._leftArcVisualElement=r(this._leftArcVisualElement),this._rightArcVisualElement=r(this._rightArcVisualElement),this._topArcVisualElement=r(this._topArcVisualElement),this._bottomArcVisualElement=r(this._bottomArcVisualElement),this._centralLongitude=r(this._centralLongitude),this._centralLatitude=r(this._centralLatitude)}_forEachLineVisualElement(e){[this._frameLinesVisualElement,this._leftArcVisualElement,this._rightArcVisualElement,this._topArcVisualElement,this._bottomArcVisualElement,this._centralLatitude,this._centralLongitude].forEach(e)}_forEachVisualElement(e){this._forEachLineVisualElement(e),e(this._observerVisualElement),e(this._observerStagedVisualElement),e(this._shapeVisualElement)}_updateObserverVisualElements(e){const{viewshedComputedData:t}=e,i=g();this.view.renderCoordsHelper.toRenderCoords(t.elevationAlignedObserver,i),this._observerVisualElement.geometry=t.elevationAlignedObserver,this._observerStagedVisualElement.vertices=[i]}_updateVisualElements(e){if(this._updateObserverVisualElements(e),!e.valid)return;const{viewshedComputedData:t,corners:i,arcCenters:s,parallelCenters:r}=e;this._shapeVisualElement.updateTransform(),this._updateFrameLines(t,i),this._updateFrameArcs(t,i,r),this._updateCentralHelperArcs(t,s)}_updateFrameLines(e,t){const i=e.elevationAlignedObserverRenderSpace;this._frameLinesVisualElement.geometry=[[i,t.topLeft],[i,t.topRight],[i,t.bottomLeft],[i,t.bottomRight]]}_updateFrameArcs(e,t,i){const{elevationAlignedObserverRenderSpace:r,rightVector:a,horizontalFieldOfView:o,tiltedUpVector:l}=e,n=s(o),u=g(),p=m();h(p,n/2,l),c(u,a,p),P(this._leftArcVisualElement,r,t.bottomLeft,t.topLeft,"forward",u),h(p,-n/2,l),d(u,0,0,0),c(u,a,p),P(this._rightArcVisualElement,r,t.bottomRight,t.topRight,"forward",u);const v=o>180?"backward":"forward";P(this._topArcVisualElement,i.top,t.topRight,t.topLeft,v,l),P(this._bottomArcVisualElement,i.bottom,t.bottomRight,t.bottomLeft,v,l)}_updateCentralHelperArcs(e,t){const i=e.elevationAlignedObserverRenderSpace,s=e.horizontalFieldOfView>=180?"backward":"forward";P(this._centralLatitude,i,t.right,t.left,s,e.tiltedUpVector),P(this._centralLongitude,i,t.top,t.bottom,"forward",e.leftVector)}get test(){}};function P(e,t,i,s,r,a,o=D){const l=g();u(l,i,t);const n=p(l),d=g();u(d,s,t),v(d,d),_(d,d,n);let C=V(l,d);const A=w(a);"backward"===r&&(f(A,A),C=-(2*Math.PI-C));const L=[],y=Math.ceil(Math.abs(C)/o),S=m();h(S,C/y,A);const j=g();E(j,l);const O=g();E(O,i);for(let h=0;h<y;h++){const e=g();E(e,O),c(j,j,S),b(O,t,j);const i=g();E(i,O),L.push([e,i])}e.geometry=L}e([l()],F.prototype,"view",void 0),e([l({constructOnly:!0})],F.prototype,"isDecoration",void 0),e([l()],F.prototype,"analysisViewData",void 0),e([l()],F.prototype,"viewshedComputedData",void 0),e([l()],F.prototype,"visible",void 0),e([l()],F.prototype,"_color",null),e([l()],F.prototype,"_selected",null),e([l()],F.prototype,"_staged",null),F=e([n("esri.views.3d.analysis.Viewshed.ViewshedSubVisualization")],F);const U=F;export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import{makeHandle as i}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{when as a,syncAndInitial as o,watch as l,sync as r,initial as d}from"../../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as c}from"../../../../core/units.js";import{property as h,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import g from"../../../../geometry/Point.js";import{creationVerticalOffset as m}from"./ViewshedConfiguration.js";import{ViewshedSubTool as v}from"./ViewshedSubTool.js";import{computeParametersFromTargetPoint as w}from"./viewshedToolUtils.js";import{Manipulator3D as _}from"../../interactive/Manipulator3D.js";import{Settings as V}from"../../interactive/editingTools/settings.js";import{ExtendedLineVisualElement as b}from"../../interactive/visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as f}from"../../interactive/visualElements/LaserlineVisualElement.js";import{toGraphic as y}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{AnalysisToolBase as S}from"../../../interactive/AnalysisToolBase.js";import{sketchKeys as T}from"../../../interactive/keybindings.js";import{newToolIntersector as C}from"../../../interactive/ToolIntersector.js";import{createScreenPointArrayFromEvent as D}from"../../../support/screenUtils.js";const M=Symbol("interactionVisuals");let H=class extends S{constructor(e){super(e),this.removeIncompleteOnCancel=!1,this.automaticManipulatorSelection=!1,this.multiTouchEnabled=!1,this._stagedViewshed=null,this._stagedViewshedComputedData=null,this._placementMode=P,this._creationState=!1,this._interactionVisualElements=null,this._settings=new V({getTheme:()=>this.view.effectiveTheme}),this._selectedManipulator=null}initialize(){this._intersector=C(this.view.state.viewingMode),this._createInteractionVisuals();const e=this.analysisViewData.viewshedComputedDataHandles;this.subToolHandles=s(()=>e,({viewshedComputedData:e})=>{const t=new v({analysis:this.analysis,analysisViewData:this.analysisViewData,parentTool:this,view:this.view,viewshedComputedData:e});return{subTool:t,remove:()=>{this.selectedViewshed===e.viewshed&&(this.selectedViewshed=null),t.destroy()}}}),this.addHandles([a(()=>this._valid,()=>this.finishToolCreation(),o),l(()=>this._stagedViewshed,e=>{const t=this.analysisViewData.viewshedComputedDataHandles;this._stagedViewshedComputedData=null!=e&&null!=t?this._findSubTool(e)?.viewshedComputedData:null},o),this.analysis.viewsheds.on("after-remove",e=>{const t=this._stagedViewshed;null!=t&&e.item===t&&this.analysis.viewsheds.add(t)}),l(()=>this.firstGrabbedManipulator,e=>{if(null!=e){const t=this._findSubTool(e)?.viewshed;this.selectedViewshed=t,this._selectManipulator(e)}else this._selectedSubTool?.onManipulatorSelectionChanged()},r),l(()=>this.view.activeTool,e=>{e!==this&&null!=e&&(this.selectedViewshed=null)}),a(()=>{const e=this.selectedViewshedComputedData;return null==e?null:{subTool:this._selectedSubTool,observer:e.elevationAlignedObserverRenderSpace,target:e.elevationAlignedTargetRenderSpace}},e=>{const{subTool:t,observer:i,target:s}=e;t?.moveInteractionState.dragging?this._updateInteractionVisualsLocation(i,!0):t?.scaleOrientInteractionState.dragging&&this._updateInteractionVisualsLocation(s,!1)},d),l(()=>this.creating,()=>this.updateInteractionVisualsVisibility()),l(()=>this.selectedViewshed,e=>{const t=this._selectedManipulator,i=this._selectedSubTool;null==e?this._selectManipulator(null):null!=t&&i.hasManipulator(t)||this._selectManipulator(i.discManipulator)},d)])}destroy(){n(this.subToolHandles),this.removeHandles(M)}onDeactivate(){this.removeStaged(),this._creationState=!1}get updating(){return this.subToolHandles.some(({subTool:e})=>e.updating)}get _valid(){return this.analysisViewData.viewshedComputedDataHandles?.some(e=>e.viewshedComputedData.valid)??!1}get cursor(){return this.creating?"crosshair":null}get _selectedSubTool(){return this._findSubTool(this.selectedViewshed)}_selectManipulator(e){const t=this._selectedManipulator;t!==e&&(this._selectedManipulator=e,null!=t&&(t.selected=!1),null!=e&&(e.selected=!0),this._findSubTool(t)?.onManipulatorSelectionChanged(),this._selectedSubTool?.onManipulatorSelectionChanged())}get selectedViewshed(){return this.analysisViewData.selectedViewshed}set selectedViewshed(e){this.analysisViewData.selectedViewshed=e}get selectedViewshedComputedData(){return this._selectedSubTool?.viewshedComputedData}get stagedViewshed(){return this._stagedViewshed}get grabbing(){return this.subToolHandles.some(({subTool:e})=>e.grabbing)}get creating(){return this._creationState&&this.active}get isPlacingTarget(){return"placing-target"===this._creationState}place(e){this.selectedViewshed=null,this._placementMode=e,this._creationState="placing-observer",this._finishToolCreationIfValid()}onManipulatorSelectionChanged(){this.subToolHandles.forEach(e=>e.subTool.onManipulatorSelectionChanged())}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":T.cancel===e.key?this._cancelKeyHandler(e):T.delete.includes(e.key)&&this._deleteKeyHandler();break;case"hold":this.updateInteractionVisualsVisibility(!0)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickPlacementHandler(e)}onActivate(){this._placementMode=P}_clickPlacementHandler(e){if(!this.creating||this.hasFocusedManipulators)return;const i=this._intersectScreen(e,I);if(null!=i){if("placing-observer"===this._creationState){const e=c(i.mapPoint.spatialReference);i.mapPoint.z=(i.mapPoint.z??0)+m/e;const s=new t({observer:i.mapPoint.clone(),feature:i.feature});this.analysis.viewsheds.add(s),this._stagedViewshed=s,this._creationState="placing-target",this._updateStagedViewshed(i.scenePoint)}else if("placing-target"===this._creationState){this._updateStagedViewshed(i.scenePoint);const e=this._stagedViewshed;this._stagedViewshed=null,"multiple"===this._placementMode?this._creationState="placing-observer":(this._creationState=!1,this._stagedViewshed=null,this._finishToolCreationIfValid(),this.view.activeTool=null),this.selectedViewshed=e}e.stopPropagation()}}_doubleClickHandler(e){this.creating&&(this.removeStaged(),this._creationState=!1,this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(!this.creating)return;const t=this._intersectScreen(e,I);null!=t&&(this._updateInteractionVisualsLocation(t.scenePoint,!1),this._updateStagedViewshed(t.scenePoint))}_cancelKeyHandler(e){this.creating?this._onCancelWhileCreating(e):this.grabbing||(this.selectedViewshed=null,e.stopPropagation())}_onCancelWhileCreating(e){const t=this.removeStaged();this._finishToolCreationIfValid(),t?(this._creationState="placing-observer",this.selectedViewshed=null,"multiple"===this._placementMode&&e.stopPropagation()):this._creationState=!1}_deleteKeyHandler(){this.creating&&(this.removeStaged(),this._creationState="placing-observer"),null!=this.selectedViewshed&&this.analysis.viewsheds.remove(this.selectedViewshed)}_finishToolCreationIfValid(){this._valid&&this.finishToolCreation()}_updateStagedViewshed(e){const t=this._stagedViewshed,i=this._stagedViewshedComputedData;if(null==t||null==i)return;const{heading:s,tilt:n,farDistance:a}=w(this.view,i,e);t.farDistance=a,t.tilt=n,t.heading=s}removeStaged(){const e=this._stagedViewshed;return null!=e&&(this._stagedViewshed=null,this.analysis.viewsheds.remove(e),!0)}_intersectScreen(e,t){const i=D(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(i,this._intersector);const s=this._intersector.results.min,n=t.scenePoint;if(!s.getIntersectionPoint(n))return null;const a=t.mapPoint;return a.spatialReference=this.view.spatialReference,this.view.renderCoordsHelper.fromRenderCoords(n,a),null==a?null:(t.feature=y(s,this.view),t)}_createInteractionVisuals(){this.removeHandles(M);const e=this._settings.visualElements,t=new f({view:this.view,attached:!1,style:{glowWidth:e.heightPlane.glowWidth,innerWidth:e.heightPlane.innerWidth},isDecoration:!0}),s=new b({view:this.view,extensionType:e.zVerticalLine.extensionType,attached:!1,innerWidth:1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._interactionVisualElements={laserline:t,verticalLine:s},this.addHandles([l(()=>e.zVerticalLine,e=>e.apply(s),o),l(()=>e.heightPlane,e=>e.apply(t),o),i(()=>{t.destroy(),s.destroy(),this._interactionVisualElements=null})],M)}updateInteractionVisualsVisibility(e=!1){const t=this.creating,i=this.analysisViewData.visible,s=this._selectedSubTool,n=this.selectedViewshedComputedData,a=(e,t)=>{const i=this._interactionVisualElements;null!=i&&(i.verticalLine.attached=t,i.laserline.attached=e)};if(t)return void a(i,!1);if(null==s||null==n)return void a(!1,!1);const o=s.moveInteractionState,l=e?o.grabbing:o.dragging,r=s.scaleOrientInteractionState,d=e?r.grabbing:r.dragging,c=i&&(l||d);if(a(c,l),c){const e=l?n.elevationAlignedObserverRenderSpace:n.elevationAlignedTargetRenderSpace;this._updateInteractionVisualsLocation(e,l)}}_updateInteractionVisualsLocation(e,t){const i=this._interactionVisualElements;if(null==i)return;const{laserline:s,verticalLine:n}=i;s.heightManifoldTarget=e,s.intersectsWorldUpAtLocation=t?e:null,null!=e&&n.setStartEndFromWorldDownAtLocation(e)}_findSubTool(e){if(null==e)return null;const t=e instanceof _?t=>t.subTool.hasManipulator(e):t=>t.subTool.viewshed===e;return this.subToolHandles?.find(t)?.subTool}get test(){}};e([h()],H.prototype,"updating",null),e([h({constructOnly:!0})],H.prototype,"view",void 0),e([h()],H.prototype,"analysisViewData",void 0),e([h()],H.prototype,"removeIncompleteOnCancel",void 0),e([h()],H.prototype,"automaticManipulatorSelection",void 0),e([h()],H.prototype,"multiTouchEnabled",void 0),e([h({constructOnly:!0})],H.prototype,"analysis",void 0),e([h()],H.prototype,"subToolHandles",void 0),e([h()],H.prototype,"_stagedViewshed",void 0),e([h()],H.prototype,"_stagedViewshedComputedData",void 0),e([h()],H.prototype,"_placementMode",void 0),e([h()],H.prototype,"_creationState",void 0),e([h()],H.prototype,"_valid",null),e([h({readOnly:!0})],H.prototype,"cursor",null),e([h()],H.prototype,"_selectedManipulator",void 0),e([h()],H.prototype,"_selectedSubTool",null),e([h()],H.prototype,"selectedViewshed",null),e([h()],H.prototype,"selectedViewshedComputedData",null),e([h()],H.prototype,"stagedViewshed",null),e([h()],H.prototype,"grabbing",null),e([h()],H.prototype,"creating",null),e([h()],H.prototype,"isPlacingTarget",null),H=e([u("esri.views.3d.analysis.Viewshed.ViewshedTool")],H);const I={mapPoint:new g,scenePoint:p(),feature:null},P="multiple",j=H;export{j as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{detachToolFromView as r}from"./toolLifecycleUtils.js";import{ViewshedEditTool as n}from"./ViewshedEditTool.js";import{ViewshedPlacementController as d}from"./ViewshedPlacementController.js";let c=class extends e{constructor(t){super(t),this._editTool=null}initialize(){const{view:t}=this;this._placementController=new d({analysis:this.analysis,analysisViewData:this.analysisViewData,view:t,callbacks:{cancelTool:()=>{null!=t.activeTool&&(t.activeTool=null)},findViewshedComputedData:t=>this._findViewshedComputedData(t),isToolDestroyed:()=>this.destroyed,setSelectedViewshed:t=>{this.analysisViewData.selectedViewshed=t}}}),this.addHandles([o(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:e,interactive:i})=>{if(!i)return this._placementController.cancelPlaceOperation(),void this._destroyEditTool();null==e?this._editTool||(this._editTool=new n({analysis:this.analysis,analysisViewData:this.analysisViewData,view:t}),t.tools.add(this._editTool)):this._destroyEditTool()},s),o(()=>t.activeTool,t=>{null!=t&&t!==this._editTool&&null==this._placementController.creationState&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),i(this._placementController)}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._placementController.updating||!!this._editTool?.updating}get creating(){return null!=this._placementController.creationState}async place(t,e){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(t,e),"single"===t)return{}}_findViewshedComputedData(t){return this.analysisViewData.viewshedComputedDataHandles?.find(e=>e.viewshedComputedData.viewshed===t)?.viewshedComputedData}_destroyEditTool(){const t=this._editTool;this._editTool=null,null!=t&&(r(this.view,t),i(t))}get test(){}};t([a({constructOnly:!0})],c.prototype,"view",void 0),t([a({constructOnly:!0})],c.prototype,"analysis",void 0),t([a({constructOnly:!0})],c.prototype,"analysisViewData",void 0),t([a()],c.prototype,"_placementController",void 0),t([a()],c.prototype,"_editTool",void 0),t([a()],c.prototype,"selectedViewshedComputedData",null),t([a()],c.prototype,"stagedViewshed",null),t([a()],c.prototype,"active",null),t([a()],c.prototype,"updating",null),t([a()],c.prototype,"creating",null),c=t([l("esri.views.3d.analysis.Viewshed.ViewshedTool")],c);const p=c;export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{mapCollection as o}from"../../../core/mapCollectionUtils.js";import{abortMaybe as r,destroyMaybe as l}from"../../../core/maybe.js";import{watch as a,initial as d,when as n,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as p,subclass as w}from"../../../core/accessorSupport/decorators.js";import{copy as u,exactEquals as c}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as m,isLoaded as V}from"../../../geometry/projectionUtils.js";import _ from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as g}from"./support/projectionUtils.js";import{registerAnalysisView as f,unselectViewshedInOtherAnalysisViews as y}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as b}from"./Viewshed/ViewshedComputedData.js";import j from"./Viewshed/ViewshedTool.js";import R from"./Viewshed/ViewshedTool2.js";import{ViewshedVisualization as D}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as O}from"../support/elevationUpdateUtils.js";import{Intersector as T}from"../webgl-engine/lib/Intersector.js";import{Viewshed as C}from"../webgl-engine/lib/Viewshed.js";import{connectAnalysisViewToTool as N,removeAnalysisViewTool as F,startPlaceOperation as A}from"../../analysis/analysisViewUtils.js";let S=class extends _{constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this.tool=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._useNewViewshedTool=!!has("enable-feature:analysis-new-viewshed-tool"),this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get effectiveTool(){return this.tool??this._tool??null}get stagedViewshed(){return this._tool?.stagedViewshed??this.tool?.stagedViewshed??null}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){const t=null!=e&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData??this.tool?.selectedViewshedComputedData??null}get updating(){return!!this.effectiveTool?.updating}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this.addHandles(f(e,this)),this._viewshedRenderNode=new C({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new T(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=o(()=>this.analysis.viewsheds,t=>{const s=new b({view:e,viewshed:t}),o=Symbol();return this.addHandles([a(()=>({valid:s.valid,canProject:m(s.observer?.spatialReference,this.view.spatialReference)||V()}),({valid:e,canProject:t},o)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):o?.valid&&o?.canProject&&this._removeViewshedsFromRenderer(s),t||g(this.analysis,s.observer.spatialReference,i.getLogger(this)))},d),O({view:e,geometry:s.observer,onElevationChanges:()=>s.onElevationChange()}),a(()=>[e.state.camera,e.slice.plane,s.elevationAlignedObserverRenderSpace,s.elevationAlignedTargetRenderSpace,s.verticalFieldOfView,s.horizontalFieldOfView,s.feature],()=>{this._updateObserverFromFeature(e,s)},d)],o),{viewshedComputedData:s,remove:()=>{this.selectedViewshed===s.viewshed&&(this.selectedViewshed=null),this.removeHandles(o),this._removeViewshedsFromRenderer(s),s.destroy()}}}),this._visualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._useNewViewshedTool&&(this._tool=new R({analysis:this.analysis,analysisViewData:this,view:e})),this.addHandles([a(()=>this.visible,e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)}),...this._useNewViewshedTool?[]:[N(this,j)],n(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=r(this.userOperation),this._useNewViewshedTool?this._tool=l(this._tool):F(this),this._visualization=l(this._visualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map(e=>e.viewshedComputedData).toArray())}async createViewsheds(e){if(this._useNewViewshedTool)return this._tool.place("multiple",e);await A(this,{placementOptions:e,onToolActivated:e=>e.place("multiple")})}place(e){return this._useNewViewshedTool?this._tool.place("single",e):A(this,{placementOptions:e,onToolActivated:e=>e.place("single")})}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const o=i.elevationAlignedObserverRenderSpace,r=i.elevationAlignedTargetRenderSpace,l=u(v(),o),a={observer:o,observerSurfaceNormal:null,observerAdjusted:l,observerFeatureId:t(i.feature),target:r,targetSurfaceNormal:null,targetAdjusted:u(v(),r),targetFeatureId:null};s(e,this._intersector,a,e=>Math.min(e,.05*i.farDistanceRenderSpace)),i.observerRenderSpaceOverride=c(l,o)?null:l}_unselectOtherViewsheds(e){null!=e&&y(this.view,this)}get test(){}};e([p({readOnly:!0})],S.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],S.prototype,"analysis",void 0),e([p()],S.prototype,"tool",void 0),e([p()],S.prototype,"_tool",void 0),e([p()],S.prototype,"stagedViewshed",null),e([p()],S.prototype,"_selectedViewshed",void 0),e([p()],S.prototype,"selectedViewshed",null),e([p()],S.prototype,"selectedViewshedComputedData",null),e([p()],S.prototype,"viewshedComputedDataHandles",void 0),e([p()],S.prototype,"userOperation",void 0),e([p()],S.prototype,"updating",null),e([p()],S.prototype,"_visualization",void 0),e([p()],S.prototype,"_viewshedRenderNode",void 0),S=e([w("esri.views.3d.analysis.ViewshedAnalysisView3D")],S);const H=S;export{H as default};
2
+ import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{mapCollection as r}from"../../../core/mapCollectionUtils.js";import{abortMaybe as o,destroyMaybe as a}from"../../../core/maybe.js";import{watch as d,initial as l,when as n,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{copy as u,exactEquals as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as m,isLoaded as V}from"../../../geometry/projectionUtils.js";import g from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as _}from"./support/projectionUtils.js";import{registerAnalysisView as y,unselectViewshedInOtherAnalysisViews as f}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as b}from"./Viewshed/ViewshedComputedData.js";import j from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as R}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as D}from"../support/elevationUpdateUtils.js";import{Intersector as C}from"../webgl-engine/lib/Intersector.js";import{Viewshed as O}from"../webgl-engine/lib/Viewshed.js";let F=class extends g{constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){const t=null!=e&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this.addHandles(y(e,this)),this._viewshedRenderNode=new O({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new C(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=r(()=>this.analysis.viewsheds,t=>{const s=new b({view:e,viewshed:t}),r=Symbol();return this.addHandles([d(()=>({valid:s.valid,canProject:m(s.observer?.spatialReference,this.view.spatialReference)||V()}),({valid:e,canProject:t},r)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):r?.valid&&r?.canProject&&this._removeViewshedsFromRenderer(s),t||_(this.analysis,s.observer.spatialReference,i.getLogger(this)))},l),D({view:e,geometry:s.observer,onElevationChanges:()=>s.onElevationChange()}),d(()=>[e.state.camera,e.slice.plane,s.elevationAlignedObserverRenderSpace,s.elevationAlignedTargetRenderSpace,s.verticalFieldOfView,s.horizontalFieldOfView,s.feature],()=>{this._updateObserverFromFeature(e,s)},l)],r),{viewshedComputedData:s,remove:()=>{this.selectedViewshed===s.viewshed&&(this.selectedViewshed=null),this.removeHandles(r),this._removeViewshedsFromRenderer(s),s.destroy()}}}),this._visualization=new R({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new j({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([d(()=>this.visible,e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)}),n(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=o(this.userOperation),this._tool=a(this._tool),this._visualization=a(this._visualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map(e=>e.viewshedComputedData).toArray())}async createViewsheds(e){return this._tool.place("multiple",e)}place(e){return this._tool.place("single",e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.elevationAlignedObserverRenderSpace,o=i.elevationAlignedTargetRenderSpace,a=u(w(),r),d={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(w(),o),targetFeatureId:null};s(e,this._intersector,d,e=>Math.min(e,.05*i.farDistanceRenderSpace)),i.observerRenderSpaceOverride=v(a,r)?null:a}_unselectOtherViewsheds(e){null!=e&&f(this.view,this)}get test(){}};e([p({readOnly:!0})],F.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],F.prototype,"analysis",void 0),e([p()],F.prototype,"_tool",void 0),e([p()],F.prototype,"toolActive",null),e([p()],F.prototype,"toolCreating",null),e([p()],F.prototype,"stagedViewshed",null),e([p()],F.prototype,"_selectedViewshed",void 0),e([p()],F.prototype,"selectedViewshed",null),e([p()],F.prototype,"selectedViewshedComputedData",null),e([p()],F.prototype,"viewshedComputedDataHandles",void 0),e([p()],F.prototype,"userOperation",void 0),e([p()],F.prototype,"updating",null),e([p()],F.prototype,"_visualization",void 0),e([p()],F.prototype,"_viewshedRenderNode",void 0),F=e([c("esri.views.3d.analysis.ViewshedAnalysisView3D")],F);const A=F;export{A as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as R}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{a as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new R,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computation.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new x({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as R}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{t as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new R,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computation.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new x({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import l from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{isPromiseLike as c}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as u,formatDecimal as m}from"../../../../core/quantityFormatUtils.js";import{watch as d,initial as h}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as p}from"../../../../core/units.js";import{property as g,subclass as y}from"../../../../core/accessorSupport/decorators.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f,normalize as v,subtract as j,cross as V,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as L,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{computeTranslationToOriginAndRotation as G}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{angleAroundAxis as P}from"../../../../geometry/support/vector.js";import{a as F}from"../../../../chunks/vec3.js";import x from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as R}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as A}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as U}from"../../layers/graphics/extrudeUtils.js";import{polygonToRenderInfoElevationAligned as E}from"../../support/renderInfoUtils/polygon.js";import{CutFillVisualization as S,VolumeGeometry as z}from"../../webgl-engine/lib/CutFillVisualization.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";let B=class extends l{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get inView(){return this.analysisViewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.analysisViewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let l=-1/0;for(const o of i.rings)for(const e of o)l=Math.max(l,e[2]);const n=1,r=e.getAltitude(t.fill);return{cut:s,fill:Math.min(r-l,0)-n}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new C,this._elevationContext=A.fromElevationInfo(new x({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,l={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...l,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new D(l);const n={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},r={...n,stipplePattern:H(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new R({...n,color:a}),this._occludedCutProjectionLines=new R({...r,color:a}),this._fillProjectionLines=new R({...n,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new R({...r,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new O({...u,distance:s.labelDistance}),this._fillVolumeLabel=new O({...u,distance:-s.labelDistance}),this._cutFillVisualization=new S({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([d(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},h),d(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._cutFillVisualization.measureType=i},h),d(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),h),d(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},h),d(()=>[this.analysisViewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),h),d(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),h),d(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),d(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),h),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._cutFillVisualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],l=[],r=[],a=[],c=[],u=e.spatialReference;for(let m=0;m<e.rings.length;m++){const i=e.rings[m],d=i.length>1&&n(i[0],i[i.length-1]),h=i.length-(d?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],l=f(L(),o[0],o[1],o[2]);s.toRenderCoords(l,u,l);const n=t.rings[m][e],r=f(L(),n[0],n[1],n[2]);s.toRenderCoords(r,u,r);const a=new M(l,r);p.push(a)}const g=this.view.state.camera;for(let e=0;e<p.length;++e){const s=p[e],n=p[0===e?p.length-1:e-1],u=p[e===p.length-1?0:e+1],d=i[e],h=t.rings[m][e],y=d[2]>h[2],_=new T(s,n,u,y);o.push(_),_.updateOccluded(g);const f=_.isOccluded;y?(f?r:l).push(s):(f?c:a).push(s)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(l),this._occludedCutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let l=!1,n=!1;for(const r of this._projectionLines){r.updateOccluded(e)&&(l||=r.isCut,n||=!r.isCut);const a=r.isOccluded;(r.isCut?a?i:t:a?o:s).push(r.segment)}n&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),l&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:l,fillColor:n,cutColorMuted:r,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._cutFillVisualization.cutColor=i?l:r,this._cutFillVisualization.fillColor=i?n:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillVisualization.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:r).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._cutFillVisualization.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:l,result:n,visible:r}=e;if(this._cutVolumeLabel.visible=r,this._fillVolumeLabel.visible=r,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==n||null==o||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:I(l,n.cutVolume,a)}),u=i(o.labels.fill,{volume:I(l,n.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._cutFillVisualization.enable():this._cutFillVisualization.disable()}get _polygonRenderInfo(){const{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:i}=this.analysisViewData;if(null==i)return null;const s=E(i,t,e,this._elevationContext,{outlineOutput:"tessellated-indices"});return c(s)?(this._updatingHandles.consumePromise(s),null):s}_updateCutFillGeometry(){const{view:e,analysisViewData:t,inView:i}=this,{renderCoordsHelper:s}=e,{targetGeometry:o}=t,{cut:l,fill:n}=this._extrusionHeights;if(!o?.extent||!i)return;const{center:r}=o.extent,a=w(r.x,r.y,0),c=L();s.toRenderCoords(a,o.spatialReference,c);const u=this._getExtrudedVolume(l,a,c),m=this._getExtrudedVolume(n,a,c);null!=u&&null!=m&&this._cutFillVisualization.updateGeometries(u,m,c)}_getExtrudedVolume(e,t,i){const{renderCoordsHelper:s,spatialReference:o}=this.view,l=L(),n=1===s.viewingMode;s.worldUpAtPosition(i,l);const{_polygonRenderInfo:r}=this;if(null==r)return null;const a=U(r,{height:e,worldUp:l,spherical:n,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(null==a)return null;const c=_(),u=_();if(G(o,t,c,s.spatialReference),u[12]=-c[12],u[13]=-c[13],u[14]=-c[14],F(a.vertices,a.vertices,u),"stockpile"===this.analysis.measureType)for(let m=0;m<a.normals.length;m+=3)a.normals[m]=l[0],a.normals[m+1]=l[1],a.normals[m+2]=l[2];return new z(a.vertices,a.bottomIndices,a.indices,a.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,i){if(!t||!e)return null;const s=p(t.value,t.unit,i),o=u(s);return m(e,t,s,o)}e([g({constructOnly:!0})],B.prototype,"view",void 0),e([g({constructOnly:!0})],B.prototype,"analysis",void 0),e([g({constructOnly:!0})],B.prototype,"analysisViewData",void 0),e([g()],B.prototype,"unitsMessages",void 0),e([g()],B.prototype,"messages",void 0),e([g()],B.prototype,"loadingMessages",void 0),e([g({readOnly:!0})],B.prototype,"_updatingHandles",void 0),e([g({readOnly:!0})],B.prototype,"visible",null),e([g()],B.prototype,"inView",null),e([g()],B.prototype,"updating",null),e([g()],B.prototype,"hasUnsupportedError",null),e([g()],B.prototype,"_extrusionHeights",null),e([g()],B.prototype,"_polygonRenderInfo",null),B=e([y("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],B);class T{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=L(),this._n2=L();const o=v(q,j(q,e.endRenderSpace,e.startRenderSpace));v(this._n1,V(this._n1,o,v(k,j(k,t.startRenderSpace,e.startRenderSpace)))),v(this._n2,V(this._n2,o,v(k,j(k,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(P(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){j(q,this.segment.startRenderSpace,e.eye);const t=b(this._n1,q)<0,i=b(this._n2,q)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const q=L(),k=L();export{B as VolumeMeasurementCutFillVisualization};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import l from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{isPromiseLike as c}from"../../../../core/promiseUtils.js";import{preferredVolumePrecision as u,formatDecimal as m}from"../../../../core/quantityFormatUtils.js";import{watch as d,initial as h}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as p}from"../../../../core/units.js";import{property as g,subclass as y}from"../../../../core/accessorSupport/decorators.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f,normalize as v,subtract as j,cross as V,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as L,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import{computeTranslationToOriginAndRotation as G}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{angleAroundAxis as P}from"../../../../geometry/support/vector.js";import{t as F}from"../../../../chunks/vec3.js";import x from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as R}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as M}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as A}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as U}from"../../layers/graphics/extrudeUtils.js";import{polygonToRenderInfoElevationAligned as E}from"../../support/renderInfoUtils/polygon.js";import{CutFillVisualization as S,VolumeGeometry as z}from"../../webgl-engine/lib/CutFillVisualization.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";let B=class extends l{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get inView(){return this.analysisViewData.analysisObb?.intersectsFrustum(this.view.frustum)??!1}get updating(){return this.loadingMessages||this._updatingHandles.updating}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.analysisViewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let l=-1/0;for(const o of i.rings)for(const e of o)l=Math.max(l,e[2]);const n=1,r=e.getAltitude(t.fill);return{cut:s,fill:Math.min(r-l,0)-n}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._updatingHandles=new C,this._elevationContext=A.fromElevationInfo(new x({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,l={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...l,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new D(l);const n={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},r={...n,stipplePattern:H(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new R({...n,color:a}),this._occludedCutProjectionLines=new R({...r,color:a}),this._fillProjectionLines=new R({...n,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new R({...r,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new O({...u,distance:s.labelDistance}),this._fillVolumeLabel=new O({...u,distance:-s.labelDistance}),this._cutFillVisualization=new S({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([d(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},h),d(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._cutFillVisualization.measureType=i},h),d(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),h),d(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},h),d(()=>[this.analysisViewData.targetGeometry,this.inView,this._extrusionHeights,this._polygonRenderInfo],()=>this._updateCutFillGeometry(),h),d(()=>this.visible&&this.inView&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),h),d(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),d(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),h),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._cutFillVisualization.destroy(),this._updatingHandles.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],l=[],r=[],a=[],c=[],u=e.spatialReference;for(let m=0;m<e.rings.length;m++){const i=e.rings[m],d=i.length>1&&n(i[0],i[i.length-1]),h=i.length-(d?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],l=f(L(),o[0],o[1],o[2]);s.toRenderCoords(l,u,l);const n=t.rings[m][e],r=f(L(),n[0],n[1],n[2]);s.toRenderCoords(r,u,r);const a=new M(l,r);p.push(a)}const g=this.view.state.camera;for(let e=0;e<p.length;++e){const s=p[e],n=p[0===e?p.length-1:e-1],u=p[e===p.length-1?0:e+1],d=i[e],h=t.rings[m][e],y=d[2]>h[2],_=new T(s,n,u,y);o.push(_),_.updateOccluded(g);const f=_.isOccluded;y?(f?r:l).push(s):(f?c:a).push(s)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(l),this._occludedCutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let l=!1,n=!1;for(const r of this._projectionLines){r.updateOccluded(e)&&(l||=r.isCut,n||=!r.isCut);const a=r.isOccluded;(r.isCut?a?i:t:a?o:s).push(r.segment)}n&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),l&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:l,fillColor:n,cutColorMuted:r,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._cutFillVisualization.cutColor=i?l:r,this._cutFillVisualization.fillColor=i?n:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillVisualization.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:r).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._cutFillVisualization.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:l,result:n,visible:r}=e;if(this._cutVolumeLabel.visible=r,this._fillVolumeLabel.visible=r,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==n||null==o||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:I(l,n.cutVolume,a)}),u=i(o.labels.fill,{volume:I(l,n.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._cutFillVisualization.enable():this._cutFillVisualization.disable()}get _polygonRenderInfo(){const{renderCoordsHelper:e,elevationProvider:t}=this.view,{targetGeometry:i}=this.analysisViewData;if(null==i)return null;const s=E(i,t,e,this._elevationContext,{outlineOutput:"tessellated-indices"});return c(s)?(this._updatingHandles.consumePromise(s),null):s}_updateCutFillGeometry(){const{view:e,analysisViewData:t,inView:i}=this,{renderCoordsHelper:s}=e,{targetGeometry:o}=t,{cut:l,fill:n}=this._extrusionHeights;if(!o?.extent||!i)return;const{center:r}=o.extent,a=w(r.x,r.y,0),c=L();s.toRenderCoords(a,o.spatialReference,c);const u=this._getExtrudedVolume(l,a,c),m=this._getExtrudedVolume(n,a,c);null!=u&&null!=m&&this._cutFillVisualization.updateGeometries(u,m,c)}_getExtrudedVolume(e,t,i){const{renderCoordsHelper:s,spatialReference:o}=this.view,l=L(),n=1===s.viewingMode;s.worldUpAtPosition(i,l);const{_polygonRenderInfo:r}=this;if(null==r)return null;const a=U(r,{height:e,worldUp:l,spherical:n,requireElevation:!1,requireNormals:!0,requireSizes:!1});if(null==a)return null;const c=_(),u=_();if(G(o,t,c,s.spatialReference),u[12]=-c[12],u[13]=-c[13],u[14]=-c[14],F(a.vertices,a.vertices,u),"stockpile"===this.analysis.measureType)for(let m=0;m<a.normals.length;m+=3)a.normals[m]=l[0],a.normals[m+1]=l[1],a.normals[m+2]=l[2];return new z(a.vertices,a.bottomIndices,a.indices,a.normals)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,i){if(!t||!e)return null;const s=p(t.value,t.unit,i),o=u(s);return m(e,t,s,o)}e([g({constructOnly:!0})],B.prototype,"view",void 0),e([g({constructOnly:!0})],B.prototype,"analysis",void 0),e([g({constructOnly:!0})],B.prototype,"analysisViewData",void 0),e([g()],B.prototype,"unitsMessages",void 0),e([g()],B.prototype,"messages",void 0),e([g()],B.prototype,"loadingMessages",void 0),e([g({readOnly:!0})],B.prototype,"_updatingHandles",void 0),e([g({readOnly:!0})],B.prototype,"visible",null),e([g()],B.prototype,"inView",null),e([g()],B.prototype,"updating",null),e([g()],B.prototype,"hasUnsupportedError",null),e([g()],B.prototype,"_extrusionHeights",null),e([g()],B.prototype,"_polygonRenderInfo",null),B=e([y("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],B);class T{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=L(),this._n2=L();const o=v(q,j(q,e.endRenderSpace,e.startRenderSpace));v(this._n1,V(this._n1,o,v(k,j(k,t.startRenderSpace,e.startRenderSpace)))),v(this._n2,V(this._n2,o,v(k,j(k,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(P(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){j(q,this.segment.startRenderSpace,e.eye);const t=b(this._n1,q)<0,i=b(this._n2,q)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const q=L(),k=L();export{B as VolumeMeasurementCutFillVisualization};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isPromiseLike as r}from"../../core/promiseUtils.js";import{convertToSpatialReferenceUnit as e,convertFromSpatialReferenceUnit as t}from"../../core/units.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as s}from"../../geometry/ellipsoidUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import{execute as l}from"../../geometry/operators/gx/operatorDensify.js";import{fromPolygon as m,toPolygon as p}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as a}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{earth as c}from"../../geometry/support/Ellipsoid.js";import{a as u}from"../../chunks/vec3.js";import{StencilGeometry as f,StencilGeometryWithOrigin as g}from"./StencilGeometry.js";import{extrudePolygon as d}from"./layers/graphics/extrudeUtils.js";import{computeCentroid as j}from"./layers/graphics/graphicUtils.js";import{polygonToRenderInfoElevationAligned as h}from"./support/renderInfoUtils/polygon.js";const y=2e4;function x(o,i,x){const M=i.renderCoordsHelper,R=1===M.viewingMode,b=i.spatialReference,C=s(b).radius/c.radius,I=e(5e5*C,"meters",b,!0);R||M.worldUpAtPosition([0,0,0],U);const A=b.equals(o.spatialReference)?o:n(o,b),E=Math.max(A.extent.width,A.extent.height),O=t(E,b,"meters",!0),P=Math.max(5*O,y*C),S=v(A,P,R?C/10:C),T=j(S);if(null==T)return null;const k=m(S),z=l(k,I,0,0),D=p(z,b);if(null==D)return null;const G=h(D,i.elevationProvider,M,x,{outlineOutput:"tessellated-indices"});if(r(G))return G;if(null==G||0===G.polygonIndexCount)return null;a(b,[T.x,T.y,0],w,M.spatialReference),q[12]=-w[12],q[13]=-w[13],q[14]=-w[14];const H=d(G,{height:P,worldUp:U,spherical:R,requireElevation:!1,requireNormals:!1,requireSizes:!1});if(null==H)return null;u(H.vertices,H.vertices,q);const N=new f(H.vertices,H.bottomIndices,H.indices,P);return new g(N,[w[12],w[13],w[14]])}function v(r,e,t){const o=-12e5*t,i=Math.max(-e/2,o),s=r.rings.map(r=>r.map(r=>[r[0],r[1],i])),n=r.clone();return n.rings=s,n.hasZ=!0,n}const U=i(),w=o(),q=o();export{x as polygonToVolume};
2
+ import{isPromiseLike as r}from"../../core/promiseUtils.js";import{convertToSpatialReferenceUnit as e,convertFromSpatialReferenceUnit as t}from"../../core/units.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as s}from"../../geometry/ellipsoidUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import{execute as l}from"../../geometry/operators/gx/operatorDensify.js";import{fromPolygon as m,toPolygon as p}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as a}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{earth as c}from"../../geometry/support/Ellipsoid.js";import{t as u}from"../../chunks/vec3.js";import{StencilGeometry as f,StencilGeometryWithOrigin as g}from"./StencilGeometry.js";import{extrudePolygon as d}from"./layers/graphics/extrudeUtils.js";import{computeCentroid as j}from"./layers/graphics/graphicUtils.js";import{polygonToRenderInfoElevationAligned as h}from"./support/renderInfoUtils/polygon.js";const y=2e4;function x(o,i,x){const M=i.renderCoordsHelper,R=1===M.viewingMode,b=i.spatialReference,C=s(b).radius/c.radius,I=e(5e5*C,"meters",b,!0);R||M.worldUpAtPosition([0,0,0],U);const A=b.equals(o.spatialReference)?o:n(o,b),E=Math.max(A.extent.width,A.extent.height),O=t(E,b,"meters",!0),P=Math.max(5*O,y*C),S=v(A,P,R?C/10:C),T=j(S);if(null==T)return null;const k=m(S),z=l(k,I,0,0),D=p(z,b);if(null==D)return null;const G=h(D,i.elevationProvider,M,x,{outlineOutput:"tessellated-indices"});if(r(G))return G;if(null==G||0===G.polygonIndexCount)return null;a(b,[T.x,T.y,0],w,M.spatialReference),q[12]=-w[12],q[13]=-w[13],q[14]=-w[14];const H=d(G,{height:P,worldUp:U,spherical:R,requireElevation:!1,requireNormals:!1,requireSizes:!1});if(null==H)return null;u(H.vertices,H.vertices,q);const N=new f(H.vertices,H.bottomIndices,H.indices,P);return new g(N,[w[12],w[13],w[14]])}function v(r,e,t){const o=-12e5*t,i=Math.max(-e/2,o),s=r.rings.map(r=>r.map(r=>[r[0],r[1],i])),n=r.clone();return n.rings=s,n.hasZ=!0,n}const U=i(),w=o(),q=o();export{x as polygonToVolume};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{a as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as w,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as I}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as P,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as A}from"./extrudeUtils.js";import{Object3DEdgeState as U,Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as O}from"./Graphics3DSymbolLayer.js";import{computeCentroid as D}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as L}from"../support/symbolColorUtils.js";import{debugFlags as V}from"../../support/debugFlags.js";import{SamplePosition as R}from"../../support/ElevationProvider.js";import{loadTessellationUtils as B,preloadedPolygonToRenderInfoElevationAligned as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as T}from"../../webgl-engine/lib/Attribute.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as H}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as q,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends O{constructor(e,t,r,s){super(e,t,r,s,I(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new Z(c,this._context),p=new Z({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await B()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);L(r,r);const s=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),o=e(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new S(a,c,1/0,i,o)]}case"vertex":return[new w(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=M(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices",owner:this._context.layer});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=D(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=n(),C=d(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const S=n();i(S,y);const j=s();r(j,S);const I=new Map,E=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const O=this._getExtrusionSize(t),L=A(m,{height:O,worldUp:C,spherical:w,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==L)return;v(L.vertices,L.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new le(L.vertices,L.elevation,q(L.normals),L.sizes),B=Q(E,L.indices,L.indices.length-L.bottomIndices.length,R,o,V),T=m.vertexCount,N=L.polygonVertexCount,H=2*m.outlineSegmentCount,W=m.polygonIndexCount/3,Z=new ce(T,N,H,W);if(ee(B,Z,y),I.set(B,Z),h.push(B),L.bottomIndices.length>0&&h.push(Q(this._materials[1],L.bottomIndices,0,R,o,V)),u.push(R.heights),0===h.length)return null;const J=new k({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const K=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),X=K?new U(this._materials[0],K,this._context.slicePlaneEnabled):null,Y=new z(this,J,null,(e,t,r,s,i)=>$(e,t,r,s,i,u,I),a,X);return Y.alignedSampledElevation=m.sampledElevation,Y.needsElevationUpdates=P(a.mode),Y}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function Q(e,t,r,s,i,o){const{attributeIndices:n,drawIndices:a}=X(t),l=[["position",new T(s.positions,n,3,!0)],["normalCompressed",new T(s.normals,n,2,!0)]];if(e.parameters.hasSymbolColors){const e=C(n.length);l.push(["symbolColor",new T(i,e,4,!0)])}return new N(e,l,s.elevation,0,o,r,null,a)}function X(e){const t=new Array,r=new Map,s=new Array;for(let i=0;i<e.length;++i){const o=e[i];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:t,drawIndices:s}}const Y=d();function $(e,t,r,s,i,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=o(n(),y);for(let o=0,n=0;o<u;++o){const e=p[o],t=c.get(e);if(!t||!H(e))continue;const u=e.getMutableAttribute("position").data,b=l[n++],x=new R(e.mapPositions),_=u.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<_;t++){Y[0]=u[e],Y[1]=u[e+1],Y[2]=u[e+2],s(x,se),d&&(v+=se.sampledElevation),V.ENABLE_OPTIMIZATIONS?(a(te,u[e],u[e+1],u[e+2]),h(te,te,y),i.setAltitude(te,se.z+b[e/3]),h(te,te,f)):(a(te,x.array[x.offset],x.array[x.offset+1],se.z+b[e/3]),null!=r&&i.toRenderCoords(te,r,te),h(te,te,f)),u[e]=te[0],u[e+1]=te[1],u[e+2]=te[2];const t=ie/i.unitInMeters;(Math.abs(Y[0]-u[e])>=t||Math.abs(Y[1]-u[e+1])>=t||Math.abs(Y[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){ee(e,t,y),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position");const r=p[o+1],s=!c.has(r);r&&s&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/_}return g/u}function ee(e,t,r){const s=e.getMutableAttribute("position"),i=e.getMutableAttribute("normalCompressed").data,o=s.data,n=e.primitivePositionIndices,{topVertexStart:u,topVertexCount:d,topFaceStart:g,topFaceCount:y}=t,f=g+y,b=u+d,x=oe,_=ne,C=ae,v=re,w=te;a(w,0,0,0);const S=(e,t)=>{const s=3*e;a(t,o[s+0],o[s+1],o[s+2]),h(t,t,r)};for(let a=g;a<f;++a){const e=3*a;S(n[e+0],x[0]),S(n[e+1],x[1]),S(n[e+2],x[2]),l(_,x[1],x[0]),l(C,x[2],x[0]),c(v,_,C),m(w,w,v)}p(w,w);for(let a=u;a<b;++a){const e=w[0],t=w[1],r=w[2];W(i,a,e,t,r)}}const te=d(),re=d(),se=new E,ie=.01,oe=[d(),d(),d()],ne=d(),ae=d();class le{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}class ce{constructor(e,t,r,s){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer};
2
+ import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{normalFromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i,invertOrIdentity as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,sub as l,cross as c,add as m,normalize as p,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as f}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as x,intersectsClippingArea as _}from"../../../../geometry/support/aaBoundingBox.js";import{getZeroIndexArray as C}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as w,SnappingCandidateEdge as S}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as j}from"../../../../renderers/support/renderingInfoUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as I}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as P,SampleElevationInfo as E}from"./elevationAlignmentUtils.js";import{extrudePolygon as A}from"./extrudeUtils.js";import{Object3DEdgeState as U,Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as O}from"./Graphics3DSymbolLayer.js";import{computeCentroid as D}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as L}from"../support/symbolColorUtils.js";import{debugFlags as V}from"../../support/debugFlags.js";import{SamplePosition as R}from"../../support/ElevationProvider.js";import{loadTessellationUtils as B,preloadedPolygonToRenderInfoElevationAligned as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as T}from"../../webgl-engine/lib/Attribute.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as H}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as q,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends O{constructor(e,t,r,s){super(e,t,r,s,I(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?g:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new Z(c,this._context),p=new Z({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters(),await B()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);L(r,r);const s=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?j(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}_containsRenderableGeometry(e){return"polygonIndexCount"in e&&"outlineIndexCount"in e?e.polygonIndexCount>0||e.outlineIndexCount>0:super._containsRenderableGeometry(e)}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),o=e(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new S(a,c,1/0,i,o)]}case"vertex":return[new w(a,c,1/0),new S(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,o,a,l){const c=M(e.geometry);if(null==c)return null;if(0===c.rings.length||!c.rings.some(e=>e.length>0))return this._logGeometryValidationWarnings(c.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(c,this._context.elevationProvider,this._context.renderCoordsHelper,a,{outlineOutput:"tessellated-indices",owner:this._context.layer});if(null==m)return;this._logGeometryCreationWarnings(m,c.rings,"rings","ExtrudeSymbol3DLayer");const p=D(c);if(null==p)return null;const h=new Array,u=new Array,g=b(),y=n(),C=d(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),f(c.spatialReference,[p.x,p.y,0],y,this._context.renderCoordsHelper.spatialReference);const S=n();i(S,y);const j=s();r(j,S);const I=new Map,E=this._materials[0];if(this._context.clippingExtent&&(x(m.mapPositions,g),!_(g,this._context.clippingExtent)))return;if(0===m.polygonIndexCount&&0===m.outlineIndexCount)return;const O=this._getExtrusionSize(t),L=A(m,{height:O,worldUp:C,spherical:w,requireElevation:!0,requireNormals:!0,requireSizes:!0});if(null==L)return;v(L.vertices,L.vertices,S);const V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerViewUid:this._context.layerViewUid}),R=new le(L.vertices,L.elevation,q(L.normals),L.sizes),B=Q(E,L.indices,L.indices.length-L.bottomIndices.length,R,o,V),T=m.vertexCount,N=L.polygonVertexCount,H=2*m.outlineSegmentCount,W=m.polygonIndexCount/3,Z=new ce(T,N,H,W);if(ee(B,Z,y),I.set(B,Z),h.push(B),L.bottomIndices.length>0&&h.push(Q(this._materials[1],L.bottomIndices,0,R,o,V)),u.push(R.heights),0===h.length)return null;const J=new k({geometries:h,layerViewUid:this._context.layerViewUid,graphicUid:l,isElevationSource:!0});J.transformation=y;const K=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),X=K?new U(this._materials[0],K,this._context.slicePlaneEnabled):null,Y=new z(this,J,null,(e,t,r,s,i)=>$(e,t,r,s,i,u,I),a,X);return Y.alignedSampledElevation=m.sampledElevation,Y.needsElevationUpdates=P(a.mode),Y}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function Q(e,t,r,s,i,o){const{attributeIndices:n,drawIndices:a}=X(t),l=[["position",new T(s.positions,n,3,!0)],["normalCompressed",new T(s.normals,n,2,!0)]];if(e.parameters.hasSymbolColors){const e=C(n.length);l.push(["symbolColor",new T(i,e,4,!0)])}return new N(e,l,s.elevation,0,o,r,null,a)}function X(e){const t=new Array,r=new Map,s=new Array;for(let i=0;i<e.length;++i){const o=e[i];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:t,drawIndices:s}}const Y=d();function $(e,t,r,s,i,l,c){const m=e.stageObject,p=m.geometries,u=p.length,d="absolute-height"!==t.mode;let g=0;const y=m.transformation,f=o(n(),y);for(let o=0,n=0;o<u;++o){const e=p[o],t=c.get(e);if(!t||!H(e))continue;const u=e.getMutableAttribute("position").data,b=l[n++],x=new R(e.mapPositions),_=u.length/3;let C=!1,v=0;{let e=0;for(let t=0;t<_;t++){Y[0]=u[e],Y[1]=u[e+1],Y[2]=u[e+2],s(x,se),d&&(v+=se.sampledElevation),V.ENABLE_OPTIMIZATIONS?(a(te,u[e],u[e+1],u[e+2]),h(te,te,y),i.setAltitude(te,se.z+b[e/3]),h(te,te,f)):(a(te,x.array[x.offset],x.array[x.offset+1],se.z+b[e/3]),null!=r&&i.toRenderCoords(te,r,te),h(te,te,f)),u[e]=te[0],u[e+1]=te[1],u[e+2]=te[2];const t=ie/i.unitInMeters;(Math.abs(Y[0]-u[e])>=t||Math.abs(Y[1]-u[e+1])>=t||Math.abs(Y[2]-u[e+2])>=t)&&(C=!0),x.offset+=3,e+=3}}if(C){ee(e,t,y),m.geometryVertexAttributeUpdated(p[o],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[o],"position");const r=p[o+1],s=!c.has(r);r&&s&&(r.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(r,"position"))}g+=v/_}return g/u}function ee(e,t,r){const s=e.getMutableAttribute("position"),i=e.getMutableAttribute("normalCompressed").data,o=s.data,n=e.primitivePositionIndices,{topVertexStart:u,topVertexCount:d,topFaceStart:g,topFaceCount:y}=t,f=g+y,b=u+d,x=oe,_=ne,C=ae,v=re,w=te;a(w,0,0,0);const S=(e,t)=>{const s=3*e;a(t,o[s+0],o[s+1],o[s+2]),h(t,t,r)};for(let a=g;a<f;++a){const e=3*a;S(n[e+0],x[0]),S(n[e+1],x[1]),S(n[e+2],x[2]),l(_,x[1],x[0]),l(C,x[2],x[0]),c(v,_,C),m(w,w,v)}p(w,w);for(let a=u;a<b;++a){const e=w[0],t=w[1],r=w[2];W(i,a,e,t,r)}}const te=d(),re=d(),se=new E,ie=.01,oe=[d(),d(),d()],ne=d(),ae=d();class le{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}class ce{constructor(e,t,r,s){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer};