@arcgis/core 6.0.0-next.16 → 6.0.0-next.17

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 (133) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/164c8eeefa8232b2b191.js +2 -0
  3. package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +1 -0
  4. package/assets/esri/core/workers/chunks/{261fea092ee7d27608a0.js → 20a2124cbe43e5527c40.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2853606099602f73d379.js +1 -0
  6. package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +2 -0
  7. package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +2 -0
  8. package/assets/esri/core/workers/chunks/{36cbd614454581aaf334.js → 34e0a8a3a2beea50f4f5.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{3baa4a9c52f41bfd6abb.js → 3e30b96a8c75bd5b9ae2.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{c79934cd6883307203f8.js → 42753cf4965a94bc91ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b564ec4e03478f5659db.js → 4c240ca50f70bf30813f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{70d3055f15d8b0cf4074.js → 532e9cda8ac3601d8892.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{953ba13299e7aa92c1a0.js → 564565246dae080f5e6c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{2145a512d269d64036b0.js → 58c3ae6030def2ed5f31.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +1 -0
  16. package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +1 -0
  17. package/assets/esri/core/workers/chunks/{9f06ec95bdf0d0b52b41.js → 5b91e2dffdc84c006539.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{5acb422fe3cf693d9d4f.js → 603fdbbe9534c614928f.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{c5a9e77977e867a75ff2.js → 60f92eb03c6e17ab4747.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{1b077c92345ffb5916c2.js → 65c98f3449044fa4fd79.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{2bd4ee083ca4ad221f8b.js → 65cb5e39c467a35621ca.js} +1 -1
  23. package/assets/esri/core/workers/chunks/67a35155b8b4d36f171e.js +1 -0
  24. package/assets/esri/core/workers/chunks/{f9c5aa0bbf23e780fecc.js → 6ad309154fe84210d23c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{e2190361247f35b02b32.js → 7b5cd150a4d0139850be.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{9b051745d24d1f43480b.js → 7d2cbc767c336d15e4d5.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
  29. package/assets/esri/core/workers/chunks/9503eedfdda55fc5adab.js +1 -0
  30. package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +1 -0
  31. package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +1 -0
  32. package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
  34. package/assets/esri/core/workers/chunks/a596779eaeec7310671d.js +1 -0
  35. package/assets/esri/core/workers/chunks/{d5d0fe8e198ff5a902ee.js → a5c8f9f5be4ef5063b42.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{a7bd5ba4d7d97411fd33.js → ab1660f5f8a5268c2fac.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4bbe1f28f5f16a6bef05.js → ae0563d573baf91e01f7.js} +1 -1
  38. package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +2 -0
  39. package/assets/esri/core/workers/chunks/{aa36c3a9bbaa086e3757.js → b8fd7c3b36981261378b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/bd046399e05e759e0bc2.js +1 -0
  41. package/assets/esri/core/workers/chunks/bd46a04a9ee4ea9e6ef1.js +2 -0
  42. package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +1 -0
  43. package/assets/esri/core/workers/chunks/{bf35927979fc5e7e0478.js → dd0310184fe4832755a8.js} +1 -1
  44. package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +1 -0
  45. package/assets/esri/core/workers/chunks/{634523cc7757da9020e4.js → fb70ab267a08e24b710f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +1 -0
  47. package/assets/esri/themes/base/widgets/_Weather.scss +1 -0
  48. package/assets/esri/themes/dark/main.css +1 -1
  49. package/assets/esri/themes/light/main.css +1 -1
  50. package/assets/esri/themes/light/view.css +1 -1
  51. package/chunks/lerc-wasm.js +1 -1
  52. package/config.js +1 -1
  53. package/core/sql/WhereGrammar.js +2 -2
  54. package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
  55. package/kernel.js +1 -1
  56. package/layers/ElevationLayer.js +1 -1
  57. package/layers/GeoJSONLayer.d.ts +1 -1
  58. package/layers/effects/parser.js +3 -3
  59. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  60. package/layers/raster/formats/ElevationCodec.js +2 -0
  61. package/layers/raster/formats/Lerc.js +1 -1
  62. package/layers/support/LercWorker.js +1 -1
  63. package/layers/support/TileInfo.d.ts +1 -1
  64. package/layers/support/TileInfo.js +1 -1
  65. package/layers/support/layerOriginUtils.js +1 -1
  66. package/package.json +4 -4
  67. package/popup/FeaturesModel.js +1 -1
  68. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  69. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  70. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  71. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  72. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  73. package/smartMapping/support/adapters/support/utils.js +1 -1
  74. package/time/TimeExtent.d.ts +1 -1
  75. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  76. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  77. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  78. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  79. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  80. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  81. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  82. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  83. package/views/3d/state/utils/navigationUtils.js +1 -1
  84. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  85. package/views/View.js +1 -1
  86. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  87. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  88. package/views/interactive/snapping/allLayerSnapping.js +1 -1
  89. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
  90. package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
  91. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
  92. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  93. package/widgets/Expand/ExpandViewModel.d.ts +2 -0
  94. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  95. package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
  96. package/widgets/Home/HomeViewModel.d.ts +2 -0
  97. package/widgets/OrientedImageryViewer.js +1 -1
  98. package/widgets/Sketch/SketchViewModel.js +1 -1
  99. package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
  100. package/widgets/Swipe/types.d.ts +9 -2
  101. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
  102. package/widgets/TimeSlider/types.d.ts +7 -0
  103. package/widgets/TimeSlider.d.ts +2 -3
  104. package/widgets/TimeSlider.js +1 -1
  105. package/widgets/Track/TrackViewModel.d.ts +4 -0
  106. package/widgets/Track/types.d.ts +1 -0
  107. package/widgets/support/Selector3D/selectorUtils.js +1 -1
  108. package/assets/esri/core/workers/chunks/0050916e462e3c9e0627.js +0 -1
  109. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +0 -1
  110. package/assets/esri/core/workers/chunks/34cbaf844730ac2d92c2.js +0 -2
  111. package/assets/esri/core/workers/chunks/3c301a689c7853c9fa67.js +0 -2
  112. package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
  113. package/assets/esri/core/workers/chunks/604f0f4150fb79ee54c8.js +0 -1
  114. package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
  115. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +0 -1
  116. package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +0 -1
  117. package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +0 -1
  118. package/assets/esri/core/workers/chunks/76ab353d80d786777161.js +0 -2
  119. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +0 -1
  120. package/assets/esri/core/workers/chunks/8483c50ed8f280fd74bb.js +0 -1
  121. package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
  122. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +0 -1
  123. package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +0 -2
  124. package/assets/esri/core/workers/chunks/b557824bc1fa163d72a3.js +0 -2
  125. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +0 -1
  126. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +0 -1
  127. package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +0 -1
  128. /package/assets/esri/core/workers/chunks/{b557824bc1fa163d72a3.js.LICENSE.txt → 164c8eeefa8232b2b191.js.LICENSE.txt} +0 -0
  129. /package/assets/esri/core/workers/chunks/{b49df4ebd4be1181b0f9.js.LICENSE.txt → 2981e904ab62f3ed80d0.js.LICENSE.txt} +0 -0
  130. /package/assets/esri/core/workers/chunks/{34cbaf844730ac2d92c2.js.LICENSE.txt → 32cc59e126df8c96a0cf.js.LICENSE.txt} +0 -0
  131. /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
  132. /package/assets/esri/core/workers/chunks/{3c301a689c7853c9fa67.js.LICENSE.txt → b686cd74975da09b9c91.js.LICENSE.txt} +0 -0
  133. /package/assets/esri/core/workers/chunks/{76ab353d80d786777161.js.LICENSE.txt → bd46a04a9ee4ea9e6ef1.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{acquire as h}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const _={ready:`ready`,creating:`creating`,created:`created`};let v=class extends f{constructor(e){super(e),this._operationManager=new u,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;let{snappingManager:t}=this._snappingManagerResult=h(e.view);this._editIntersector=new l({view:e.view}),this._editTool=new s({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._editIntersector,snappingManager:t,view:e.view}),this._placementController=new c({...e,snappingManager:t,shouldPreventVertexAdd:(e,t)=>this._editTool.hasManipulatorAt(e,t)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get selectedItem(){return this._editTool.selectedItem}get state(){return this._placementController.active?_.creating:this.analysis.observer?.position==null?_.ready:_.created}get cursor(){return this._placementController.active?`crosshair`:null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on(`key-down`,e=>this._onKeyDown(e),d.WIDGET),n(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),r),n(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set(`created`,!1)},r),n(()=>this.analysisViewData.visible,e=>{this.visible=e},r),n(()=>this.editable,e=>{this.analysisViewData.editable=e},r)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start(`place`,async(i,a)=>{let{elevationInfo:o}=e??{},s=o&&`observer`in o?o.observer:o,c=o&&`targets`in o?o.targets:o;this._placementController.observerPlacementElevationInfo=y(s),this._placementController.targetPlacementElevationInfo=y(c);let l=this.analysis.clone(),u=!1,d=!1,f=()=>{if(d)return;if(d=!0,this.stop(),!this.analysis.valid){this.analysis.clear(),i.reject();return}if(a.aborted||this.analysis.equals(l)){i.reject();return}let e=this.analysis.targets.at(-1);e!=null&&this._editTool.selectItem(e),i.resolve({})};i.handles.push(t(()=>this.stop()),n(()=>this._placementController.active,e=>{e?u=!0:u&&f()},r)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),!this.analysis.valid&&!this._placementController.active&&this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(e){let t=e.key;t===m.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===m.redo&&this.canRedo?(e.stopPropagation(),this.redo()):m.delete.includes(t)&&!this.active?this._editTool.deleteSelectedItem()&&e.stopPropagation():t===m.cancel&&!this.active&&this._editTool.clearSelection()&&e.stopPropagation()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active?this._placementController:this._canActivateEditTool?this._editTool:null:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&this.analysis.observer?.position!=null}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{let e=this.analysisViewData.interactive,t=this._canActivateEditTool;if(this._placementController.visible=this.visible&&e,this._editTool.manipulatorsInteractive=e&&!this._placementController.active,!e){this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,p(this.view,this);return}if(!this.visible){this._editTool.stop(),this._editTool.visible=!0,p(this.view,this);return}if(this._placementController.active){this._editTool.stop(),this._editTool.visible=this.visible,p(this.view,this);return}if(!t){this._hideEditTool(),p(this.view,this);return}this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,p(this.view,this)}finally{this._syncingActiveTool=!1}}}};e([i({constructOnly:!0})],v.prototype,`view`,void 0),e([i({constructOnly:!0})],v.prototype,`analysis`,void 0),e([i({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([i()],v.prototype,`active`,null),e([i()],v.prototype,`canRedo`,null),e([i()],v.prototype,`canUndo`,null),e([i()],v.prototype,`selectedItem`,null),e([i()],v.prototype,`state`,null),e([i()],v.prototype,`cursor`,null),e([i()],v.prototype,`updating`,null),e([i()],v.prototype,`removeIncompleteOnCancel`,void 0),e([i()],v.prototype,`snappingOptions`,null),e([i()],v.prototype,`_canActivateEditTool`,null),v=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightTool`)],v);function y(e){if(e==null)return null;let{featureExpressionInfo:t,mode:n,offset:r,unit:i}=e;return new o({featureExpressionInfo:t,mode:n,offset:r,unit:i})}export{v as LineOfSightTool};
2
+ import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{acquireForFeaturePlacement as h}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const _={ready:`ready`,creating:`creating`,created:`created`};let v=class extends f{constructor(e){super(e),this._operationManager=new u,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;let{snappingManager:t}=this._snappingManagerResult=h(e.view);this._editIntersector=new l({view:e.view}),this._editTool=new s({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._editIntersector,snappingManager:t,view:e.view}),this._placementController=new c({...e,snappingManager:t,shouldPreventVertexAdd:(e,t)=>this._editTool.hasManipulatorAt(e,t)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get selectedItem(){return this._editTool.selectedItem}get state(){return this._placementController.active?_.creating:this.analysis.observer?.position==null?_.ready:_.created}get cursor(){return this._placementController.active?`crosshair`:null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on(`key-down`,e=>this._onKeyDown(e),d.WIDGET),n(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),r),n(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set(`created`,!1)},r),n(()=>this.analysisViewData.visible,e=>{this.visible=e},r),n(()=>this.editable,e=>{this.analysisViewData.editable=e},r)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start(`place`,async(i,a)=>{let{elevationInfo:o}=e??{},s=o&&`observer`in o?o.observer:o,c=o&&`targets`in o?o.targets:o;this._placementController.observerPlacementElevationInfo=y(s),this._placementController.targetPlacementElevationInfo=y(c);let l=this.analysis.clone(),u=!1,d=!1,f=()=>{if(d)return;if(d=!0,this.stop(),!this.analysis.valid){this.analysis.clear(),i.reject();return}if(a.aborted||this.analysis.equals(l)){i.reject();return}let e=this.analysis.targets.at(-1);e!=null&&this._editTool.selectItem(e),i.resolve({})};i.handles.push(t(()=>this.stop()),n(()=>this._placementController.active,e=>{e?u=!0:u&&f()},r)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),!this.analysis.valid&&!this._placementController.active&&this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(e){let t=e.key;t===m.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===m.redo&&this.canRedo?(e.stopPropagation(),this.redo()):m.delete.includes(t)&&!this.active?this._editTool.deleteSelectedItem()&&e.stopPropagation():t===m.cancel&&!this.active&&this._editTool.clearSelection()&&e.stopPropagation()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active?this._placementController:this._canActivateEditTool?this._editTool:null:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&this.analysis.observer?.position!=null}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{let e=this.analysisViewData.interactive,t=this._canActivateEditTool;if(this._placementController.visible=this.visible&&e,this._editTool.manipulatorsInteractive=e&&!this._placementController.active,!e){this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,p(this.view,this);return}if(!this.visible){this._editTool.stop(),this._editTool.visible=!0,p(this.view,this);return}if(this._placementController.active){this._editTool.stop(),this._editTool.visible=this.visible,p(this.view,this);return}if(!t){this._hideEditTool(),p(this.view,this);return}this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,p(this.view,this)}finally{this._syncingActiveTool=!1}}}};e([i({constructOnly:!0})],v.prototype,`view`,void 0),e([i({constructOnly:!0})],v.prototype,`analysis`,void 0),e([i({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([i()],v.prototype,`active`,null),e([i()],v.prototype,`canRedo`,null),e([i()],v.prototype,`canUndo`,null),e([i()],v.prototype,`selectedItem`,null),e([i()],v.prototype,`state`,null),e([i()],v.prototype,`cursor`,null),e([i()],v.prototype,`updating`,null),e([i()],v.prototype,`removeIncompleteOnCancel`,void 0),e([i()],v.prototype,`snappingOptions`,null),e([i()],v.prototype,`_canActivateEditTool`,null),v=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightTool`)],v);function y(e){if(e==null)return null;let{featureExpressionInfo:t,mode:n,offset:r,unit:i}=e;return new o({featureExpressionInfo:t,mode:n,offset:r,unit:i})}export{v as LineOfSightTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{detachToolFromView as c}from"./toolLifecycleUtils.js";import{ViewshedEditTool as l}from"./ViewshedEditTool.js";import{ViewshedPlacementController as u}from"./ViewshedPlacementController.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";import{acquire as f}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as p}from"../../../interactive/snapping/snappingUtils.js";let m=class extends t{constructor(e){super(e),this._editTool=null,this._updatingHandles=new s}initialize(){let{view:e}=this,t=d(e.state.viewingMode);this._snappingManagerResult=f(e),this.addHandles(this._snappingManagerResult),this._placementController=new u({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e,callbacks:{cancelTool:()=>{e.activeTool!=null&&(e.activeTool=null)},findViewshedComputedData:e=>this._findViewshedComputedData(e),setSelectedViewshed:e=>{this.analysisViewData.selectedViewshed=e}}}),p(this),this.addHandles([r(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:n,interactive:r})=>{r?n==null?this._editTool||(this._editTool=new l({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e}),e.tools.add(this._editTool)):this._destroyEditTool():(this._placementController.cancelPlaceOperation(),this._destroyEditTool())},i),this._updatingHandles.add(()=>e.activeTool,e=>{e!=null&&e!==this._editTool&&this._placementController.creationState==null&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),n(this._placementController),this._updatingHandles.destroy()}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._updatingHandles.updating||this._placementController.updating||!!this._editTool?.updating}get creating(){return this._placementController.creationState!=null}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}async place(e,t){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(e,t),e===`single`)return{}}_findViewshedComputedData(e){return this.analysisViewData.viewshedComputedDataHandles?.find(t=>t.viewshedComputedData.viewshed===e)?.viewshedComputedData}_destroyEditTool(){let e=this._editTool;this._editTool=null,e!=null&&(c(this.view,e),n(e))}get test(){}};e([a({constructOnly:!0})],m.prototype,`view`,void 0),e([a({constructOnly:!0})],m.prototype,`analysis`,void 0),e([a({constructOnly:!0})],m.prototype,`analysisViewData`,void 0),e([a()],m.prototype,`_placementController`,void 0),e([a()],m.prototype,`_editTool`,void 0),e([a()],m.prototype,`_snappingManagerResult`,void 0),e([a()],m.prototype,`selectedViewshedComputedData`,null),e([a()],m.prototype,`stagedViewshed`,null),e([a()],m.prototype,`active`,null),e([a()],m.prototype,`updating`,null),e([a()],m.prototype,`creating`,null),e([a()],m.prototype,`snappingOptions`,null),m=e([o(`esri.views.3d.analysis.Viewshed.ViewshedTool`)],m);const h=m;export{h as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{detachToolFromView as c}from"./toolLifecycleUtils.js";import{ViewshedEditTool as l}from"./ViewshedEditTool.js";import{ViewshedPlacementController as u}from"./ViewshedPlacementController.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";import{acquireForFeaturePlacement as f}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as p}from"../../../interactive/snapping/snappingUtils.js";let m=class extends t{constructor(e){super(e),this._editTool=null,this._updatingHandles=new s}initialize(){let{view:e}=this,t=d(e.state.viewingMode);this._snappingManagerResult=f(e),this.addHandles(this._snappingManagerResult),this._placementController=new u({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e,callbacks:{cancelTool:()=>{e.activeTool!=null&&(e.activeTool=null)},findViewshedComputedData:e=>this._findViewshedComputedData(e),setSelectedViewshed:e=>{this.analysisViewData.selectedViewshed=e}}}),p(this),this.addHandles([r(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:n,interactive:r})=>{r?n==null?this._editTool||(this._editTool=new l({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e}),e.tools.add(this._editTool)):this._destroyEditTool():(this._placementController.cancelPlaceOperation(),this._destroyEditTool())},i),this._updatingHandles.add(()=>e.activeTool,e=>{e!=null&&e!==this._editTool&&this._placementController.creationState==null&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),n(this._placementController),this._updatingHandles.destroy()}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._updatingHandles.updating||this._placementController.updating||!!this._editTool?.updating}get creating(){return this._placementController.creationState!=null}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}async place(e,t){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(e,t),e===`single`)return{}}_findViewshedComputedData(e){return this.analysisViewData.viewshedComputedDataHandles?.find(t=>t.viewshedComputedData.viewshed===e)?.viewshedComputedData}_destroyEditTool(){let e=this._editTool;this._editTool=null,e!=null&&(c(this.view,e),n(e))}get test(){}};e([a({constructOnly:!0})],m.prototype,`view`,void 0),e([a({constructOnly:!0})],m.prototype,`analysis`,void 0),e([a({constructOnly:!0})],m.prototype,`analysisViewData`,void 0),e([a()],m.prototype,`_placementController`,void 0),e([a()],m.prototype,`_editTool`,void 0),e([a()],m.prototype,`_snappingManagerResult`,void 0),e([a()],m.prototype,`selectedViewshedComputedData`,null),e([a()],m.prototype,`stagedViewshed`,null),e([a()],m.prototype,`active`,null),e([a()],m.prototype,`updating`,null),e([a()],m.prototype,`creating`,null),e([a()],m.prototype,`snappingOptions`,null),m=e([o(`esri.views.3d.analysis.Viewshed.ViewshedTool`)],m);const h=m;export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import n from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{pausable as o,sync as s,watch as c,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as h,isPolygonGraphic as g}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as _}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as v}from"../../../analysis/ExclusiveOperationManager.js";import{makeAllLayerSnappingOptions as y}from"../../../interactive/snapping/allLayerSnapping.js";import b from"../../../../widgets/Sketch/SketchViewModel.js";let x=class extends n{constructor(e){super(e),this._updatingHandles=new f,this._operationManager=new v,this._onUndoRedo=()=>{this._updateGeometryFromSketchGraphic()}}initialize(){let{analysis:e,viewData:t,view:n}=this;this._graphicsLayer=new p({listMode:`hide`,internal:!0,elevationInfo:{mode:`on-the-ground`}});let r=y(n,{selfEnabled:!0,excludeInternal:!0});this._externalGeometryChangeHandle=o(()=>this.analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),s),this._sketchViewModel=new b({layer:this._graphicsLayer,view:n,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:`move`},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:`reshape`},polygonSymbol:this._polygonSymbol,snappingOptions:r.options}),this.addHandles([this._sketchViewModel.on([`undo`,`redo`],this._onUndoRedo),c(()=>({map:n.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:e,internalGraphicsLayer:t,state:n})=>{switch(C(e,t),n){case`idle`:case`reshaping-disabled`:this._operationManager.stop(),this._graphicsLayer.removeAll(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:i(this._startReshape());break;case`awaiting-sketch`:this.viewData.interactive=!0}},l),r,this._externalGeometryChangeHandle]),this._shiftTool=new _({analysis:e,view:n,analysisViewData:t}),this.addHandles(this._shiftTool.on(`record-undo`,e=>{let t=this._sketchViewModel.activeComponent;t?.type===`reshape-3d`&&t.recordUndo(e.apply,e.undo)})),n.tools.add(this._shiftTool),this.addHandles({remove:()=>n.tools.remove(this._shiftTool)})}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();let e=this._graphicsLayer;this.view.map.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateGeometryFromSketchGraphic())}get state(){let{geometry:e}=this.analysis,{interactive:t,visible:n}=this.viewData;return n?this._sketchViewModel.createGraphic?this._sketchViewModel.createGraphic===this.sketchGraphic?`sketching`:`awaiting-sketch`:e?t?`reshaping`:`reshaping-disabled`:`idle`:`idle`}get updating(){return this._sketchViewModel.updating||this._shiftTool.updating||this._updatingHandles.updating}get _polygonSymbol(){return new m({color:[0,0,0,0],outline:{color:[0,0,0,0]}})}place(e){return this._operationManager.start(`place`,async t=>{let n=this.analysis.clone();this._ensureUpdatedSketchGraphic();let i=this._sketchViewModel.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic;break;case`active`:this._updateGeometryFromSketchGraphic();break;case`complete`:this._updateGeometryFromSketchGraphic(),t.stop();break;case`cancel`:t.stop()}});t.handles.push(i,r(()=>{if(i.remove(),this._sketchViewModel.cancel(),this._updateGeometryFromSketchGraphic(),!this.analysis.valid)return this._clearGeometry(),t.reject();if(a(e)||n.equals(this.analysis))return t.reject();t.resolve({})})),await this._updatingHandles.addPromise(this._sketchViewModel.create(`polygon`))},e)}_startReshape(){return this._operationManager.start(`reshape`,async e=>{let t=()=>{let e=this._ensureUpdatedSketchGraphic();return e?(this._graphicsLayer.removeAll(),this._graphicsLayer.add(e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:`reshape`}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let n=this._sketchViewModel.on(`update`,n=>{this._updateGeometryFromSketchGraphic(),n.state===`complete`&&(this.state===`reshaping`?i(t()):e.resolve())});e.handles.push(n,r(()=>{n.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this.analysis;return h(e)?(this.sketchGraphic??=new t({geometry:e,symbol:this._polygonSymbol}),this.sketchGraphic.geometry=e,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearGeometry(){this.sketchGraphic=null,this.analysis.geometry=null}_updateGeometryFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic;this.analysis.geometry=g(e)?e.geometry:null,this._externalGeometryChangeHandle.resume()}get test(){}};e([u({constructOnly:!0})],x.prototype,`viewData`,void 0),e([u({constructOnly:!0})],x.prototype,`view`,void 0),e([u({constructOnly:!0})],x.prototype,`analysis`,void 0),e([u()],x.prototype,`sketchGraphic`,null),e([u({nonNullable:!0})],x.prototype,`state`,null),e([u()],x.prototype,`updating`,null),e([u()],x.prototype,`_polygonSymbol`,null),x=e([d(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementTool`)],x);const S=x;function C(e,t){t&&(t.removeFromParent(),e?.add(t))}export{S as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import n from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{pausable as o,sync as s,watch as c,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as h,isPolygonGraphic as g}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as _}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as v}from"../../../analysis/ExclusiveOperationManager.js";import{makeGeometryAnalysisSnappingOptions as y}from"../../../interactive/snapping/allLayerSnapping.js";import b from"../../../../widgets/Sketch/SketchViewModel.js";let x=class extends n{constructor(e){super(e),this._updatingHandles=new f,this._operationManager=new v,this._onUndoRedo=()=>{this._updateGeometryFromSketchGraphic()}}initialize(){let{analysis:e,viewData:t,view:n}=this;this._graphicsLayer=new p({listMode:`hide`,internal:!0,elevationInfo:{mode:`on-the-ground`}});let r=y(n);this._externalGeometryChangeHandle=o(()=>this.analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),s),this._sketchViewModel=new b({layer:this._graphicsLayer,view:n,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:`move`},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:`reshape`},polygonSymbol:this._polygonSymbol,snappingOptions:r.options}),this.addHandles([this._sketchViewModel.on([`undo`,`redo`],this._onUndoRedo),c(()=>({map:n.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:e,internalGraphicsLayer:t,state:n})=>{switch(C(e,t),n){case`idle`:case`reshaping-disabled`:this._operationManager.stop(),this._graphicsLayer.removeAll(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:i(this._startReshape());break;case`awaiting-sketch`:this.viewData.interactive=!0}},l),r,this._externalGeometryChangeHandle]),this._shiftTool=new _({analysis:e,view:n,analysisViewData:t}),this.addHandles(this._shiftTool.on(`record-undo`,e=>{let t=this._sketchViewModel.activeComponent;t?.type===`reshape-3d`&&t.recordUndo(e.apply,e.undo)})),n.tools.add(this._shiftTool),this.addHandles({remove:()=>n.tools.remove(this._shiftTool)})}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();let e=this._graphicsLayer;this.view.map.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateGeometryFromSketchGraphic())}get state(){let{geometry:e}=this.analysis,{interactive:t,visible:n}=this.viewData;return n?this._sketchViewModel.createGraphic?this._sketchViewModel.createGraphic===this.sketchGraphic?`sketching`:`awaiting-sketch`:e?t?`reshaping`:`reshaping-disabled`:`idle`:`idle`}get updating(){return this._sketchViewModel.updating||this._shiftTool.updating||this._updatingHandles.updating}get _polygonSymbol(){return new m({color:[0,0,0,0],outline:{color:[0,0,0,0]}})}place(e){return this._operationManager.start(`place`,async t=>{let n=this.analysis.clone();this._ensureUpdatedSketchGraphic();let i=this._sketchViewModel.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic;break;case`active`:this._updateGeometryFromSketchGraphic();break;case`complete`:this._updateGeometryFromSketchGraphic(),t.stop();break;case`cancel`:t.stop()}});t.handles.push(i,r(()=>{if(i.remove(),this._sketchViewModel.cancel(),this._updateGeometryFromSketchGraphic(),!this.analysis.valid)return this._clearGeometry(),t.reject();if(a(e)||n.equals(this.analysis))return t.reject();t.resolve({})})),await this._updatingHandles.addPromise(this._sketchViewModel.create(`polygon`))},e)}_startReshape(){return this._operationManager.start(`reshape`,async e=>{let t=()=>{let e=this._ensureUpdatedSketchGraphic();return e?(this._graphicsLayer.removeAll(),this._graphicsLayer.add(e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:`reshape`}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let n=this._sketchViewModel.on(`update`,n=>{this._updateGeometryFromSketchGraphic(),n.state===`complete`&&(this.state===`reshaping`?i(t()):e.resolve())});e.handles.push(n,r(()=>{n.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this.analysis;return h(e)?(this.sketchGraphic??=new t({geometry:e,symbol:this._polygonSymbol}),this.sketchGraphic.geometry=e,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearGeometry(){this.sketchGraphic=null,this.analysis.geometry=null}_updateGeometryFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic;this.analysis.geometry=g(e)?e.geometry:null,this._externalGeometryChangeHandle.resume()}get test(){}};e([u({constructOnly:!0})],x.prototype,`viewData`,void 0),e([u({constructOnly:!0})],x.prototype,`view`,void 0),e([u({constructOnly:!0})],x.prototype,`analysis`,void 0),e([u()],x.prototype,`sketchGraphic`,null),e([u({nonNullable:!0})],x.prototype,`state`,null),e([u()],x.prototype,`updating`,null),e([u()],x.prototype,`_polygonSymbol`,null),x=e([d(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementTool`)],x);const S=x;function C(e,t){t&&(t.removeFromParent(),e?.add(t))}export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{ignoreAbortErrors as r}from"../../../../../core/promiseUtils.js";import{syncAndInitial as i,when as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import h from"./AreaMeasurement3DView.js";import{PickRequest as g}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y}from"../../../../interactive/dragEventPipeline.js";import{sketchKeys as b}from"../../../../interactive/keybindings.js";import{ManipulatorCollection as x}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as w}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as E}from"../../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as D}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as O}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let A=class extends _{constructor(e){super(e),this._updatingHandles=new c,this._snappingManagerResult=null,this.polygonState=`initial`,this.removeIncompleteOnCancel=!1,this.manipulators=new x,this._getSnappingContext=n(e=>new w({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new C(new S(`point`,v(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new f}))}initialize(){let{view:e,analysisViewData:t,manipulators:n,visible:o}=this;this.measurementView=new h({view:e,analysisViewData:t,toolState:this,manipulators:n,visible:o}),this._snappingOperation=new D({view:e}),this._updatingHandles.add(()=>this.stagedPoint,e=>{this.analysisViewData.stagedPoint=e==null?null:u(e,new l)},i),O(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(r(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this._setupManipulators(),this.addHandles([a(()=>this.state===`measured`,()=>this.finishToolCreation(),i),this.analysisViewData.path.on(`change`,()=>{let e=this.analysisViewData.path;this.polygonState===`initial`&&!e.isEmptyPolygon&&(this.polygonState=e.isValidPolygon?`measured`:`drawing`)})])}destroy(){this.measurementView.destroy(),this._set(`measurementView`,null),this._updatingHandles=t(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(this._snappingManagerResult==null){let e=E(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get state(){return this.analysisViewData.path.numVertices===0?`ready`:this.analysisViewData.path.isValidPolygon&&this.polygonState!==`editing`?`measured`:`measuring`}get cursor(){return this.active?`crosshair`:null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(e){this._snappingOperation.stagedPoint=e}get snappingOptions(){return this._snappingManager?.options}finishMeasurement(){let{path:e}=this.analysisViewData;e.numVertices<=2||(e.close(),this.polygonState=`measured`,this._resetSnappingState(),this.active&&(this.view.activeTool=null))}resetCreated(){super.resetCreated(),this._resetSnappingState(),this.polygonState=`initial`,this.state===`measured`&&(this.polygonState=`measured`,this.finishToolCreation())}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(e){switch(e.type){case`immediate-double-click`:this._handleImmediateDoubleClick(e);break;case`immediate-click`:this._handleImmediateClick(e);break;case`pointer-move`:this._handlePointerMove(e);break;case`drag`:this._handleDrag(e);break;case`key-down`:this._handleKeyDown(e)}}_setupManipulators(){let e=e=>e.events.on(`grab-changed`,()=>{if(this.analysisViewData.path.isValidPolygon){let e=this.manipulators.some(e=>e.manipulator.grabbing);this.polygonState=e?`editing`:`measured`}}),t=t=>{this.addHandles([y(t,(e,t,n,r)=>{let i=m(e),a=e.metadata,o=this._snappingManager,s=this._getSnappingContext(r),c=this._updatingHandles,{snappingStep:l,cancelSnapping:d}=T({snappingManager:o,snappingContext:s,updatingHandles:c});n.next(i).next(t=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(a,f),e.location=f,t)).next(d),t.next(i).next(p(this.view)).next(...l).next(t=>{e.location=t.mapEnd,this.analysisViewData.lastDraggedVertex=t.action===`end`?null:a,this.analysisViewData.path.setVertexPosition(a,u(t.mapEnd))});let f=u(this.analysisViewData.path.getVertexPositionAsPoint(a))}),e(t)],t)};this.manipulators.forEach(({manipulator:e})=>{t(e)}),this.addHandles([this.manipulators.on(`after-add`,({item:{manipulator:e}})=>{t(e)}),this.manipulators.on(`after-remove`,({item:{manipulator:e}})=>this.removeHandles(e))])}_handleImmediateDoubleClick(e){d(e)&&(this.polygonState===`drawing`&&this.finishMeasurement(),e.stopPropagation())}_handleDrag(e){this.polygonState===`editing`&&e.stopPropagation()}_handleImmediateClick(e){if(!d(e))return;let t=k(e),{pointerType:n}=e;if(this.active)switch(this.polygonState){case`initial`:case`measured`:if(this._addVertexAt(t,n)){this.stagedPoint=null,this.polygonState=`drawing`,e.stopPropagation();return}break;case`drawing`:{let r=this.measurementView.vertexHandleAt(t,n);if(r==null){if(this._addVertexAt(t,n)){this.stagedPoint=null,e.stopPropagation();return}}else r.index===0&&(this.finishMeasurement(),e.stopPropagation());break}}e.pointerType===`mouse`&&this._hoverAt(t)}_handlePointerMove(e){if(e.pointerType===`mouse`){let t=k(e);this._hoverAt(t)}}_handleKeyDown(e){let{path:t}=this.analysisViewData;(e.key===b.cancel||e.key===b.complete)&&this.polygonState===`drawing`&&t.numVertices>=3&&(this.stagedPoint=null,this.finishMeasurement(),e.stopPropagation())}_hoverAt(e){let{polygonState:t}=this;if(this.active&&j.has(t)){let t=this._pick(e);if(t?.mapPoint!=null){let e=this._getSnappingContext(`mouse`);this._updatingHandles.consumePromise(r(this._snappingOperation.snap({point:t.mapPoint},this._ensureSnappingManager(),e)))}}else this.stagedPoint=null}_addVertexAt(e,t){let n=this._pick(e)?.mapPoint;if(n==null)return!1;this.analysis.valid&&this.polygonState===`measured`&&(this.analysis.clear(),this._set(`created`,!1),this.polygonState=`initial`);let r=this._getSnappingContext(t),i=this._snappingOperation.update({point:n},this._ensureSnappingManager(),r),a=u(i,new l);return this.analysisViewData.path.add(a),!0}_pick(e){let t=new g(e);return this.measurementView.pick(t)}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){}};e([o()],A.prototype,`_snappingManagerResult`,void 0),e([o()],A.prototype,`_snappingManager`,null),e([o({readOnly:!0})],A.prototype,`state`,null),e([o()],A.prototype,`polygonState`,void 0),e([o({readOnly:!0})],A.prototype,`cursor`,null),e([o()],A.prototype,`measurementView`,void 0),e([o()],A.prototype,`removeIncompleteOnCancel`,void 0),e([o({constructOnly:!0})],A.prototype,`view`,void 0),e([o({constructOnly:!0})],A.prototype,`analysis`,void 0),e([o({constructOnly:!0})],A.prototype,`analysisViewData`,void 0),e([o({readOnly:!0})],A.prototype,`manipulators`,void 0),e([o()],A.prototype,`updating`,null),e([o()],A.prototype,`stagedPoint`,null),e([o()],A.prototype,`snappingOptions`,null),A=e([s(`esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool`)],A);const j=new Set([`initial`,`drawing`,`measured`]),M=A;export{M as default};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{ignoreAbortErrors as r}from"../../../../../core/promiseUtils.js";import{syncAndInitial as i,when as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import h from"./AreaMeasurement3DView.js";import{PickRequest as g}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y}from"../../../../interactive/dragEventPipeline.js";import{sketchKeys as b}from"../../../../interactive/keybindings.js";import{ManipulatorCollection as x}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as w}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as E}from"../../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as D}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as O}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let A=class extends _{constructor(e){super(e),this._updatingHandles=new c,this._snappingManagerResult=null,this.polygonState=`initial`,this.removeIncompleteOnCancel=!1,this.manipulators=new x,this._getSnappingContext=n(e=>new w({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new C(new S(`point`,v(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new f}))}initialize(){let{view:e,analysisViewData:t,manipulators:n,visible:o}=this;this.measurementView=new h({view:e,analysisViewData:t,toolState:this,manipulators:n,visible:o}),this._snappingOperation=new D({view:e}),this._updatingHandles.add(()=>this.stagedPoint,e=>{this.analysisViewData.stagedPoint=e==null?null:u(e,new l)},i),O(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(r(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this._setupManipulators(),this.addHandles([a(()=>this.state===`measured`,()=>this.finishToolCreation(),i),this.analysisViewData.path.on(`change`,()=>{let e=this.analysisViewData.path;this.polygonState===`initial`&&!e.isEmptyPolygon&&(this.polygonState=e.isValidPolygon?`measured`:`drawing`)})])}destroy(){this.measurementView.destroy(),this._set(`measurementView`,null),this._updatingHandles=t(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(this._snappingManagerResult==null){let e=E(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get state(){return this.analysisViewData.path.numVertices===0?`ready`:this.analysisViewData.path.isValidPolygon&&this.polygonState!==`editing`?`measured`:`measuring`}get cursor(){return this.active?`crosshair`:null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(e){this._snappingOperation.stagedPoint=e}get snappingOptions(){return this._snappingManager?.options}finishMeasurement(){let{path:e}=this.analysisViewData;e.numVertices<=2||(e.close(),this.polygonState=`measured`,this._resetSnappingState(),this.active&&(this.view.activeTool=null))}resetCreated(){super.resetCreated(),this._resetSnappingState(),this.polygonState=`initial`,this.state===`measured`&&(this.polygonState=`measured`,this.finishToolCreation())}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(e){switch(e.type){case`immediate-double-click`:this._handleImmediateDoubleClick(e);break;case`immediate-click`:this._handleImmediateClick(e);break;case`pointer-move`:this._handlePointerMove(e);break;case`drag`:this._handleDrag(e);break;case`key-down`:this._handleKeyDown(e)}}_setupManipulators(){let e=e=>e.events.on(`grab-changed`,()=>{if(this.analysisViewData.path.isValidPolygon){let e=this.manipulators.some(e=>e.manipulator.grabbing);this.polygonState=e?`editing`:`measured`}}),t=t=>{this.addHandles([y(t,(e,t,n,r)=>{let i=m(e),a=e.metadata,o=this._snappingManager,s=this._getSnappingContext(r),c=this._updatingHandles,{snappingStep:l,cancelSnapping:d}=T({snappingManager:o,snappingContext:s,updatingHandles:c});n.next(i).next(t=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(a,f),e.location=f,t)).next(d),t.next(i).next(p(this.view)).next(...l).next(t=>{e.location=t.mapEnd,this.analysisViewData.lastDraggedVertex=t.action===`end`?null:a,this.analysisViewData.path.setVertexPosition(a,u(t.mapEnd))});let f=u(this.analysisViewData.path.getVertexPositionAsPoint(a))}),e(t)],t)};this.manipulators.forEach(({manipulator:e})=>{t(e)}),this.addHandles([this.manipulators.on(`after-add`,({item:{manipulator:e}})=>{t(e)}),this.manipulators.on(`after-remove`,({item:{manipulator:e}})=>this.removeHandles(e))])}_handleImmediateDoubleClick(e){d(e)&&(this.polygonState===`drawing`&&this.finishMeasurement(),e.stopPropagation())}_handleDrag(e){this.polygonState===`editing`&&e.stopPropagation()}_handleImmediateClick(e){if(!d(e))return;let t=k(e),{pointerType:n}=e;if(this.active)switch(this.polygonState){case`initial`:case`measured`:if(this._addVertexAt(t,n)){this.stagedPoint=null,this.polygonState=`drawing`,e.stopPropagation();return}break;case`drawing`:{let r=this.measurementView.vertexHandleAt(t,n);if(r==null){if(this._addVertexAt(t,n)){this.stagedPoint=null,e.stopPropagation();return}}else r.index===0&&(this.finishMeasurement(),e.stopPropagation());break}}e.pointerType===`mouse`&&this._hoverAt(t)}_handlePointerMove(e){if(e.pointerType===`mouse`){let t=k(e);this._hoverAt(t)}}_handleKeyDown(e){let{path:t}=this.analysisViewData;(e.key===b.cancel||e.key===b.complete)&&this.polygonState===`drawing`&&t.numVertices>=3&&(this.stagedPoint=null,this.finishMeasurement(),e.stopPropagation())}_hoverAt(e){let{polygonState:t}=this;if(this.active&&j.has(t)){let t=this._pick(e);if(t?.mapPoint!=null){let e=this._getSnappingContext(`mouse`);this._updatingHandles.consumePromise(r(this._snappingOperation.snap({point:t.mapPoint},this._ensureSnappingManager(),e)))}}else this.stagedPoint=null}_addVertexAt(e,t){let n=this._pick(e)?.mapPoint;if(n==null)return!1;this.analysis.valid&&this.polygonState===`measured`&&(this.analysis.clear(),this._set(`created`,!1),this.polygonState=`initial`);let r=this._getSnappingContext(t),i=this._snappingOperation.update({point:n},this._ensureSnappingManager(),r),a=u(i,new l);return this.analysisViewData.path.add(a),!0}_pick(e){let t=new g(e);return this.measurementView.pick(t)}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){}};e([o()],A.prototype,`_snappingManagerResult`,void 0),e([o()],A.prototype,`_snappingManager`,null),e([o({readOnly:!0})],A.prototype,`state`,null),e([o()],A.prototype,`polygonState`,void 0),e([o({readOnly:!0})],A.prototype,`cursor`,null),e([o()],A.prototype,`measurementView`,void 0),e([o()],A.prototype,`removeIncompleteOnCancel`,void 0),e([o({constructOnly:!0})],A.prototype,`view`,void 0),e([o({constructOnly:!0})],A.prototype,`analysis`,void 0),e([o({constructOnly:!0})],A.prototype,`analysisViewData`,void 0),e([o({readOnly:!0})],A.prototype,`manipulators`,void 0),e([o()],A.prototype,`updating`,null),e([o()],A.prototype,`stagedPoint`,null),e([o()],A.prototype,`snappingOptions`,null),A=e([s(`esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool`)],A);const j=new Set([`initial`,`drawing`,`measured`]),M=A;export{M as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as h}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as g}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y,resetProperties as b}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as x}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as S}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as w}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as T}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as E}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as D}from"../../../../support/screenUtils.js";let O=class extends _{constructor(e){super(e),this._updatingHandles=new c,this._snappingManagerResult=null,this._emulatedDrag=null,this.lineState=`initial`,this.removeIncompleteOnCancel=!1,this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=n(e=>new C({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new S(new x(`point`,v(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new f}))}initialize(){let{view:e,analysis:t,analysisViewData:n,visible:o}=this;this.measurementView=new h({toolState:this,view:e,analysis:t,analysisViewData:n,visible:o});let{start:s,end:c,cursor:d}=this.measurementView.createManipulators(),f=(e,t,n)=>{let r=y(e,(e,r,i,a)=>{let o=m(e),s=this._ensureSnappingManager(),c=this._getSnappingContext(a),d=this._updatingHandles,{lineState:f}=this;i=i.next(o).next(b(this,[n,t])).next(n=>{if(t!==`cursorPoint`){let n=this.analysis[t];n!=null&&(e.location=n)}return n});let h=p(this.view),g=r.next(o).next(e=>{let r=h(e);return r||this.lineState!==`drawing`&&this.lineState!==`initial`||(this[t]=null,this[n]=null),r});if(a!==`touch`||f===`editing`){let{snappingStep:e,cancelSnapping:t}=w({snappingManager:s,snappingContext:c,updatingHandles:d});i.next(t),g=g.next(...e)}g.next(e=>e.action===`start`?null:e).next(r=>{let i=u(r.mapEnd,new l);this[t]=i,e.location=i,this[n]=this._surfaceLocation(i,r.surfaceType)})});return t===`cursorPoint`?[r]:[r,e.events.on(`grab-changed`,()=>{let e=s.grabbing||c.grabbing;this.lineState=e?`editing`:`measured`}),this._updatingHandles.add(()=>this.analysis[t],t=>{t&&(e.location=t)})]};this.startManipulator=s,this.endManipulator=c,this.cursorManipulator=d,this.manipulators.add(s),this.manipulators.add(c),this.manipulators.add(d),this.addHandles([...f(s,`startPoint`,`startPointSurfaceLocation`),...f(c,`endPoint`,`endPointSurfaceLocation`),...f(d,`cursorPoint`,`cursorPointSurfaceLocation`),r(()=>this.state===`measured`,()=>{this.finishToolCreation(),this.active&&(this.view.activeTool=null)},i),a(()=>({startPointAvailable:this.startPoint!=null,endPointAvailable:this.endPoint!=null}),({startPointAvailable:e,endPointAvailable:t})=>{this.startManipulator.available=e,this.endManipulator.available=t},i)]),E(this)}destroy(){this._updatingHandles=t(this._updatingHandles),this.measurementView=t(this.measurementView)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(this._snappingManagerResult==null){let e=T(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get state(){let{analysis:e}=this;if(e.startPoint==null&&e.endPoint==null)return`ready`;let{lineState:t}=this;return this.validMeasurement&&t!==`editing`&&t!==`drawing`?`measured`:`measuring`}get cursor(){return this.active&&(this.state===`ready`||this.lineState!==`measured`)?`crosshair`:null}get startPoint(){return this.analysis.startPoint}set startPoint(e){this.analysis.startPoint=e}get endPoint(){return this.analysis.endPoint}set endPoint(e){this.analysis.endPoint=e}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(e){this.measurementView.cursorPoint=e}get snappingOptions(){return this._snappingManager?.options}get validMeasurement(){return this.analysis.startPoint!=null&&this.analysis.endPoint!=null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}resetCreated(){super.resetCreated(),this.lineState=`initial`,this.cursorPoint=null,this.state===`measured`&&this.finishToolCreation()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(e){switch(e.type){case`immediate-click`:this._handleImmediateClick(e);break;case`pointer-move`:this._handlePointerMove(e)}}_handlePointerMove(e){if(!this.active||this.view.navigating)return;let{pointerType:t}=e;if(t!==`mouse`)return;let n=D(e),{lineState:r,cursorManipulator:i,endManipulator:a}=this,o=!1;this.cursorPoint??(this._emulatedDrag?.cancel(),this._emulatedDrag=k(i,t,n),o=!0),r===`initial`&&(this._emulatedDrag?.update(n),o=!0),r===`drawing`&&(a.events.emit(`drag`,{action:`update`,start:n,screenPoint:n}),o=!0),o&&e.stopPropagation()}_handleImmediateClick(e){if(!this.active||!d(e))return;let t=D(e),{pointerType:n}=e,{cursorManipulator:r,startManipulator:i,endManipulator:a,lineState:o}=this,s=!1;switch(this.cursorPoint??(this._emulatedDrag?.cancel(),this._emulatedDrag=k(r,n,t)),o){case`initial`:if(this._emulatedDrag?.update(t),this.cursorPoint!=null){this._emulatedDrag?.end(t),this._emulatedDrag=null,this.analysis.valid&&(this.analysis.clear(),this._set(`created`,!1));let{cursorPoint:e}=this;this.startPoint=e,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,i.location=e,i.interactive=!1,a.interactive=!1,this.lineState=`drawing`,this._emulatedDrag=k(a,n,t),s=!0}break;case`drawing`:this._emulatedDrag?.update(t),this.endPoint!=null&&(this._emulatedDrag?.end(t),this._emulatedDrag=null,i.interactive=!0,a.interactive=!0,this.lineState=`measured`,s=!0)}s&&e.stopPropagation()}_surfaceLocation(e,t){return t===0?`on-the-surface`:(e.z??0)>=this._getElevation(e)?`above-the-surface`:`below-the-surface`}_getElevation(e){return this.view.groundView?.ready?g(this.view.elevationProvider,e)??0:0}get test(){}};e([o()],O.prototype,`_snappingManagerResult`,void 0),e([o()],O.prototype,`_snappingManager`,null),e([o({readOnly:!0})],O.prototype,`state`,null),e([o()],O.prototype,`lineState`,void 0),e([o({readOnly:!0})],O.prototype,`cursor`,null),e([o()],O.prototype,`startPoint`,null),e([o()],O.prototype,`endPoint`,null),e([o()],O.prototype,`cursorPoint`,null),e([o({constructOnly:!0})],O.prototype,`analysis`,void 0),e([o({constructOnly:!0})],O.prototype,`analysisViewData`,void 0),e([o()],O.prototype,`measurementView`,void 0),e([o()],O.prototype,`removeIncompleteOnCancel`,void 0),e([o({constructOnly:!0})],O.prototype,`view`,void 0),e([o({readOnly:!0})],O.prototype,`validMeasurement`,null),e([o({value:null})],O.prototype,`startPointSurfaceLocation`,void 0),e([o({value:null})],O.prototype,`endPointSurfaceLocation`,void 0),e([o({value:null})],O.prototype,`cursorPointSurfaceLocation`,void 0),e([o()],O.prototype,`updating`,null),O=e([s(`esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool`)],O);function k(e,t,n){return e.events.emit(`drag`,{action:`start`,pointerType:t,start:n,screenPoint:n}),{update:t=>e.events.emit(`drag`,{action:`update`,start:t,screenPoint:t}),end:t=>e.events.emit(`drag`,{action:`end`,start:t,screenPoint:t}),cancel:()=>e.events.emit(`drag`,{action:`cancel`})}}const A=O;export{A as default};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as h}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as g}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y,resetProperties as b}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as x}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as S}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as w}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as T}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as E}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as D}from"../../../../support/screenUtils.js";let O=class extends _{constructor(e){super(e),this._updatingHandles=new c,this._snappingManagerResult=null,this._emulatedDrag=null,this.lineState=`initial`,this.removeIncompleteOnCancel=!1,this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=n(e=>new C({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new S(new x(`point`,v(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new f}))}initialize(){let{view:e,analysis:t,analysisViewData:n,visible:o}=this;this.measurementView=new h({toolState:this,view:e,analysis:t,analysisViewData:n,visible:o});let{start:s,end:c,cursor:d}=this.measurementView.createManipulators(),f=(e,t,n)=>{let r=y(e,(e,r,i,a)=>{let o=m(e),s=this._ensureSnappingManager(),c=this._getSnappingContext(a),d=this._updatingHandles,{lineState:f}=this;i=i.next(o).next(b(this,[n,t])).next(n=>{if(t!==`cursorPoint`){let n=this.analysis[t];n!=null&&(e.location=n)}return n});let h=p(this.view),g=r.next(o).next(e=>{let r=h(e);return r||this.lineState!==`drawing`&&this.lineState!==`initial`||(this[t]=null,this[n]=null),r});if(a!==`touch`||f===`editing`){let{snappingStep:e,cancelSnapping:t}=w({snappingManager:s,snappingContext:c,updatingHandles:d});i.next(t),g=g.next(...e)}g.next(e=>e.action===`start`?null:e).next(r=>{let i=u(r.mapEnd,new l);this[t]=i,e.location=i,this[n]=this._surfaceLocation(i,r.surfaceType)})});return t===`cursorPoint`?[r]:[r,e.events.on(`grab-changed`,()=>{let e=s.grabbing||c.grabbing;this.lineState=e?`editing`:`measured`}),this._updatingHandles.add(()=>this.analysis[t],t=>{t&&(e.location=t)})]};this.startManipulator=s,this.endManipulator=c,this.cursorManipulator=d,this.manipulators.add(s),this.manipulators.add(c),this.manipulators.add(d),this.addHandles([...f(s,`startPoint`,`startPointSurfaceLocation`),...f(c,`endPoint`,`endPointSurfaceLocation`),...f(d,`cursorPoint`,`cursorPointSurfaceLocation`),r(()=>this.state===`measured`,()=>{this.finishToolCreation(),this.active&&(this.view.activeTool=null)},i),a(()=>({startPointAvailable:this.startPoint!=null,endPointAvailable:this.endPoint!=null}),({startPointAvailable:e,endPointAvailable:t})=>{this.startManipulator.available=e,this.endManipulator.available=t},i)]),E(this)}destroy(){this._updatingHandles=t(this._updatingHandles),this.measurementView=t(this.measurementView)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(this._snappingManagerResult==null){let e=T(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get state(){let{analysis:e}=this;if(e.startPoint==null&&e.endPoint==null)return`ready`;let{lineState:t}=this;return this.validMeasurement&&t!==`editing`&&t!==`drawing`?`measured`:`measuring`}get cursor(){return this.active&&(this.state===`ready`||this.lineState!==`measured`)?`crosshair`:null}get startPoint(){return this.analysis.startPoint}set startPoint(e){this.analysis.startPoint=e}get endPoint(){return this.analysis.endPoint}set endPoint(e){this.analysis.endPoint=e}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(e){this.measurementView.cursorPoint=e}get snappingOptions(){return this._snappingManager?.options}get validMeasurement(){return this.analysis.startPoint!=null&&this.analysis.endPoint!=null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}resetCreated(){super.resetCreated(),this.lineState=`initial`,this.cursorPoint=null,this.state===`measured`&&this.finishToolCreation()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(e){switch(e.type){case`immediate-click`:this._handleImmediateClick(e);break;case`pointer-move`:this._handlePointerMove(e)}}_handlePointerMove(e){if(!this.active||this.view.navigating)return;let{pointerType:t}=e;if(t!==`mouse`)return;let n=D(e),{lineState:r,cursorManipulator:i,endManipulator:a}=this,o=!1;this.cursorPoint??(this._emulatedDrag?.cancel(),this._emulatedDrag=k(i,t,n),o=!0),r===`initial`&&(this._emulatedDrag?.update(n),o=!0),r===`drawing`&&(a.events.emit(`drag`,{action:`update`,start:n,screenPoint:n}),o=!0),o&&e.stopPropagation()}_handleImmediateClick(e){if(!this.active||!d(e))return;let t=D(e),{pointerType:n}=e,{cursorManipulator:r,startManipulator:i,endManipulator:a,lineState:o}=this,s=!1;switch(this.cursorPoint??(this._emulatedDrag?.cancel(),this._emulatedDrag=k(r,n,t)),o){case`initial`:if(this._emulatedDrag?.update(t),this.cursorPoint!=null){this._emulatedDrag?.end(t),this._emulatedDrag=null,this.analysis.valid&&(this.analysis.clear(),this._set(`created`,!1));let{cursorPoint:e}=this;this.startPoint=e,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,i.location=e,i.interactive=!1,a.interactive=!1,this.lineState=`drawing`,this._emulatedDrag=k(a,n,t),s=!0}break;case`drawing`:this._emulatedDrag?.update(t),this.endPoint!=null&&(this._emulatedDrag?.end(t),this._emulatedDrag=null,i.interactive=!0,a.interactive=!0,this.lineState=`measured`,s=!0)}s&&e.stopPropagation()}_surfaceLocation(e,t){return t===0?`on-the-surface`:(e.z??0)>=this._getElevation(e)?`above-the-surface`:`below-the-surface`}_getElevation(e){return this.view.groundView?.ready?g(this.view.elevationProvider,e)??0:0}get test(){}};e([o()],O.prototype,`_snappingManagerResult`,void 0),e([o()],O.prototype,`_snappingManager`,null),e([o({readOnly:!0})],O.prototype,`state`,null),e([o()],O.prototype,`lineState`,void 0),e([o({readOnly:!0})],O.prototype,`cursor`,null),e([o()],O.prototype,`startPoint`,null),e([o()],O.prototype,`endPoint`,null),e([o()],O.prototype,`cursorPoint`,null),e([o({constructOnly:!0})],O.prototype,`analysis`,void 0),e([o({constructOnly:!0})],O.prototype,`analysisViewData`,void 0),e([o()],O.prototype,`measurementView`,void 0),e([o()],O.prototype,`removeIncompleteOnCancel`,void 0),e([o({constructOnly:!0})],O.prototype,`view`,void 0),e([o({readOnly:!0})],O.prototype,`validMeasurement`,null),e([o({value:null})],O.prototype,`startPointSurfaceLocation`,void 0),e([o({value:null})],O.prototype,`endPointSurfaceLocation`,void 0),e([o({value:null})],O.prototype,`cursorPointSurfaceLocation`,void 0),e([o()],O.prototype,`updating`,null),O=e([s(`esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool`)],O);function k(e,t,n){return e.events.emit(`drag`,{action:`start`,pointerType:t,start:n,screenPoint:n}),{update:t=>e.events.emit(`drag`,{action:`update`,start:t,screenPoint:t}),end:t=>e.events.emit(`drag`,{action:`end`,start:t,screenPoint:t}),cancel:()=>e.events.emit(`drag`,{action:`cancel`})}}const A=O;export{A as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,destroyMaybe as r,removeMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as s,whenOnce as c,watch as l,when as u}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as f,isFloat32Array as p,isUint32Array as m,isUint16Array as h}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as g,convertUnit as _}from"../../../core/units.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,invert as x}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as S,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as T}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as E,sub as D,dot as O,set as k}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as A,freeze as j,clone as ee,ZEROS as te,fromValues as ne}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as re,clone as ie,ONES as ae}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as oe,isMars as se,getReferenceEllipsoid as M,SphericalECEFSpatialReferenceLike as ce}from"../../../geometry/ellipsoidUtils.js";import le from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as ue}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as de}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as fe}from"../../../geometry/projection/projectVectorToVector.js";import{create as pe}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as me}from"../../../geometry/support/heightModelInfoUtils.js";import{isInEffectiveScaleRange as he,validateScaleRange as N}from"../../../geometry/support/scaleUtils.js";import{isPlateCarree as P,isWebMercator as F,equals as I,isGeographic as L,isCGCS2000 as R}from"../../../geometry/support/spatialReferenceUtils.js";import z from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as ge,BufferViewVec3u8 as _e,BufferViewVec2f as ve,BufferViewVec3f as B,BufferViewUint32 as V,BufferViewUint16 as H}from"../../../geometry/support/buffer/BufferView.js";import{nullId as U}from"../../../layers/ILyr3DWasmPerSceneView.js";import ye from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as be,validateEntity3D as xe,makeCacheKey as W}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as G}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Se}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as Ce}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as we}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Te,removeLayerViewFromWasm as Ee,getLyr3DWasm as K}from"./Lyr3DWasm.js";import{toWasmModification as De}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as Oe}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ke}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as Ae,alphaModeConversion as je,faceCullingConversion as Me,wrapModeConversion as Ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as Pe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as Fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ie}from"../state/Frustum.js";import{ElevationRange as q}from"../support/ElevationRange.js";import{toBoundingRect as Le}from"../support/extentUtils.js";import{Obb as Re}from"../support/orientedBoundingBox.js";import{glLayout as ze}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Be}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ve,SourceGeometry as He}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ue}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as We}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as Ge}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Ke}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as qe}from"../webgl-engine/materials/pbrUtils.js";import Je from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ye}from"../../support/layerViewUtils.js";import{TaskPriority as Xe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ze}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as J,SizedPixelFormat as Y}from"../../webgl/enums.js";import{alphaCutoff as X}from"../../../webscene/support/AlphaCutoff.js";var Z;function Qe(e,t,n){if(t===`image/vnd-ms.dds`)switch(n){case`Dxt1`:return J.COMPRESSED_RGB_S3TC_DXT1_EXT;case`Dxt5`:return J.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if(t===`image/ktx`)return n===`Etc1`?J.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return Y.RG8;case 6407:return Y.RGB8;case 6408:return Y.RGBA8;case 6403:return Y.R8;default:return null}}let Q=class extends Ce(Je){static{Z=ke}constructor(e){super(e),this[Z]=!0,this.type=`integrated-mesh-3dtiles`,this.skipHeightModelInfoValidation=!0,this.freeze=!1,this._modifications=[],this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._applySSAO=!has(`disable-feature:im-ssao`),this._imShading=!!has(`enable-feature:im-shading`),this._imVertexNormals=!!has(`enable-feature:im-vertex-normals`),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ze,this._dbgFlags=new Set;let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._frameTask=t.scheduler.registerTask(Xe.TILES3D,this),this._frustum=new Ie(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);let n=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=n}):null}canRecycleWith(e){return e.url===this.layer.url&&e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain===this._replacesTerrain}initialize(){this._dbg(2,`Tiles3DLayerView3D initialize() called`);let{view:e}=this;this._workerHandle=new Se(Pe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await c(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw Ye(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await Te(this,t),a(t);let n=new Fe(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new Oe({view:e,layerElevationSource:this,intersectionHandler:n});let r=this._getElevationContext();e.elevationProvider.register(r,this._elevationProvider),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),s),this._updatingHandles.add(()=>this.layer.isUsedAsGroundLayer,()=>this._groundUsageChanged()),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),u(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(l(()=>this._replacesTerrain&&!!this._wasm?.isTerrainReady||!this._replacesTerrain&&!!has(`enable-feature:im-as-ground`)&&this.layer.isUsedAsGroundLayer,e=>{this.layer.queryElevationCallback=e?(e,t)=>this._queryElevation(e,t):null},s))}destroy(){if(this.freeze=!1,this._initializationController=n(this._initializationController),this._dbg(2,`Tiles3DLayerView3D destroy() called`),this._workerHandle?.destroyContextAndSelf(this.uid),Ee(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),null),this._elevationProvider){let e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(let{componentObjects:n}of e)for(let{obb:e}of n)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit(`visible-geometry-changed`),this._visibleGeometryChangedSchedulerHandle=i(this._visibleGeometryChangedSchedulerHandle)}get usedAsGround(){return this.layer.isUsedAsGroundLayer}get replacesTerrain(){return this._replacesTerrain}get fullOpacity(){return has(`enable-feature:im-as-ground`)?this.usedAsGround?this.view.map.ground.opacity:this.layer.opacity:this.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return this._groundTransparencyMode===0}get invisible(){return this._groundTransparencyMode===3}get _groundTransparencyMode(){return(has(`enable-feature:im-as-ground`)?!this.usedAsGround:!this._replacesTerrain)?0:Be(this.fullOpacity,this.view.overlayManager.renderer.isEmpty)}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return X;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){let e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(n=>this._collection.updateObjectOpacity(n,e,t))}_getElevationContext(){return this.replacesTerrain?0:has(`enable-feature:im-as-ground`)?this.usedAsGround?1:2:1}_groundUsageChanged(){let e=this._getElevationContext();this.view.elevationProvider.unregister(this._elevationProvider),this.view.elevationProvider.register(e,this._elevationProvider),this._intersectionHandler.isGround=!has(`enable-feature:im-as-ground`)||this.usedAsGround,this._intersectionHandler.slicePlaneEnabled=this.slicePlaneEnabled&&!this.replacesTerrain,this.view.overlayManager.unregisterDrapeTarget(this),this.view.overlayManager.registerDrapeTarget(this),this._loadModifications();let t=has(`enable-feature:im-as-ground`)?this.usedAsGround:this.replacesTerrain,n=this._renderOpacity,r=this._groundTransparencyMode;this.forEachComponentObject(e=>e.updateMaterial({isGround:t,opacity:n,groundTransparencyMode:r}))}_cameraChanged(){if(this.freeze)return;let e=this._frustum;e.update(this.view.state.contentCamera);let t=this._visibleObjects,n=!1;this._loadedObjects.forEach(r=>{let i=r.obb?.intersectsFrustum(e)??!1;i!==r.isVisible&&(r.isVisible=i,i?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,i)),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(i,r.elevationRange))}),n&&this._setVisibleElevationRangeDirty()}intersect(e,t,n,r){this._intersectionHandler.intersectRay(e,t,n,r,null,!1)}get ready(){return!this.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){let e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=De(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){let e=this.layer.spatialReference,t=pe();this._layerClippingArea=Le(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit(`visible-geometry-changed`),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,G(e))}get _wasm(){return K(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.replacesTerrain||he(this.layer.effectiveScaleRange,this.view.scale)}canResume(){let e=this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.replacesTerrain||N(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,n=0,r=0,i=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,i++):(n+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new we(this.usedMemory,i,a,$(t),$(e),$(r),$(n))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||P(this.view.renderSpatialReference)||F(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&I(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=be(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=L(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=g(z.units[z[t.wkid]])),r&&(e=new le({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=me(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=_(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return G(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new q(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){let e=new q;this._visibleObjects.size===0?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));let t=this._get(`visibleElevationRange`);return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange(`visibleElevationRange`)}_forEachRelevantVisibleTile(e){let{view:t}=this,{spatialReference:n}=t,r=n.isWGS84||n.isWebMercator||R(n)||oe(n)||se(n);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);let i=M(n).radius,{eye:a,viewForward:o,near:s}=t.state.contentCamera,c=E(A(),o),l=Math.max(a[2],500),u=l+i,d=Math.sqrt(u**2-i**2),f=Math.abs(Math.atan2(d,i))*i,p=l>.5*i?.5*Math.PI*i:f,m=A();this.forEachVisibleTile(t=>{let{mbsRadius:n,mbsCenter:r}=t;if(n<0)return;D(m,r,a);let i=O(m,c);Math.abs(i)<p&&i+n>s&&i-n<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(let t of this._visibleObjects)e(t)}forEachTile(e){for(let t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(let{componentObjects:n}of e)for(let e of n)t(e)}get drapeTargetType(){return has(`enable-feature:im-as-ground`)?+!this.usedAsGround:+!this.replacesTerrain}isUpdating(){let e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&e!=null&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!xe(t))throw Error(`entity3D not valid`);let n=new Map,r;try{r=this._createPrimitiveTextureBundles(t,n)}catch(e){throw n.forEach(e=>this._stage?.removeTexture(e)),e}let i=null;try{if(i=await this._createRenderableMain(t,r),this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance`);let{tileObb:a,componentObjects:o,elevationRange:s}=i,c=0,l=0,u=0;for(let e of o){let{texture:t,textureMetallicRoughness:n,textureEmissive:r,textureOcclusion:i,textureNormal:a}=e.renderable.drawParameters;c+=(t?.usedMemory??0)+(n?.usedMemory??0)+(r?.usedMemory??0)+(i?.usedMemory??0)+(a?.usedMemory??0),l+=this._collection.getObjectGPUMemoryUsage(e),u+=e.intersectionGeometry.usedMemory}let d=Array.from(n.values()),f=new et(e.handle,o,d,u,l,c,a,e.stableNodeId,e.nodeDepth,s);return this._lyrHandleToObjects.set(e.handle,f),()=>{this._memCache.put(W(f.handle),f);let{usedMemory:e}=f;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(e){throw r.forEach(e=>e.cleanup()),i?.componentObjects.forEach(e=>this._collection.destroyObject(e)),n.forEach(e=>this._stage?.removeTexture(e)),e}}_createPrimitiveTextureBundles(e,t){let n=[];try{let r=e.desc.geometry;for(let i of e.validPrimitiveIndices){let a=r.prims[i].materialId,o=e.desc.materials?.materials&&a!=null&&a!==U?e.desc.materials.materials[a]:null,s=Promise.resolve(nt),c=null,l=null,u=null,d=null,f=null;if(o){let n=o.lightingModel===`Pbr`;c=this._getTexture(o.baseColorTex,e,t),l=n?this._getTexture(o.metalTex,e,t):null,u=n?this._getTexture(o.emissiveTex,e,t):null,d=n?this._getTexture(o.occlusionTex,e,t):null,f=n?this._getTexture(o.normalTex,e,t):null;let r=[c,l,u,d,f].map(e=>e?.loadPromise??null);s=Promise.all(r)}n.push(new rt(s,c,l,u,d,f))}}catch(e){throw n.forEach(e=>e.cleanup()),e}return n}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy`);let n=[],r=e.desc,i=j(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal,s=C;if(o){let e=w();ue(ce,i,e,a),s=b(S(),e)}let c=tt(r.obb),l=o?M(this.view.spatialReference).radius:0,u=[];try{let d=-1;for(let n of e.validPrimitiveIndices){d+=1;let i=r.geometry.prims[n],a=t[d];if(this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(i)),Ae[i.ptype]==null){this._dbg(2,`[Unsupported Feature] Unsupported primitive mode (`+i.ptype+`). Skipping primitive.`),a.cleanup();continue}let{positionView:o,normalsData:s,colorView:c,texCoord0Data:l,indicesView:f}=this._getBufferViews(i,e);if(o==null||f==null){a.cleanup();continue}let p=o.count,m=(e,t)=>e!=null&&e!==p?(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1):!0;!m(l==null?void 0:l.length/2,`numTexcoord`)||!m(c?.count,`numColors`)||!m(s?.length,`normals`)?a.cleanup():u.push({componentIndex:d,positionView:o,indicesView:f,texCoord0Data:l,colorView:c,normalsData:s})}let f=s!==C,p=f?x(S(),s)??C:C,{vertexProcessingOutputs:m,obbHalfSizeAccumulator:h,elevationRange:g}=await this._workerHandle.processTiles3DVertices(u,i,l,o,s,c,this._imVertexNormals&&!this.usedAsGround);if(this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance`);let _=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance`);m.length>0&&c.setHalfSize(h);for(let o of m){let{componentIndex:s,positionView:l,indicesView:u,layout:d,textureCoordinateType:m,interleavedVertexData:h,indices:g}=o,v=e.validPrimitiveIndices[s],y=r.geometry.prims[v],b=t[s],x=c.clone(),S=ze(d),C=new Uint32Array([0,u.typedBuffer.length]),w=new Ve(S,this._imShading?2:0,m,f?2:0),T=new He({interleavedVertexData:h,vertexCount:h.byteLength/S[0].stride,indexData:g},{positions:l.typedBuffer,indices:u.typedBuffer},C,w),E=this.view.renderSpatialReference,D=A(),O=[1,1,1];de(i,E,O,a)||this._dbg(3,`Unsupported coordinate system for IM overlay`),fe(i,E,D,a);let k=this._createComponentMaterialInitParameters(_,y.materialId,b);k.baseColorTexture||this._dbg(3,`No colour texture 1`);let j=this._collection.createObject({toMapSpace:re(D[0],D[1],O[0],O[1]),transform:new Ue(i,p),obb:x,geometry:T,elevationAlignable:!1},k);n.push(j)}let{fullExtent:v}=this.layer;return v?.hasZ&&v.zmax&&v.zmin&&(g.minElevation=Math.max(g.minElevation,v.zmin),g.maxElevation=Math.min(g.maxElevation,v.zmax)),{tileObb:c,componentObjects:n,elevationRange:g}}catch(e){throw n.forEach(e=>this._collection.destroyObject(e)),e}}_createComponentMaterialInitParameters(e,t,n){let r=e?.materials!=null&&t!=null&&t!==U?e.materials[t]:null,i=1,a=r?.baseColorTex?.imageId;if(a!=null&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){let t=e.images[a];t.alpha&&(i=je[t.alpha])}let o=(r==null?`Unlit`:r.lightingModel)===`Pbr`,s=ae,c=X,l=!1,u=2,d=ne(0,0,0),f=ee(qe),p=n.baseColorTexture,m=n.metallicRoughnessTexture,h=n.emissionTexture,g=n.occlusionTexture,_=n.normalTexture;return r&&(s=ie(r.baseColorFactor),c=r.alphaCutoff??X,o&&(k(f,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(d=r.emissiveFactor)),l=r.isDoubleSided,u=Me[r.faceCulling??`NotSet`]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:c,mrrFactors:f,baseColorTexture:p,metallicRoughnessTexture:m,normalTexture:_,occlusionTexture:g,emissionTexture:h,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:i,doubleSided:l,cullFace:u,isGround:has(`enable-feature:im-as-ground`)?this.usedAsGround:this.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:d,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){let t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){let t=W(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,n){if(this.destroyed||this.destroying)return;let r=this._frustum,i=[],a=!1,o=!1;for(let s=0;s<n;++s){if(!t[s])continue;let n=e[s],c=this._lyrHandleToObjects.get(n);if(c){if(c.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${c.stableNodeId}`);continue}a=!0,c.isLoaded=!0,this._loadedObjects.add(c),this._intersectionHandler.addTile(c),this._usedMemory+=c.usedMemory,this._cacheMemory-=c.usedMemory;let e=c.obb?.intersectsFrustum(r)??!0;c.isVisible=e,e&&(this._visibleObjects.add(c),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,c.elevationRange)),i.push(c.obb),c.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(W(n))}else this._dbg(3,`Tried to mark Non existent object ${n} as loaded`)}for(let r=0;r<n;++r){let n=e[r];if(t[r])continue;let a=this._lyrHandleToObjects.get(n);if(a){if(!a.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${a.stableNodeId}`);continue}let e=a.isVisible;this._visibleObjects.delete(a),a.isVisible=!1,a.isLoaded=!1,this._loadedObjects.delete(a),this._intersectionHandler.removeTile(a),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,a.elevationRange)),this._usedMemory-=a.usedMemory,this._cacheMemory+=a.usedMemory,i.push(a.obb),a.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(W(n),a)}else this._dbg(3,`Tried to mark Non existent object ${n} as not loaded`)}a&&this._visibleGeometryChanged(),i.length>0&&this._elevationProvider.notifyObjectsChanged(i),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){let{visibleElevationRange:n}=this,{minElevation:r,maxElevation:i}=t;return e?r<n.minElevation||i>n.maxElevation:r===n.minElevation||i===n.maxElevation}_getTexture(e,t,n){let r=e&&t.desc.materials?.images?.[e.imageId];if(!r||r.data==null||r.data===U)return null;let i=t.assets[r.data];if(!i||i.byteCount<1||i.dataType!==`U8`)return null;let a=n.get(r)??this._createTexture(e,r,i,n);return a?new We(this._stage.renderView.textures,a.id):null}_createTexture(e,t,n,r){let i=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=t.mipCount?!0:i>1,o=Ne[e.wrapMode??`None`],s=t.alpha?6408:6407,c=new Uint8Array(n.data.buffer,0,n.byteCount),l=null,u=null,d=null;switch(t.format){case`Raw`:t.pixelFormat===`R8`?(l=c,s=6403,u=``):t.pixelFormat===`Rg8`||t.pixelFormat===`Ga8`?(l=c,s=33319,u=``):t.pixelFormat===`Rgb8`?(l=c,s=6407,u=``):t.pixelFormat===`Rgba8`&&(l=c,s=6408,u=``);break;case`Dxt1`:l=c,s=6407,u=`image/vnd-ms.dds`;break;case`Dxt5`:l=c,s=6408,u=`image/vnd-ms.dds`;break;case`Basis`:l=c,s=6407,u=`image/ktx2`;break;case`Etc1`:l=c,s=6407,u=`image/ktx`;break;case`Png`:u=`image/png`,d=document.createElement(`img`);break;case`Jpeg`:u=`image/jpeg`,d=document.createElement(`img`);break;case`Etc2`:u=`image/ktx`,d=document.createElement(`img`);break;case`Astc`:this._dbg(3,`Astc texture not supported`);break;case`Pvrtc`:this._dbg(3,`Pvrtc texture not supported`)}if(d&&u){let e=new Blob([c],{type:u});d.src=URL.createObjectURL(e),l=d}if(l&&u!=null){let e=has(`enable-feature:esri-compress-IM-textures`)?{compressionTracker:this._compressionTracker}:void 0,n=Qe(s,u,t.format),c=new Ge(l,{mipmap:a,maxAnisotropy:i,encoding:u,wrap:o,pixelFormat:s,internalFormat:n??void 0,immutable:n!=null,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(c),r.set(t,c),c}return null}_getBufferViews(e,t){let n,r,i,a;for(let o=0;o<e.atrbs.length;o++){let s=e.atrbs[o],c=t.assets[s.assetId];if(!c)continue;let l=c.data.buffer,u=c.byteCount;try{switch(s.sem){case`Position`:c.ncomp!==3||c.dataType!==`F32`||!p(c.data)?this._dbg(3,`[Unsupported Feature] Unsupported view for Position (`+c+`)`):n=new B(l,0,void 0,u);break;case`Normal`:if(c.ncomp!==3||c.dataType!==`F32`||!p(c.data))this._dbg(3,`[Unsupported Feature] Unsupported view for Normal (`+c+`)`);else{let e=new B(l,0,void 0,u);a=new Uint32Array(e.count),Ke(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,a.length*2))}break;case`TexCoord`:c.ncomp!==2||c.dataType!==`F32`||!p(c.data)?this._dbg(3,`[Unsupported Feature] Unsupported view for Texcoord (`+c+`)`):i===void 0&&(i=new ve(l,0,void 0,u).typedBuffer);break;case`Color`:c.dataType===`U8`&&f(c.data)&&(c.ncomp===4?r=new ge(l,0,void 0,u):c.ncomp===3&&(r=new _e(l,0,void 0,u))),r??this._dbg(3,`[Unsupported Feature] Unsupported view for Color (`+c+`)`);break;case`FeatureIndex`:break;default:this._dbg(2,`[Unsupported Feature] Unsupported semantic (`+s.sem+`). Skipping vertex attribute.`)}}catch(e){this._dbg(2,`Error Creating buffer (`+e+`). Skipping vertex attribute.`)}}let o,s=!1;if(e.index!=null&&e.index!==U){let n=t.assets[e.index];if(!n)s=!0;else{let e=n.byteCount;switch(n.dataType){case`U16`:n.ncomp===1&&h(n.data)&&(o=new H(n.data.buffer,0,void 0,e));break;case`U32`:n.ncomp===1&&m(n.data)&&(o=new V(n.data.buffer,0,void 0,e))}s=!o}}if(!s&&o==null&&n!=null){let e=n.count;o=o=e<65535?new H(new Uint16Array(e).buffer):new V(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:n,colorView:r,texCoord0Data:i,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles(`modifications`),this.layer.modifications==null){this._modifications=[];return}let e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.usedAsGround&&e.type!==`replace`)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info(`Ground layers only support replace modifications. Other modification types have been ignored.`)},s),`modifications`)}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,n){this._dbgFlags.has(e)&&(e===3?t.getLogger(this).error(n):t.getLogger(this).warn(n))}};e([v()],Q.prototype,`freeze`,void 0),e([v()],Q.prototype,`fullOpacity`,null),e([v()],Q.prototype,`opaque`,null),e([v()],Q.prototype,`invisible`,null),e([v({readOnly:!0})],Q.prototype,`ready`,null),e([v({type:[ye]})],Q.prototype,`_modifications`,void 0),e([v()],Q.prototype,`_visibleGeometryChangedSchedulerHandle`,void 0),e([v()],Q.prototype,`layer`,void 0),e([v({readOnly:!0})],Q.prototype,`visibleAtCurrentScale`,null),e([v({readOnly:!0})],Q.prototype,`_collection`,null),e([v()],Q.prototype,`elevationOffset`,null),e([v({readOnly:!0})],Q.prototype,`visibleElevationRange`,null),e([v()],Q.prototype,`fullExtentInLocalViewSpatialReference`,void 0),Q=e([y(`esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D`)],Q);const $e=Q;class et{constructor(e,t,n,r,i,a,o,s,c,l){this.handle=e,this.componentObjects=t,this.textures=n,this.cpuMemoryUsage=r,this.vboMemoryUsage=i,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=s,this.nodeDepth=c,this.elevationRange=l,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;let u=A();o?.getCenter(u),this._obbCenterX=u[0],this._obbCenterY=u[1],this._obbCenterZ=u[2];let d=o?.radius??-1;this._obbRadius=d,this._obbRadiusSquared=d*d,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(A()):te}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;let{_obbCenterX:n,_obbCenterY:r,_obbCenterZ:i}=this,a=n-e[0],o=r-e[1],s=i-e[2],c=a*t[0]+o*t[1]+s*t[2];return a*a+o*o+s*s-c*c<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){let t=this._obbRadius;if(t<0)return!0;let n=e.center,r=e.radius,i=t+r,a=this._obbCenterX-n[0];if(a>i)return!1;let o=this._obbCenterY-n[1];if(o>i)return!1;let s=this._obbCenterZ-n[2];if(s>i)return!1;let c=a*a+o*o+s*s;if(c>i*i)return!1;if(c<=(this._obbShortestHalfsize+r)**2)return!0;let l=r-t;return l>0&&c<=l*l?!0:this.obb?.intersectSphere(e)??!0}}function $(e){return Math.round(e/1048.576)/1e3}function tt(e){return new Re(e.center,e.halfSize,T(...e.quaternion))}const nt=[];class rt{constructor(e,t,n,r,i,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=n,this.emissionTexture=r,this.occlusionTexture=i,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{$e as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,destroyMaybe as r,removeMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as s,whenOnce as c,watch as l,when as u}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as f,isFloat32Array as p,isUint32Array as m,isUint16Array as h}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as g,convertUnit as _}from"../../../core/units.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,invert as x}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as S,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as T}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as E,sub as D,dot as O,set as k}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as A,freeze as j,clone as ee,ZEROS as te,fromValues as ne}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as re,clone as ie,ONES as ae}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as oe,isMars as se,getReferenceEllipsoid as M,SphericalECEFSpatialReferenceLike as ce}from"../../../geometry/ellipsoidUtils.js";import le from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as ue}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as de}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as fe}from"../../../geometry/projection/projectVectorToVector.js";import{create as pe}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as me}from"../../../geometry/support/heightModelInfoUtils.js";import{isInEffectiveScaleRange as he,validateScaleRange as N}from"../../../geometry/support/scaleUtils.js";import{isPlateCarree as P,isWebMercator as F,equals as I,isGeographic as L,isCGCS2000 as R}from"../../../geometry/support/spatialReferenceUtils.js";import z from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as ge,BufferViewVec3u8 as _e,BufferViewVec2f as ve,BufferViewVec3f as B,BufferViewUint32 as V,BufferViewUint16 as H}from"../../../geometry/support/buffer/BufferView.js";import{nullId as U}from"../../../layers/ILyr3DWasmPerSceneView.js";import ye from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as be,validateEntity3D as xe,makeCacheKey as W}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as G}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as Se}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as Ce}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as we}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as Te,removeLayerViewFromWasm as Ee,getLyr3DWasm as K}from"./Lyr3DWasm.js";import{toWasmModification as De}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as Oe}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ke}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as Ae,alphaModeConversion as je,faceCullingConversion as Me,wrapModeConversion as Ne}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as Pe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as Fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ie}from"../state/Frustum.js";import{ElevationRange as q}from"../support/ElevationRange.js";import{toBoundingRect as Le}from"../support/extentUtils.js";import{Obb as Re}from"../support/orientedBoundingBox.js";import{glLayout as ze}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Be}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ve,SourceGeometry as He}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ue}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as We}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as Ge}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Ke}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as qe}from"../webgl-engine/materials/pbrUtils.js";import Je from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ye}from"../../support/layerViewUtils.js";import{TaskPriority as Xe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ze}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as J,SizedPixelFormat as Y}from"../../webgl/enums.js";import{alphaCutoff as X}from"../../../webscene/support/AlphaCutoff.js";var Z;function Qe(e,t,n){if(t===`image/vnd-ms.dds`)switch(n){case`Dxt1`:return J.COMPRESSED_RGB_S3TC_DXT1_EXT;case`Dxt5`:return J.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if(t===`image/ktx`)return n===`Etc1`?J.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return Y.RG8;case 6407:return Y.RGB8;case 6408:return Y.RGBA8;case 6403:return Y.R8;default:return null}}let Q=class extends Ce(Je){static{Z=ke}constructor(e){super(e),this[Z]=!0,this.type=`integrated-mesh-3dtiles`,this.skipHeightModelInfoValidation=!0,this.freeze=!1,this._modifications=[],this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._applySSAO=!has(`disable-feature:im-ssao`),this._imShading=!!has(`enable-feature:im-shading`),this._imVertexNormals=!!has(`enable-feature:im-vertex-normals`),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ze,this._dbgFlags=new Set;let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._frameTask=t.scheduler.registerTask(Xe.TILES3D,this),this._frustum=new Ie(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);let n=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=n}):null}canRecycleWith(e){return e.url===this.layer.url&&e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain===this._replacesTerrain}initialize(){this._dbg(2,`Tiles3DLayerView3D initialize() called`);let{view:e}=this;this._workerHandle=new Se(Pe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await c(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw Ye(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await Te(this,t),a(t);let n=new Fe(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new Oe({view:e,layerElevationSource:this,intersectionHandler:n});let r=this._getElevationContext();e.elevationProvider.register(r,this._elevationProvider),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),s),this._updatingHandles.add(()=>this.layer.isUsedAsGroundLayer,()=>this._groundUsageChanged()),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),u(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(l(()=>this._replacesTerrain&&!!this._wasm?.isTerrainReady||!this._replacesTerrain&&!!has(`enable-feature:im-as-ground`)&&this.layer.isUsedAsGroundLayer,e=>{this.layer.queryElevationCallback=e?(e,t)=>this._queryElevation(e,t):null},s))}destroy(){if(this.freeze=!1,this._initializationController=n(this._initializationController),this._dbg(2,`Tiles3DLayerView3D destroy() called`),this._workerHandle?.destroyContextAndSelf(this.uid),Ee(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),null),this._elevationProvider){let e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(let{componentObjects:n}of e)for(let{obb:e}of n)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit(`visible-geometry-changed`),this._visibleGeometryChangedSchedulerHandle=i(this._visibleGeometryChangedSchedulerHandle)}get usedAsGround(){return this.layer.isUsedAsGroundLayer}get replacesTerrain(){return this._replacesTerrain}get fullOpacity(){return has(`enable-feature:im-as-ground`)?this.usedAsGround?this.view.map.ground.opacity:this.layer.opacity:this.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return this._groundTransparencyMode===0}get invisible(){return this._groundTransparencyMode===3}get _groundTransparencyMode(){return(has(`enable-feature:im-as-ground`)?!this.usedAsGround:!this._replacesTerrain)?0:Be(this.fullOpacity,this.view.overlayManager.renderer.isEmpty)}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return X;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){let e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(n=>this._collection.updateObjectOpacity(n,e,t))}_getElevationContext(){return this.replacesTerrain?0:has(`enable-feature:im-as-ground`)?this.usedAsGround?1:2:1}_groundUsageChanged(){let e=this._getElevationContext();this.view.elevationProvider.unregister(this._elevationProvider),this.view.elevationProvider.register(e,this._elevationProvider),this._intersectionHandler.isGround=!has(`enable-feature:im-as-ground`)||this.usedAsGround,this._intersectionHandler.slicePlaneEnabled=this.slicePlaneEnabled&&!this.replacesTerrain,this.view.overlayManager.unregisterDrapeTarget(this),this.view.overlayManager.registerDrapeTarget(this),this._loadModifications();let t=has(`enable-feature:im-as-ground`)?this.usedAsGround:this.replacesTerrain,n=this._renderOpacity,r=this._groundTransparencyMode;this.forEachComponentObject(e=>e.updateMaterial({isGround:t,opacity:n,groundTransparencyMode:r}))}_cameraChanged(){if(this.freeze)return;let e=this._frustum;e.update(this.view.state.contentCamera);let t=this._visibleObjects,n=!1;this._loadedObjects.forEach(r=>{let i=r.obb?.intersectsFrustum(e)??!1;i!==r.isVisible&&(r.isVisible=i,i?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,i)),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(i,r.elevationRange))}),n&&this._setVisibleElevationRangeDirty()}intersect(e,t,n,r){this._intersectionHandler.intersectRay(e,t,n,r,null,!1)}get ready(){return!this.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){let e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=De(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){let e=this.layer.spatialReference,t=pe();this._layerClippingArea=Le(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit(`visible-geometry-changed`),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,G(e))}get _wasm(){return K(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.replacesTerrain||he(this.layer.effectiveScaleRange,this.view.scale)}canResume(){let e=this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.replacesTerrain||N(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,n=0,r=0,i=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,i++):(n+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new we(this.usedMemory,i,a,$(t),$(e),$(r),$(n))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||P(this.view.renderSpatialReference)||F(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&I(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=be(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=L(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=g(z.units[z[t.wkid]])),r&&(e=new le({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=me(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=_(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return G(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new q(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){let e=new q;this._visibleObjects.size===0?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));let t=this._get(`visibleElevationRange`);return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange(`visibleElevationRange`)}_forEachRelevantVisibleTile(e){let{view:t}=this,{spatialReference:n}=t,r=n.isWGS84||n.isWebMercator||R(n)||oe(n)||se(n);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);let i=M(n).radius,{eye:a,viewForward:o,near:s}=t.state.contentCamera,c=E(A(),o),l=Math.max(a[2],500),u=l+i,d=Math.sqrt(u**2-i**2),f=Math.abs(Math.atan2(d,i))*i,p=l>.5*i?.5*Math.PI*i:f,m=A();this.forEachVisibleTile(t=>{let{mbsRadius:n,mbsCenter:r}=t;if(n<0)return;D(m,r,a);let i=O(m,c);Math.abs(i)<p&&i+n>s&&i-n<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(let t of this._visibleObjects)e(t)}forEachTile(e){for(let t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(let{componentObjects:n}of e)for(let e of n)t(e)}get drapeTargetType(){return has(`enable-feature:im-as-ground`)?+!this.usedAsGround:+!this.replacesTerrain}isUpdating(){let e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&e!=null&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!xe(t))throw Error(`entity3D not valid`);let n=new Map,r;try{r=this._createPrimitiveTextureBundles(t,n)}catch(e){throw n.forEach(e=>this._stage?.removeTexture(e)),e}let i=null;try{if(i=await this._createRenderableMain(t,r),this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance`);let{tileObb:a,componentObjects:o,elevationRange:s}=i,c=0,l=0,u=0;for(let e of o){let{texture:t,textureMetallicRoughness:n,textureEmissive:r,textureOcclusion:i,textureNormal:a}=e.renderable.drawParameters;c+=(t?.usedMemory??0)+(n?.usedMemory??0)+(r?.usedMemory??0)+(i?.usedMemory??0)+(a?.usedMemory??0),l+=this._collection.getObjectGPUMemoryUsage(e),u+=e.intersectionGeometry.usedMemory}let d=Array.from(n.values()),f=new et(e.handle,o,d,u,l,c,a,e.stableNodeId,e.nodeDepth,s);return this._lyrHandleToObjects.set(e.handle,f),()=>{this._memCache.put(W(f.handle),f);let{usedMemory:e}=f;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(e){throw r.forEach(e=>e.cleanup()),i?.componentObjects.forEach(e=>this._collection.destroyObject(e)),n.forEach(e=>this._stage?.removeTexture(e)),e}}_createPrimitiveTextureBundles(e,t){let n=[];try{let r=e.desc.geometry;for(let i of e.validPrimitiveIndices){let a=r.prims[i].materialId,o=e.desc.materials?.materials&&a!=null&&a!==U?e.desc.materials.materials[a]:null,s=Promise.resolve(nt),c=null,l=null,u=null,d=null,f=null;if(o){let n=o.lightingModel===`Pbr`;c=this._getTexture(o.baseColorTex,e,t),l=n?this._getTexture(o.metalTex,e,t):null,u=n?this._getTexture(o.emissiveTex,e,t):null,d=n?this._getTexture(o.occlusionTex,e,t):null,f=n?this._getTexture(o.normalTex,e,t):null;let r=[c,l,u,d,f].map(e=>e?.loadPromise??null);s=Promise.all(r)}n.push(new rt(s,c,l,u,d,f))}}catch(e){throw n.forEach(e=>e.cleanup()),e}return n}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy`);let n=[],r=e.desc,i=j(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal,s=C;if(o){let e=w();ue(ce,i,e,a),s=b(S(),e)}let c=tt(r.obb),l=o?M(this.view.spatialReference).radius:0,u=[];try{let d=-1;for(let n of e.validPrimitiveIndices){d+=1;let i=r.geometry.prims[n],a=t[d];if(this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(i)),Ae[i.ptype]==null){this._dbg(2,`[Unsupported Feature] Unsupported primitive mode (`+i.ptype+`). Skipping primitive.`),a.cleanup();continue}let{positionView:o,normalsData:s,colorView:c,texCoord0Data:l,indicesView:f}=this._getBufferViews(i,e);if(o==null||f==null){a.cleanup();continue}let p=o.count,m=(e,t)=>e!=null&&e!==p?(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1):!0;!m(l==null?void 0:l.length/2,`numTexcoord`)||!m(c?.count,`numColors`)||!m(s?.length,`normals`)?a.cleanup():u.push({componentIndex:d,positionView:o,indicesView:f,texCoord0Data:l,colorView:c,normalsData:s})}let f=s!==C,p=f?x(S(),s)??C:C,{vertexProcessingOutputs:m,obbHalfSizeAccumulator:h,elevationRange:g}=await this._workerHandle.processTiles3DVertices(u,i,l,o,s,c,this._imVertexNormals&&!this.usedAsGround);if(this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance`);let _=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance`);m.length>0&&c.setHalfSize(h);for(let o of m){let{componentIndex:s,positionView:l,indicesView:u,layout:d,textureCoordinateType:m,interleavedVertexData:h,indices:g}=o,v=e.validPrimitiveIndices[s],y=r.geometry.prims[v],b=t[s],x=c.clone(),S=ze(d),C=new Uint32Array([0,u.typedBuffer.length]),w=new Ve(S,this._imShading?2:0,m,f?2:0),T=new He({interleavedVertexData:h,vertexCount:h.byteLength/S[0].stride,indexData:g},{positions:l.typedBuffer,indices:u.typedBuffer},C,w),E=this.view.renderSpatialReference,D=A(),O=[1,1,1];de(i,E,O,a)||this._dbg(3,`Unsupported coordinate system for IM overlay`),fe(i,E,D,a);let k=this._createComponentMaterialInitParameters(_,y.materialId,b);k.baseColorTexture||this._dbg(3,`No colour texture 1`);let j=this._collection.createObject({toMapSpace:re(D[0],D[1],O[0],O[1]),transform:new Ue(i,p),obb:x,geometry:T,elevationAlignable:!1},k);n.push(j)}let{fullExtent:v}=this.layer;return v?.hasZ&&v.zmax&&v.zmin&&(g.minElevation=Math.max(g.minElevation,v.zmin),g.maxElevation=Math.min(g.maxElevation,v.zmax)),{tileObb:c,componentObjects:n,elevationRange:g}}catch(e){throw n.forEach(e=>this._collection.destroyObject(e)),e}}_createComponentMaterialInitParameters(e,t,n){let r=e?.materials!=null&&t!=null&&t!==U?e.materials[t]:null,i=1,a=r?.baseColorTex?.imageId;if(a!=null&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){let t=e.images[a];t.alpha&&(i=je[t.alpha])}let o=(r==null?`Unlit`:r.lightingModel)===`Pbr`,s=ae,c=X,l=!1,u=2,d=ne(0,0,0),f=ee(qe),p=n.baseColorTexture,m=n.metallicRoughnessTexture,h=n.emissionTexture,g=n.occlusionTexture,_=n.normalTexture;return r&&(s=ie(r.baseColorFactor),c=r.alphaCutoff??X,o&&(k(f,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(d=r.emissiveFactor)),l=r.isDoubleSided,u=Me[r.faceCulling??`NotSet`]),{isIntegratedMesh:!0,baseColor:s,textureAlphaCutoff:c,mrrFactors:f,baseColorTexture:p,metallicRoughnessTexture:m,normalTexture:_,occlusionTexture:g,emissionTexture:h,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:i,doubleSided:l,cullFace:u,isGround:has(`enable-feature:im-as-ground`)?this.usedAsGround:this.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:d,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){let t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){let t=W(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,n){if(this.destroyed||this.destroying)return;let r=this._frustum,i=[],a=!1,o=!1;for(let s=0;s<n;++s){if(!t[s])continue;let n=e[s],c=this._lyrHandleToObjects.get(n);if(c){if(c.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${c.stableNodeId}`);continue}a=!0,c.isLoaded=!0,this._loadedObjects.add(c),this._intersectionHandler.addTile(c),this._usedMemory+=c.usedMemory,this._cacheMemory-=c.usedMemory;let e=c.obb?.intersectsFrustum(r)??!0;c.isVisible=e,e&&(this._visibleObjects.add(c),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,c.elevationRange)),i.push(c.obb),c.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(W(n))}else this._dbg(3,`Tried to mark Non existent object ${n} as loaded`)}for(let r=0;r<n;++r){let n=e[r];if(t[r])continue;let a=this._lyrHandleToObjects.get(n);if(a){if(!a.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${a.stableNodeId}`);continue}let e=a.isVisible;this._visibleObjects.delete(a),a.isVisible=!1,a.isLoaded=!1,this._loadedObjects.delete(a),this._intersectionHandler.removeTile(a),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,a.elevationRange)),this._usedMemory-=a.usedMemory,this._cacheMemory+=a.usedMemory,i.push(a.obb),a.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(W(n),a)}else this._dbg(3,`Tried to mark Non existent object ${n} as not loaded`)}a&&this._visibleGeometryChanged(),i.length>0&&this._elevationProvider.notifyObjectsChanged(i),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){let{visibleElevationRange:n}=this,{minElevation:r,maxElevation:i}=t;return e?r<n.minElevation||i>n.maxElevation:r===n.minElevation||i===n.maxElevation}_getTexture(e,t,n){let r=e&&t.desc.materials?.images?.[e.imageId];if(!r||r.data==null||r.data===U)return null;let i=t.assets[r.data];if(!i||i.byteCount<1||i.dataType!==`U8`)return null;let a=n.get(r)??this._createTexture(e,r,i,n);return a?new We(this._stage.renderView.textures,a.id):null}_createTexture(e,t,n,r){let i=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=t.mipCount?!0:i>1,o=Ne[e.wrapMode??`None`],s=t.alpha?6408:6407,c=new Uint8Array(n.data.buffer,0,n.byteCount),l=null,u=null,d=null;switch(t.format){case`Raw`:t.pixelFormat===`R8`?(l=c,s=6403,u=``):t.pixelFormat===`Rg8`||t.pixelFormat===`Ga8`?(l=c,s=33319,u=``):t.pixelFormat===`Rgb8`?(l=c,s=6407,u=``):t.pixelFormat===`Rgba8`&&(l=c,s=6408,u=``);break;case`Dxt1`:l=c,s=6407,u=`image/vnd-ms.dds`;break;case`Dxt5`:l=c,s=6408,u=`image/vnd-ms.dds`;break;case`Basis`:l=c,s=6407,u=`image/ktx2`;break;case`Etc1`:l=c,s=6407,u=`image/ktx`;break;case`Png`:u=`image/png`,d=document.createElement(`img`);break;case`Jpeg`:u=`image/jpeg`,d=document.createElement(`img`);break;case`Etc2`:u=`image/ktx`,d=document.createElement(`img`);break;case`Astc`:this._dbg(3,`Astc texture not supported`);break;case`Pvrtc`:this._dbg(3,`Pvrtc texture not supported`)}if(d&&u){let e=d,t=URL.createObjectURL(new Blob([c],{type:u})),n=()=>{URL.revokeObjectURL(t),e.removeEventListener(`load`,n),e.removeEventListener(`error`,n)};e.addEventListener(`load`,n),e.addEventListener(`error`,n),e.src=t,l=e}if(l&&u!=null){let e=has(`enable-feature:esri-compress-IM-textures`)?{compressionTracker:this._compressionTracker}:void 0,n=Qe(s,u,t.format),c=new Ge(l,{mipmap:a,maxAnisotropy:i,encoding:u,wrap:o,pixelFormat:s,internalFormat:n??void 0,immutable:n!=null,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(c),r.set(t,c),c}return null}_getBufferViews(e,t){let n,r,i,a;for(let o=0;o<e.atrbs.length;o++){let s=e.atrbs[o],c=t.assets[s.assetId];if(!c)continue;let l=c.data.buffer,u=c.byteCount;try{switch(s.sem){case`Position`:c.ncomp!==3||c.dataType!==`F32`||!p(c.data)?this._dbg(3,`[Unsupported Feature] Unsupported view for Position (`+c+`)`):n=new B(l,0,void 0,u);break;case`Normal`:if(c.ncomp!==3||c.dataType!==`F32`||!p(c.data))this._dbg(3,`[Unsupported Feature] Unsupported view for Normal (`+c+`)`);else{let e=new B(l,0,void 0,u);a=new Uint32Array(e.count),Ke(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,a.length*2))}break;case`TexCoord`:c.ncomp!==2||c.dataType!==`F32`||!p(c.data)?this._dbg(3,`[Unsupported Feature] Unsupported view for Texcoord (`+c+`)`):i===void 0&&(i=new ve(l,0,void 0,u).typedBuffer);break;case`Color`:c.dataType===`U8`&&f(c.data)&&(c.ncomp===4?r=new ge(l,0,void 0,u):c.ncomp===3&&(r=new _e(l,0,void 0,u))),r??this._dbg(3,`[Unsupported Feature] Unsupported view for Color (`+c+`)`);break;case`FeatureIndex`:break;default:this._dbg(2,`[Unsupported Feature] Unsupported semantic (`+s.sem+`). Skipping vertex attribute.`)}}catch(e){this._dbg(2,`Error Creating buffer (`+e+`). Skipping vertex attribute.`)}}let o,s=!1;if(e.index!=null&&e.index!==U){let n=t.assets[e.index];if(!n)s=!0;else{let e=n.byteCount;switch(n.dataType){case`U16`:n.ncomp===1&&h(n.data)&&(o=new H(n.data.buffer,0,void 0,e));break;case`U32`:n.ncomp===1&&m(n.data)&&(o=new V(n.data.buffer,0,void 0,e))}s=!o}}if(!s&&o==null&&n!=null){let e=n.count;o=o=e<65535?new H(new Uint16Array(e).buffer):new V(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:n,colorView:r,texCoord0Data:i,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles(`modifications`),this.layer.modifications==null){this._modifications=[];return}let e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.usedAsGround&&e.type!==`replace`)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info(`Ground layers only support replace modifications. Other modification types have been ignored.`)},s),`modifications`)}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,n){this._dbgFlags.has(e)&&(e===3?t.getLogger(this).error(n):t.getLogger(this).warn(n))}};e([v()],Q.prototype,`freeze`,void 0),e([v()],Q.prototype,`fullOpacity`,null),e([v()],Q.prototype,`opaque`,null),e([v()],Q.prototype,`invisible`,null),e([v({readOnly:!0})],Q.prototype,`ready`,null),e([v({type:[ye]})],Q.prototype,`_modifications`,void 0),e([v()],Q.prototype,`_visibleGeometryChangedSchedulerHandle`,void 0),e([v()],Q.prototype,`layer`,void 0),e([v({readOnly:!0})],Q.prototype,`visibleAtCurrentScale`,null),e([v({readOnly:!0})],Q.prototype,`_collection`,null),e([v()],Q.prototype,`elevationOffset`,null),e([v({readOnly:!0})],Q.prototype,`visibleElevationRange`,null),e([v()],Q.prototype,`fullExtentInLocalViewSpatialReference`,void 0),Q=e([y(`esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D`)],Q);const $e=Q;class et{constructor(e,t,n,r,i,a,o,s,c,l){this.handle=e,this.componentObjects=t,this.textures=n,this.cpuMemoryUsage=r,this.vboMemoryUsage=i,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=s,this.nodeDepth=c,this.elevationRange=l,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;let u=A();o?.getCenter(u),this._obbCenterX=u[0],this._obbCenterY=u[1],this._obbCenterZ=u[2];let d=o?.radius??-1;this._obbRadius=d,this._obbRadiusSquared=d*d,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(A()):te}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;let{_obbCenterX:n,_obbCenterY:r,_obbCenterZ:i}=this,a=n-e[0],o=r-e[1],s=i-e[2],c=a*t[0]+o*t[1]+s*t[2];return a*a+o*o+s*s-c*c<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){let t=this._obbRadius;if(t<0)return!0;let n=e.center,r=e.radius,i=t+r,a=this._obbCenterX-n[0];if(a>i)return!1;let o=this._obbCenterY-n[1];if(o>i)return!1;let s=this._obbCenterZ-n[2];if(s>i)return!1;let c=a*a+o*o+s*s;if(c>i*i)return!1;if(c<=(this._obbShortestHalfsize+r)**2)return!0;let l=r-t;return l>0&&c<=l*l?!0:this.obb?.intersectSphere(e)??!0}}function $(e){return Math.round(e/1048.576)/1e3}function tt(e){return new Re(e.center,e.halfSize,T(...e.quaternion))}const nt=[];class rt{constructor(e,t,n,r,i,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=n,this.emissionTexture=r,this.occlusionTexture=i,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{$e as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as n,makeHandle as r}from"../../../../core/handleUtils.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{abortMaybe as a,destroyMaybe as o}from"../../../../core/maybe.js";import{debounce as s}from"../../../../core/promiseUtils.js";import{initial as c,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as d}from"../../../../core/units.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as m}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as g,transformMat2d as _}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as b}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as x}from"../../../input/InputManager.js";import{KeyBindings as S,mediaKeys as C}from"../../../interactive/keybindings.js";import{acquire as w}from"../../../interactive/snapping/SnappingManagerPool.js";const T=Symbol(),E=Symbol();let D=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??`transform`}get _toolType(){switch(this._preferredInteractionTool){case`transform`:return`transform-3d`;case`reshape`:return`reshape-3d`}}get _validatedSelectedElement(){let e=this.selectedElement;if(!e)return null;let{layer:{source:t}}=this;return t?`hasElement`in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new y,this._isOpacityToggled=!1,this._factor=1,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=s(async e=>{let t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(E),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor(`pointer`,`high`),E))}),this._tmpMat2=h(),this._tmpVec2=v()}destroy(){this._createToolAbortController=a(this._createToolAbortController)}initialize(){this.addHandles([n(this._updatingHandles),this._updatingHandles.add(()=>this.enabled,e=>this._enableDisable(e),c),this._updatingHandles.add(()=>this._preferredInteractionTool,e=>this._preferredInteractionToolChanged(e))])}_enableDisable(e){if(!e){this.removeHandles(T);return}this._dynamicImports();let{view:t}=this,n=new S;n.add(C.undo,()=>{this._object?.operations?.undo(),this._object?.emit(`modified-externally`)}),n.add(C.redo,()=>{this._object?.operations?.redo(),this._object?.emit(`modified-externally`)}),n.addToggle(C.preserveAspectRatio,e=>{this._tool?.type===`transform-3d`&&(this._tool.preserveAspectRatio=e.type===`key-down`)}),n.addToggle(C.editSourcePoints,e=>{this._tool?.type===`reshape-3d`&&(this._isEditSourcePointsToggled=e.type===`key-down`)}),n.addToggle(C.rotateIncrements,e=>{this._tool?.type===`transform-3d`&&(this._tool.snapRotation=e.type===`key-down`)}),n.add(C.toggleOpacity,()=>{let e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),n.add(C.moveUp,()=>this._move(0,this._factor)),n.add(C.moveDown,()=>this._move(0,-this._factor)),n.add(C.moveRight,()=>this._move(this._factor,0)),n.add(C.moveLeft,()=>this._move(-this._factor,0)),n.addToggle(C.factorModifier,e=>this._factor=e.type===`key-down`?10:1),this._isOpacityToggled=!1,this.addHandles([n.register(t,x.TOOL),r(()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)}),t.on(`immediate-click`,e=>this._onClick(e),x.TOOL),t.on(`pointer-move`,e=>this._onPointerMove(e).catch(()=>{}),x.TOOL),this._updatingHandles.add(()=>this._validatedSelectedElement,(e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)},c),r(()=>{this.removeHandles(E),this._removeTool()})],T)}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{let t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(E))}))}async _selectedElementChanged(e){e?.georeference?this._object?.element!==e&&await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}async _recreateTool(){this._createToolAbortController=a(this._createToolAbortController),this._removeTool();let e=this._validatedSelectedElement;if(!e)return;let t=new AbortController;this._createToolAbortController=t;let{ManipulatedObject3DMediaElement:n,ExtentTransformTool:i,ReshapeTool3D:s}=await this._dynamicImports();if(t.signal.aborted)return;let{view:c,layer:d,_toolType:f}=this;switch(this._object=new n({view:c,layer:d,element:e,tool:this._preferredInteractionTool}),f){case`transform-3d`:this._tool=new i({view:c,object:this._object}),c.inputManager.isModifierKeyDown(C.rotateIncrements.key)&&(this._tool.snapRotation=!0),c.inputManager.isModifierKeyDown(C.preserveAspectRatio.key)&&(this._tool.preserveAspectRatio=!0);break;case`reshape-3d`:{let e=w(c),{snappingManager:t}=e;this._tool=new s({view:c,object:this._object,enableMidpoints:!1,enableZShape:!1,snappingManager:t,enableMoveObject:!1,autoHideManipulators:!0,enableDeleteVertices:!1,toolOptions:{tooltips:{enabled:!0,inputEnabled:!0,visibleElements:{area:!1}}}}),this.addHandles([e,l(()=>({editSourcePoints:this.editSourcePoints,operations:this._object?.operations}),e=>{e.operations instanceof b&&(e.operations.editSourcePoints=e.editSourcePoints)},u)],this._tool)}}this.addHandles([r(()=>{this._object=o(this._object),this._tool&&=(c.tools.remove(this._tool),null)})],this._tool),c.addAndActivateTool(this._tool)}_preferredInteractionToolChanged(e){let{_tool:t}=this;if(!t)return;if(this._toolType!==t.type){this._updatingHandles.consumePromise(this._recreateTool());return}let{_object:n}=this;n&&(n.tool=e)}async _dynamicImports(){let[{ManipulatedObject3DMediaElement:e},{ExtentTransformTool:t,ReshapeTool3D:n}]=await Promise.all([import(`../../interactive/editingTools/ManipulatedObject3DMediaElement.js`),import(`../../interactive/editingTools.js`)]);return{ManipulatedObject3DMediaElement:e,ExtentTransformTool:t,ReshapeTool3D:n}}async _findElementAtScreenPoint(e){let t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return t?.type===`media`?t.element:null}_removeTool(){this._tool&&this.removeHandles(this._tool)}_move(e,t){let{view:n,_object:r}=this,a=r?.operations;if(!a)return;let o=n.overlayPixelSizeInMapUnits(n.pointsOfInterest.focus.location)*d(n.spatialReference)/d(a.data.spatialReference),{_tmpMat2:s,_tmpVec2:c}=this,l=m(s,i(360-this.view.camera.heading)),u=g(c,o*e,o*t);_(u,u,l),a.move(u[0],u[1],0),r.emit(`modified-externally`)}};e([f({constructOnly:!0})],D.prototype,`view`,void 0),e([f({constructOnly:!0})],D.prototype,`layer`,void 0),e([f()],D.prototype,`selectedElement`,void 0),e([f()],D.prototype,`enabled`,void 0),e([f()],D.prototype,`options`,void 0),e([f()],D.prototype,`editSourcePoints`,null),e([f()],D.prototype,`_isEditSourcePointsToggled`,void 0),e([f()],D.prototype,`updating`,null),e([f()],D.prototype,`_preferredInteractionTool`,null),e([f()],D.prototype,`_validatedSelectedElement`,null),D=e([p(`esri.views.3d.layers.support.MediaLayerInteraction`)],D);export{D as MediaLayerInteraction};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as n,makeHandle as r}from"../../../../core/handleUtils.js";import{deg2rad as i}from"../../../../core/mathUtils.js";import{abortMaybe as a,destroyMaybe as o}from"../../../../core/maybe.js";import{debounce as s}from"../../../../core/promiseUtils.js";import{initial as c,watch as l,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as d}from"../../../../core/units.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as m}from"../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{set as g,transformMat2d as _}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{ControlPointOperations as b}from"../../interactive/editingTools/media/ControlPointOperations.js";import{ViewEventPriorities as x}from"../../../input/InputManager.js";import{KeyBindings as S,mediaKeys as C}from"../../../interactive/keybindings.js";import{acquireForFeaturePlacement as w}from"../../../interactive/snapping/SnappingManagerPool.js";const T=Symbol(),E=Symbol();let D=class extends t{get editSourcePoints(){return!!this.options?.reshapeOptions.editSourcePoints!==this._isEditSourcePointsToggled}get updating(){return this._updatingHandles.updating}get _preferredInteractionTool(){return this.options?.tool??`transform`}get _toolType(){switch(this._preferredInteractionTool){case`transform`:return`transform-3d`;case`reshape`:return`reshape-3d`}}get _validatedSelectedElement(){let e=this.selectedElement;if(!e)return null;let{layer:{source:t}}=this;return t?`hasElement`in t?t.hasElement(e)?e:null:t===e?e:null:null}constructor(e){super(e),this.enabled=!1,this._isEditSourcePointsToggled=!1,this._updatingHandles=new y,this._isOpacityToggled=!1,this._factor=1,this._tool=null,this._object=null,this._createToolAbortController=null,this._onPointerMove=s(async e=>{let t=await this._updatingHandles.addPromise(this._findElementAtScreenPoint(e));this.destroyed||(this.removeHandles(E),t&&t!==this.selectedElement&&this.addHandles(this.view.acquireCursor(`pointer`,`high`),E))}),this._tmpMat2=h(),this._tmpVec2=v()}destroy(){this._createToolAbortController=a(this._createToolAbortController)}initialize(){this.addHandles([n(this._updatingHandles),this._updatingHandles.add(()=>this.enabled,e=>this._enableDisable(e),c),this._updatingHandles.add(()=>this._preferredInteractionTool,e=>this._preferredInteractionToolChanged(e))])}_enableDisable(e){if(!e){this.removeHandles(T);return}this._dynamicImports();let{view:t}=this,n=new S;n.add(C.undo,()=>{this._object?.operations?.undo(),this._object?.emit(`modified-externally`)}),n.add(C.redo,()=>{this._object?.operations?.redo(),this._object?.emit(`modified-externally`)}),n.addToggle(C.preserveAspectRatio,e=>{this._tool?.type===`transform-3d`&&(this._tool.preserveAspectRatio=e.type===`key-down`)}),n.addToggle(C.editSourcePoints,e=>{this._tool?.type===`reshape-3d`&&(this._isEditSourcePointsToggled=e.type===`key-down`)}),n.addToggle(C.rotateIncrements,e=>{this._tool?.type===`transform-3d`&&(this._tool.snapRotation=e.type===`key-down`)}),n.add(C.toggleOpacity,()=>{let e=this._object?.element;e&&(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),n.add(C.moveUp,()=>this._move(0,this._factor)),n.add(C.moveDown,()=>this._move(0,-this._factor)),n.add(C.moveRight,()=>this._move(this._factor,0)),n.add(C.moveLeft,()=>this._move(-this._factor,0)),n.addToggle(C.factorModifier,e=>this._factor=e.type===`key-down`?10:1),this._isOpacityToggled=!1,this.addHandles([n.register(t,x.TOOL),r(()=>{this._isOpacityToggled&&this.selectedElement&&(this.selectedElement.opacity*=2,this._isOpacityToggled=!1)}),t.on(`immediate-click`,e=>this._onClick(e),x.TOOL),t.on(`pointer-move`,e=>this._onPointerMove(e).catch(()=>{}),x.TOOL),this._updatingHandles.add(()=>this._validatedSelectedElement,(e,t)=>{t&&e!==t&&this._isOpacityToggled&&(t.opacity*=2,this._isOpacityToggled=!1),this._selectedElementChanged(e)},c),r(()=>{this.removeHandles(E),this._removeTool()})],T)}async _onClick(e){await this._updatingHandles.addPromise(e.defer(async()=>{let t=await this._findElementAtScreenPoint(e);this.destroyed||(t&&e.stopPropagation(),this.selectedElement=t,this.selectedElement&&this.removeHandles(E))}))}async _selectedElementChanged(e){e?.georeference?this._object?.element!==e&&await this._updatingHandles.addPromise(this._recreateTool()):this._removeTool()}async _recreateTool(){this._createToolAbortController=a(this._createToolAbortController),this._removeTool();let e=this._validatedSelectedElement;if(!e)return;let t=new AbortController;this._createToolAbortController=t;let{ManipulatedObject3DMediaElement:n,ExtentTransformTool:i,ReshapeTool3D:s}=await this._dynamicImports();if(t.signal.aborted)return;let{view:c,layer:d,_toolType:f}=this;switch(this._object=new n({view:c,layer:d,element:e,tool:this._preferredInteractionTool}),f){case`transform-3d`:this._tool=new i({view:c,object:this._object}),c.inputManager.isModifierKeyDown(C.rotateIncrements.key)&&(this._tool.snapRotation=!0),c.inputManager.isModifierKeyDown(C.preserveAspectRatio.key)&&(this._tool.preserveAspectRatio=!0);break;case`reshape-3d`:{let e=w(c),{snappingManager:t}=e;this._tool=new s({view:c,object:this._object,enableMidpoints:!1,enableZShape:!1,snappingManager:t,enableMoveObject:!1,autoHideManipulators:!0,enableDeleteVertices:!1,toolOptions:{tooltips:{enabled:!0,inputEnabled:!0,visibleElements:{area:!1}}}}),this.addHandles([e,l(()=>({editSourcePoints:this.editSourcePoints,operations:this._object?.operations}),e=>{e.operations instanceof b&&(e.operations.editSourcePoints=e.editSourcePoints)},u)],this._tool)}}this.addHandles([r(()=>{this._object=o(this._object),this._tool&&=(c.tools.remove(this._tool),null)})],this._tool),c.addAndActivateTool(this._tool)}_preferredInteractionToolChanged(e){let{_tool:t}=this;if(!t)return;if(this._toolType!==t.type){this._updatingHandles.consumePromise(this._recreateTool());return}let{_object:n}=this;n&&(n.tool=e)}async _dynamicImports(){let[{ManipulatedObject3DMediaElement:e},{ExtentTransformTool:t,ReshapeTool3D:n}]=await Promise.all([import(`../../interactive/editingTools/ManipulatedObject3DMediaElement.js`),import(`../../interactive/editingTools.js`)]);return{ManipulatedObject3DMediaElement:e,ExtentTransformTool:t,ReshapeTool3D:n}}async _findElementAtScreenPoint(e){let t=(await this.view.hitTest(e,{include:[this.layer]})).results[0];return t?.type===`media`?t.element:null}_removeTool(){this._tool&&this.removeHandles(this._tool)}_move(e,t){let{view:n,_object:r}=this,a=r?.operations;if(!a)return;let o=n.overlayPixelSizeInMapUnits(n.pointsOfInterest.focus.location)*d(n.spatialReference)/d(a.data.spatialReference),{_tmpMat2:s,_tmpVec2:c}=this,l=m(s,i(360-this.view.camera.heading)),u=g(c,o*e,o*t);_(u,u,l),a.move(u[0],u[1],0),r.emit(`modified-externally`)}};e([f({constructOnly:!0})],D.prototype,`view`,void 0),e([f({constructOnly:!0})],D.prototype,`layer`,void 0),e([f()],D.prototype,`selectedElement`,void 0),e([f()],D.prototype,`enabled`,void 0),e([f()],D.prototype,`options`,void 0),e([f()],D.prototype,`editSourcePoints`,null),e([f()],D.prototype,`_isEditSourcePointsToggled`,void 0),e([f()],D.prototype,`updating`,null),e([f()],D.prototype,`_preferredInteractionTool`,null),e([f()],D.prototype,`_validatedSelectedElement`,null),D=e([p(`esri.views.3d.layers.support.MediaLayerInteraction`)],D);export{D as MediaLayerInteraction};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{deg2rad as t,clamp as n,acosClamped as r,asinClamped as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as o,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as ee,length as m,dot as h,subtract as g,normalize as _,squaredDistance as v,copy as y,transformMat4 as b,add as x,distance as te,cross as S,scale as C,lerp as ne,set as re}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as ie,create as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as ae,axis as oe,fromPoints as se,wrapAxisAngle as ce}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as le,vectorCoordinates as ue}from"../../../../geometry/support/coordinateSystem.js";import{create as de,fromNormalAndOffset as fe,intersectRay as T}from"../../../../geometry/support/plane.js";import{Sphere as pe}from"../../../../geometry/support/sphere.js";import{sm4d as me,sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as D,fromScreen as he}from"../../support/geometryUtils/ray.js";import{intersectScreen as ge}from"../../support/geometryUtils/sphere.js";import _e from"../../webgl/RenderCamera.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";const be=30,xe=[1,3e8],Se=8,Ce=[200,1508e5],we=5,Te=50,Ee=5,De=10,Oe=90,O=1e-6,ke={exclude:new Set([ye])};function Ae(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function je(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function k(e,t,n){let r=o(me.get(),n[3],oe(n));r==null||s(r,u)||(g(Y,e.eye,t),b(Y,Y,r),e.eye=x(Y,Y,t),g(Y,e.center,t),b(Y,Y,r),e.center=x(Y,Y,t),e.up=b(Y,e.up,r))}function Me(e,t,n,r){return T(e,he(t,n,dt),r)}function Ne(e,t,n,r){return T(e,D(t,n,dt),r)}function Pe(e,t,n,r){let i=E.get(),a=1-n;g(i,t,e.eye);let o=m(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),!(Math.abs(o-s)<O)&&(C(i,i,a),e.eye=x(Y,e.eye,i),e.center=ne(Y,e.center,t,a))}function Fe(e,t,n){t.getScreenCenter(Ie),ge(e,t,Ie,Y)&&(t.center=Y);let r=t.distance,i=r*n;if(Math.abs(r-i)<O)return;let a=C(E.get(),t.viewForward,i);t.eye=g(Y,t.center,a)}const Ie=a();function Le(e,t){re(t,0,0,0);for(let n of e)x(t,t,n);C(t,t,1/e.length)}function Re(e,t,n,r){return Math.sin(e/m(t))*(n+r.radius)}function ze(e,t,n,r){return Re(Math.PI/2,t,n,r)+(e-Math.PI/2)}const A={Elevation:3e4,Angle:t(16)},j=t(80);function Be(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.viewingMode);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,l=w(),u=new pe,d=!0,f=!0,{eye:p}=t;o.intersectIntersectorScreen(n,s,a);let h=s.results.min;return h.getIntersectionPoint(l)&&!ee(p,l)&&it(p,l,r)?(c=ie(h.normal),u.radius=m(l)):(f=!1,u.radius=!t.aboveGround||i===0?m(t.eye)-t.relativeElevation:Math.max(m(t.center),.9*r),i===1?Ue(u,t,n,l):d=ge(u,t,n,l)),{sphere:u,scenePickPoint:d?l:null,hasGeometryIntersection:f,intersectorType:h.intersector,normal:c}}function Ve(e,t,n,r){let i=e.relativeElevation;if(i>A.Elevation&&r===`global`)return 1;D(e,t,$);let a=Math.sign(i),o=n.worldUpAtPosition(e.eye,Y);return-a*h(o,$.direction)<Math.sin(A.Angle)*m($.direction)?0:1}function He(e,t,n){g(M,n,t),e.eye=g(Y,e.eye,M),e.center=g(Y,e.center,M)}const M=w();function Ue(e,t,n,r){let i=D(t,n,dt);return i!=null&&(e.closestPointOnSilhouette(i,N),e.intersectRay(i,r)?v(N,i.origin)<v(r,i.origin)?(y(r,N),!1):!0:(g(P,t.eye,t.center),_(P,P),fe(P,-h(_(P,P),N),We),T(We,i,r),!1))}const N=w(),P=w(),We=de();function Ge(a,o,s,c,l,u){let d=0;if(S(Q,a,o),g(X,a,o),m(a)<=l||!c.aboveGround){S(s,X,c.eye);let f=h(a,o)/(m(a)*m(o));if(f<.9999)d=r(f);else{let e=m(S(w(),a,o))/(m(a)*m(o));d=i(e)}let p=Math.cos(n(e.normalize(t(u)),0,j));d=-d-Math.max(0,m(o)-l)/(p*l)}else g(Ke,c.eye,c.center),S(s,X,Ke),d=-m(X)/l;return _(s,s),C(s,s,m(Q)),d}const Ke=w();function F(i,a,o,s){let c,l,u=Math.cos(n(e.normalize(t(s)),0,j));return c=a>o?-(a-o)/(u*o):a<-o?Math.PI-(a+o)/(u*o):r(a/o),l=i>o?-(i-o)/(u*o):i<-o?Math.PI-(i+o)/(u*o):r(i/o),(l-c)*o}function qe(e,t,n,r,i,a,o,s,c,l){let u=F(e[2],t[2],a.radius,s),d=c?F(e[0],t[0],a.radius,180):t[0]-e[0],p=Math.sin(o)*d-Math.cos(o)*u,ee=Math.cos(o)*d+Math.sin(o)*u;_(Y,i);let m=c?p/Math.sqrt(Math.abs(a.radius**2-h(n,Y)**2)):p/a.radius,g=ee/Math.sqrt(Math.abs(a.radius**2-h(n,r)**2));f(l,m,g)}function Je(e,t,n,r,i,a,o,s,c,l){S(Q,e,t),le(a.up,a.eye,V,H,U),le([0,0,1],a.eye,z,B,at),y(n,B),y(r,z),_(n,n),C(n,n,m(Q)),ue(e,_(H,H),_(U,U),_(V,V),ot),ue(t,H,U,V,st),qe(ot,st,e,z,B,o,s,c,l,i)}function Ye(e,t,n,r,i,a,s){o(G,i,r),o(K,s,a),l(q,G,K),g(t,e,n),b(t,t,q),x(t,t,n)}function Xe(e,t,n,r,i,a){o(G,r,n),o(K,a,i),l(q,G,K),g(Y,e.eye,t),b(Y,Y,q),e.eye=x(Y,Y,t),g(Y,e.center,t),b(Y,Y,q),e.center=x(Y,Y,t),g(Y,e.up,t),b(Y,Y,q),e.up=x(Y,Y,t)}const I={Pole:.95,Angle:t(18),Tilt:45,TiltHysteresisMargin:1e-7};let L=!1;function R(e,t,n,r,i,a){let o=Math.abs(r)>Math.PI-I.Angle||Math.abs(r)<I.Angle,s=(Math.abs(e[2])<n*I.Pole||Math.abs(t)>n)&&a;return o&&s?!L&&i<I.Tilt-I.TiltHysteresisMargin?L=!0:L&&i>I.Tilt+I.TiltHysteresisMargin&&(L=!1):L=!1,L}function Ze(e,t,n,r,i,a){if(a)se(n,r,ct),k(t,e.center,ct);else{let a=Ge(n,r,lt,t,e.radius,i);k(t,e.center,ce(lt,a))}}function Qe(e,t,n,r,i,a,o){let s=o?20:1;y(J,r),Z.copyFrom(t);let c,l;for(let r=0;r<s&&v(n,J)>1e-12&&(c=v(n,J),Je(n,J,B,z,W,Z,e,i,a,o),Xe(Z,e.center,z,W[1],B,W[0]),Ye(J,J,e.center,z,W[1],B,W[0]),l=v(n,J),l<c||r===0);r++)t.copyFrom(Z)}function $e(n,r,i,a,o,s,c){R(i,h(r.up,i),n.radius,-e.normalize(t(o)),s,r.aboveGround)?Qe(n,r,i,a,-e.normalize(t(o)),s,c):Ze(n,r,i,a,s,c)}function et(e,t,n,r,i,a){let{eye:o}=e;le([0,0,1],o,z,B,at);let s=t.translation[0]*n.pan,l=i.mode===`zoom`?0:t.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-h(e.center,z)**2/m(e.center)**2)),.5),d=(Math.sin(a)*l+Math.cos(a)*s)/u,f=-Math.cos(a)*l+Math.sin(a)*s;switch(c(r.pan.matrix,r.pan.matrix,d,z),r.pan.enabled=!0,i.mode){case`pan`:c(r.pan.matrix,r.pan.matrix,f,B),r.pan.enabled=!0;break;case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function tt(e,t,n,r,i){let{eye:a,viewRight:o}=e,s=S(E.get(),o,a),l=t.translation[0]*n.pan;switch(l!==0&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),i.mode){case`pan`:{let e=t.translation[1]*n.pan;e!==0&&(c(r.pan.matrix,r.pan.matrix,e,o),r.pan.enabled=!0);break}case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function nt(n,r,i,a,o,s,c,l,u){R(n.center,h(n.up,n.center),m(n.center),-e.normalize(t(s)),c,r.aboveGround)?et(r,i,a,l,u,-e.normalize(t(o))):tt(r,i,a,l,u)}function rt(e,t,n=1/0){let r=Math.abs(h(e,t));return Math.min(n,1/r)}function it(e,t,n){let r=te(e,t),i=m(e);return r<Math.max(i,n)}const z=w(),B=w(),at=w(),V=w(),H=w(),U=w(),ot=w(),st=w(),W=p(),ct=ae(),G=d(),K=d(),q=d(),J=w(),Y=w(),X=w();let Z=new _e;const Q=w(),lt=w();function ut(){Z=new _e}const dt={origin:w(),direction:w()},$={origin:w(),direction:w()};export{j as TiltThresholdPanningSpeed,A as VerticalPanTresholds,He as applyPanPlanar,Ze as applyPanSphericalDirectRotation,Qe as applyPanSphericalPreserveHeading,k as applyRotation,Xe as applyRotationWithTwoAxes,Fe as applyZoomOnSphere,Pe as applyZoomToPoint,Le as centroid,ut as cleanupNavigationUtils,O as distanceComparisonTolerance,ke as excludeTerrain,rt as getTiltScaleFactor,Ve as inferNavigationMode,Me as intersectPlaneFromScreenPoint,Ne as intersectPlaneFromScreenPointAtEye,it as isHitOnSamePlanetSide,F as lengthFromPoints,we as maxPanDistanceModifier,Ee as maxRotatePivotDistanceModifier,be as maxZoomPivotDistanceModifier,Se as maxZoomStepDistanceModifier,Te as minPinchAndPanCameraHeight,De as minRotatePivotDistance,Ae as normalizeCoordinate,je as normalizeRotationDelta,ze as offSurfaceTiltToEyeTiltGlobal,Re as onSurfaceTiltToEyeTiltGlobal,nt as panMotionToRotationMatrix,$e as panToPosition,Be as pickPointAndInitSphere,I as preservingHeadingThresholds,Ye as rotatePointAroundTwoAxes,Ge as rotationAngleAndAxisDirectRotation,Je as rotationAnglesAndAxesHeadingPreserving,qe as rotationAnglesHeadingPreserving,Oe as searchAreaSize,R as shouldPreserveHeading,Ue as sphereOrPlanePointFromScreenPoint,xe as zoomPivotDistanceClamp,Ce as zoomStepDistanceClamp};
2
+ import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{deg2rad as t,clamp as n,acosClamped as r,asinClamped as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as o,exactEquals as s,multiply as c,rotate as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as ee,length as m,dot as h,subtract as g,normalize as _,squaredDistance as v,copy as y,transformMat4 as b,add as x,distance as te,cross as S,scale as C,lerp as ne,set as re}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as ie,create as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as ae,axis as oe,fromPoints as se,wrapAxisAngle as ce}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as le,vectorCoordinates as ue}from"../../../../geometry/support/coordinateSystem.js";import{create as de,fromNormalAndOffset as fe,intersectRay as T}from"../../../../geometry/support/plane.js";import{Sphere as pe}from"../../../../geometry/support/sphere.js";import{sm4d as me,sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as D,fromScreen as he}from"../../support/geometryUtils/ray.js";import{intersectScreen as ge}from"../../support/geometryUtils/sphere.js";import _e from"../../webgl/RenderCamera.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";const be=30,xe=[1,3e8],Se=8,Ce=[200,1508e5],we=5,Te=50,Ee=5,De=10,Oe=90,O=1e-6,ke={exclude:new Set([ye])};function Ae(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function je(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function k(e,t,n){let r=o(me.get(),n[3],oe(n));r==null||s(r,u)||(g(Y,e.eye,t),b(Y,Y,r),e.eye=x(Y,Y,t),g(Y,e.center,t),b(Y,Y,r),e.center=x(Y,Y,t),e.up=b(Y,e.up,r))}function Me(e,t,n,r){return T(e,he(t,n,dt),r)}function Ne(e,t,n,r){return T(e,D(t,n,dt),r)}function Pe(e,t,n,r){let i=E.get(),a=1-n;g(i,t,e.eye);let o=m(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),!(Math.abs(o-s)<O)&&(C(i,i,a),e.eye=x(Y,e.eye,i),e.center=ne(Y,e.center,t,a))}function Fe(e,t,n){t.getScreenCenter(Ie),ge(e,t,Ie,Y)&&(t.center=Y);let r=t.distance,i=r*n;if(Math.abs(r-i)<O)return;let a=C(E.get(),t.viewForward,i);t.eye=g(Y,t.center,a)}const Ie=a();function Le(e,t){re(t,0,0,0);for(let n of e)x(t,t,n);C(t,t,1/e.length)}function Re(e,t,n,r){return Math.sin(e/m(t))*(n+r.radius)}function ze(e,t,n,r){return Re(Math.PI/2,t,n,r)+(e-Math.PI/2)}const A={Elevation:3e4,Angle:t(16)},j=t(80);function Be(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.viewingMode);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,l=w(),u=new pe,d=!0,f=!0,{eye:p}=t;o.intersectIntersectorScreen(n,s,a);let h=s.results.min;return h.getIntersectionPoint(l)&&!ee(p,l)&&it(p,l,r)?(c=ie(h.normal),u.radius=m(l)):(f=!1,u.radius=!t.aboveGround||i===0?m(t.eye)-t.relativeElevation:Math.max(m(t.center),.9*r),i===1?Ue(u,t,n,l):d=ge(u,t,n,l)),{sphere:u,scenePickPoint:d?l:null,hasGeometryIntersection:f,intersectorType:h.intersector,normal:c}}function Ve(e,t,n,r){let i=e.relativeElevation;if(i>A.Elevation&&r===`global`)return 1;D(e,t,$);let a=Math.sign(i),o=n.worldUpAtPosition(e.eye,Y);return-a*h(o,$.direction)<Math.sin(A.Angle)*m($.direction)?0:1}function He(e,t,n){g(M,n,t),e.eye=g(Y,e.eye,M),e.center=g(Y,e.center,M)}const M=w();function Ue(e,t,n,r){let i=D(t,n,dt);return i!=null&&(e.closestPointOnSilhouette(i,N),e.intersectRay(i,r)?v(N,i.origin)<v(r,i.origin)?(y(r,N),!1):!0:(g(P,t.eye,t.center),_(P,P),fe(P,-h(_(P,P),N),We),T(We,i,r),!1))}const N=w(),P=w(),We=de();function Ge(a,o,s,c,l,u){let d=0;if(S(Q,a,o),g(X,a,o),m(a)<=l||!c.aboveGround){S(s,X,c.eye);let f=h(a,o)/(m(a)*m(o));if(f<.9999)d=r(f);else{let e=m(S(w(),a,o))/(m(a)*m(o));d=i(e)}let p=Math.cos(n(e.normalize(t(u)),0,j));d=-d-Math.max(0,m(o)-l)/(p*l)}else g(Ke,c.eye,c.center),S(s,X,Ke),d=-m(X)/l;return _(s,s),C(s,s,m(Q)),d}const Ke=w();function F(i,a,o,s){let c,l,u=Math.cos(n(e.normalize(t(s)),0,j));return c=a>o?-(a-o)/(u*o):a<-o?Math.PI-(a+o)/(u*o):r(a/o),l=i>o?-(i-o)/(u*o):i<-o?Math.PI-(i+o)/(u*o):r(i/o),(l-c)*o}function qe(e,t,n,r,i,a,o,s,c,l){let u=F(e[2],t[2],a.radius,s),d=c?F(e[0],t[0],a.radius,180):t[0]-e[0],p=Math.sin(o)*d-Math.cos(o)*u,ee=Math.cos(o)*d+Math.sin(o)*u;_(Y,i);let m=c?p/Math.sqrt(Math.abs(a.radius**2-h(n,Y)**2)):p/a.radius,g=ee/Math.sqrt(Math.abs(a.radius**2-h(n,r)**2));f(l,m,g)}function Je(e,t,n,r,i,a,o,s,c,l){S(Q,e,t),le(a.up,a.eye,V,H,U),le([0,0,1],a.eye,z,B,at),y(n,B),y(r,z),_(n,n),C(n,n,m(Q)),ue(e,_(H,H),_(U,U),_(V,V),ot),ue(t,H,U,V,st),qe(ot,st,e,z,B,o,s,c,l,i)}function Ye(e,t,n,r,i,a,s){o(G,i,r),o(K,s,a),c(q,G,K),g(t,e,n),b(t,t,q),x(t,t,n)}function Xe(e,t,n,r,i,a){o(G,r,n),o(K,a,i),c(q,G,K),g(Y,e.eye,t),b(Y,Y,q),e.eye=x(Y,Y,t),g(Y,e.center,t),b(Y,Y,q),e.center=x(Y,Y,t),g(Y,e.up,t),b(Y,Y,q),e.up=x(Y,Y,t)}const I={Pole:.95,Angle:t(18),Tilt:45,TiltHysteresisMargin:1e-7};let L=!1;function R(e,t,n,r,i,a){let o=Math.abs(r)>Math.PI-I.Angle||Math.abs(r)<I.Angle,s=(Math.abs(e[2])<n*I.Pole||Math.abs(t)>n)&&a;return o&&s?!L&&i<I.Tilt-I.TiltHysteresisMargin?L=!0:L&&i>I.Tilt+I.TiltHysteresisMargin&&(L=!1):L=!1,L}function Ze(e,t,n,r,i,a){if(a)se(n,r,ct),k(t,e.center,ct);else{let a=Ge(n,r,lt,t,e.radius,i);k(t,e.center,ce(lt,a))}}function Qe(e,t,n,r,i,a,o){let s=o?20:1;y(J,r),Z.copyFrom(t);let c,l;for(let r=0;r<s&&v(n,J)>1e-12&&(c=v(n,J),Je(n,J,B,z,W,Z,e,i,a,o),Xe(Z,e.center,z,W[1],B,W[0]),Ye(J,J,e.center,z,W[1],B,W[0]),l=v(n,J),l<c||r===0);r++)t.copyFrom(Z)}function $e(n,r,i,a,o,s,c){R(i,h(r.up,i),n.radius,-e.normalize(t(o)),s,r.aboveGround)?Qe(n,r,i,a,-e.normalize(t(o)),s,c):Ze(n,r,i,a,s,c)}function et(e,t,n,r,i,a){let{eye:o}=e;le([0,0,1],o,z,B,at);let s=t.translation[0]*n.pan,c=i.mode===`zoom`?0:t.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-h(e.center,z)**2/m(e.center)**2)),.5),d=(Math.sin(a)*c+Math.cos(a)*s)/u,f=-Math.cos(a)*c+Math.sin(a)*s;switch(l(r.pan.matrix,r.pan.matrix,d,z),r.pan.enabled=!0,i.mode){case`pan`:l(r.pan.matrix,r.pan.matrix,f,B),r.pan.enabled=!0;break;case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function tt(e,t,n,r,i){let{eye:a,viewRight:o}=e,s=S(E.get(),o,a),c=t.translation[0]*n.pan;switch(c!==0&&(l(r.pan.matrix,r.pan.matrix,-c,s),r.pan.enabled=!0),i.mode){case`pan`:{let e=t.translation[1]*n.pan;e!==0&&(l(r.pan.matrix,r.pan.matrix,e,o),r.pan.enabled=!0);break}case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function nt(n,r,i,a,o,s,c,l,u){R(n.center,h(n.up,n.center),m(n.center),-e.normalize(t(s)),c,r.aboveGround)?et(r,i,a,l,u,-e.normalize(t(o))):tt(r,i,a,l,u)}function rt(e,t,n=1/0){let r=Math.abs(h(e,t));return Math.min(n,1/r)}function it(e,t,n){let r=te(e,t),i=m(e);return r<Math.max(i,n)}const z=w(),B=w(),at=w(),V=w(),H=w(),U=w(),ot=w(),st=w(),W=p(),ct=ae(),G=d(),K=d(),q=d(),J=w(),Y=w(),X=w();let Z=new _e;const Q=w(),lt=w();function ut(){Z=new _e}const dt={origin:w(),direction:w()},$={origin:w(),direction:w()};export{j as TiltThresholdPanningSpeed,A as VerticalPanTresholds,He as applyPanPlanar,Ze as applyPanSphericalDirectRotation,Qe as applyPanSphericalPreserveHeading,k as applyRotation,Xe as applyRotationWithTwoAxes,Fe as applyZoomOnSphere,Pe as applyZoomToPoint,Le as centroid,ut as cleanupNavigationUtils,O as distanceComparisonTolerance,ke as excludeTerrain,rt as getTiltScaleFactor,Ve as inferNavigationMode,Me as intersectPlaneFromScreenPoint,Ne as intersectPlaneFromScreenPointAtEye,it as isHitOnSamePlanetSide,F as lengthFromPoints,we as maxPanDistanceModifier,Ee as maxRotatePivotDistanceModifier,be as maxZoomPivotDistanceModifier,Se as maxZoomStepDistanceModifier,Te as minPinchAndPanCameraHeight,De as minRotatePivotDistance,Ae as normalizeCoordinate,je as normalizeRotationDelta,ze as offSurfaceTiltToEyeTiltGlobal,Re as onSurfaceTiltToEyeTiltGlobal,nt as panMotionToRotationMatrix,$e as panToPosition,Be as pickPointAndInitSphere,I as preservingHeadingThresholds,Ye as rotatePointAroundTwoAxes,Ge as rotationAngleAndAxisDirectRotation,Je as rotationAnglesAndAxesHeadingPreserving,qe as rotationAnglesHeadingPreserving,Oe as searchAreaSize,R as shouldPreserveHeading,Ue as sphereOrPlanePointFromScreenPoint,xe as zoomPivotDistanceClamp,Ce as zoomStepDistanceClamp};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{SyncRenderPlugin as r}from"../../effects/RenderPlugin.js";import{MergedBuffer as i}from"./MergedBuffer.js";import{VaoRenderer as a}from"./VaoRenderer.js";import"../../../../../core/mathUtils.js";import"../../../../webgl/enums.js";import"../../../../../core/Logger.js";import"../../../../webgl/Util.js";import"./BufferRange.js";import"./IndexLayout.js";import"../../../../webgl/BufferObject.js";let o=class extends r{constructor(e){super(e),this._dataByBaseInstance=new Map,this._buffer=null,this._renderer=null,this.drapedPriority=0}initialize(){this._buffer=new i({material:this.material,dataByBaseInstance:this._dataByBaseInstance,highlightOrderMap:this.highlightOrderMap}),this._renderer=new a({material:this.material,dataByBaseInstance:this._dataByBaseInstance})}destroy(){this._buffer.destroy(),this._renderer.destroy()}hasHighlight(e){return this._renderer.hasHighlight(e)}initializeRenderContext(e){this._buffer.initializeRenderContext(e),this._renderer.initializeRenderContext(e)}uninitializeRenderContext(){this._buffer.uninitializeRenderContext(),this._renderer.uninitializeRenderContext()}get produces(){return this._renderer.produces}get hasOccludees(){return this._buffer.hasOccludees}get hasOnlyOccluders(){return!!(this.renderOccludedFlags&-2)}get emissions(){return this.material.emissions}get isDecoration(){return this.material.parameters.isDecoration}get renderOccludedFlags(){return this.material.renderOccludedFlags}get testsTransparentRenderOrder(){return process.env.NODE_ENV===`test`?this.material.testsTransparentRenderOrder:0}get numGeometries(){let e=0;for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())e+=n.buffers.reduce((e,t)=>e+=t.instances.size,0);return e}get usedMemory(){let e=0;for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())e+=n.buffers.reduce((e,t)=>e+=t.usedMemory,0);return e}forEachGeometry(e){for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())for(let t of n.buffers)for(let{geometry:n}of t.instances.values())e(n)}modify(e,t){this._buffer.modify(e,t),this._renderer.updateHighlights()}get canCompact(){return this._buffer.canCompact}compact(e){return this._buffer.compact(e)}updateHighlights(e){this.highlightOrderMap=e,this._buffer.updateHighlights(e),this._renderer.updateHighlights()}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){return this._renderer.acquireTechniques(e)}render(e,t){return this._renderer.render(e,t)}static prune(){i.prune()}get test(){}};e([t({constructOnly:!0})],o.prototype,`material`,void 0),e([t()],o.prototype,`highlightOrderMap`,void 0),o=e([n(`esri.views.3d.webgl-engine.materials.renderers.MergedRenderer`)],o);export{o as MergedRenderer};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{property as t,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{SyncRenderPlugin as r}from"../../effects/RenderPlugin.js";import{MergedBuffer as i}from"./MergedBuffer.js";import{VaoRenderer as a}from"./VaoRenderer.js";import"./VaoWriter.js";let o=class extends r{constructor(e){super(e),this._dataByBaseInstance=new Map,this._buffer=null,this._renderer=null,this.drapedPriority=0}initialize(){this._buffer=new i({material:this.material,dataByBaseInstance:this._dataByBaseInstance,highlightOrderMap:this.highlightOrderMap}),this._renderer=new a({material:this.material,dataByBaseInstance:this._dataByBaseInstance})}destroy(){this._buffer.destroy(),this._renderer.destroy()}hasHighlight(e){return this._renderer.hasHighlight(e)}initializeRenderContext(e){this._buffer.initializeRenderContext(e),this._renderer.initializeRenderContext(e)}uninitializeRenderContext(){this._buffer.uninitializeRenderContext(),this._renderer.uninitializeRenderContext()}get produces(){return this._renderer.produces}get hasOccludees(){return this._buffer.hasOccludees}get hasOnlyOccluders(){return!!(this.renderOccludedFlags&-2)}get emissions(){return this.material.emissions}get isDecoration(){return this.material.parameters.isDecoration}get renderOccludedFlags(){return this.material.renderOccludedFlags}get testsTransparentRenderOrder(){return process.env.NODE_ENV===`test`?this.material.testsTransparentRenderOrder:0}get numGeometries(){let e=0;for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())e+=n.buffers.reduce((e,t)=>e+=t.instances.size,0);return e}get usedMemory(){let e=0;for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())e+=n.buffers.reduce((e,t)=>e+=t.usedMemory,0);return e}forEachGeometry(e){for(let t of this._dataByBaseInstance.values())for(let n of t.dataByOrigin.values())for(let t of n.buffers)for(let{geometry:n}of t.instances.values())e(n)}modify(e,t){this._buffer.modify(e,t),this._renderer.updateHighlights()}get canCompact(){return this._buffer.canCompact}compact(e){return this._buffer.compact(e)}updateHighlights(e){this.highlightOrderMap=e,this._buffer.updateHighlights(e),this._renderer.updateHighlights()}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){return this._renderer.acquireTechniques(e)}render(e,t){return this._renderer.render(e,t)}static prune(){i.prune()}get test(){}};e([t({constructOnly:!0})],o.prototype,`material`,void 0),e([t()],o.prototype,`highlightOrderMap`,void 0),o=e([n(`esri.views.3d.webgl-engine.materials.renderers.MergedRenderer`)],o);export{o as MergedRenderer};
package/views/View.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import i from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as s}from"../core/Evented.js";import c from"../core/Handles.js";import{makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as u}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as f,abortMaybe as ee}from"../core/maybe.js";import{EsriPromise as te}from"../core/Promise.js";import{after as p}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{watch as h,sync as g,whenOnce as _,when as v,syncAndInitial as y}from"../core/reactiveUtils.js";import{property as b,subclass as x}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import{UpdatingHandles as C}from"../core/support/UpdatingHandles.js";import ne from"../geometry/Extent.js";import w from"../geometry/HeightModelInfo.js";import T from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as D}from"../support/AnalysesCollection.js";import{GraphicsCollection as O}from"../support/GraphicsCollection.js";import{system as k}from"../time/constants.js";import A from"../time/TimeExtent.js";import{isTimeZoneValid as j}from"../time/timeZoneUtils.js";import M from"./BasemapView.js";import N from"./Magnifier.js";import P from"./SelectionManager.js";import F from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{GlyphMosaic as L}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as R}from"./3d/support/DefaultHighlights.js";import z from"./input/Input.js";import{ViewEvents as B}from"./input/ViewEvents.js";import V from"./interactive/options/ViewOptions.js";import H from"./navigation/Navigation.js";import{deduplicateAttributionItems as U}from"./support/attributionUtils.js";import{DefaultsFromMap as W}from"./support/DefaultsFromMap.js";import{defaultHighlightName as G}from"./support/HighlightDefaults.js";import K from"./support/HighlightOptions.js";import q from"./support/LayerViewManager.js";import J from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Y}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Z;let Q=class extends s(te){static{Z=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new c,this.updatingHandles=new C,this.allLayerViews=new i({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new N,this.options=new V,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new z,this.navigation=new H,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new B(this),this.requiredFieldsOptions=new J,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new m,this.handles.add(h(()=>this.preconditionsReady,e=>{let t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Z.views.add(this)):(this._lockedSpatialReference=null,Z.views.remove(this)),this.notifyChange(`spatialReference`),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(e){queueMicrotask(()=>{this.fatalError=new o(`view:startup-error`,`View._startup failed`,e)});return}this._glyphMosaic=new L(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},g)),this.analyses=new D}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,_(()=>this.ready)))),this.basemapView=new M({view:this}),this.layerViewManager=new q({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>this.readyState===`map-content-error`&&!this.spatialReference,()=>{d.getLogger(this).warn(`#spatialReference`,`no spatial reference could be derived from the currently added map layers`)}),h(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},y),h(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.viewReady=e)},g),h(()=>this.defaultsFromMapInputSpatialReference(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputSpatialReference=e)},y),h(()=>this.defaultsFromMapInputHeightModelInfo(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputHeightModelInfo=e)},y)])}get _layerToLayerviewMapping(){return Z._layerToLayerview}static{this._layerToLayerview=[[`view.map.basemap.baseLayers`,`view.basemapView.baseLayerViews`],[`view.map.basemap.groundLayers`,`view.basemapView.groundLayerViews`],[`view.map.basemap.referenceLayers`,`view.basemapView.referenceLayerViews`],[`view.map.layers`,`view.layerViews`]]}destroy(){this.destroyed||(Z.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set(`navigation`,null)),this.graphics=f(this.graphics),this.analyses=f(this.analyses),this.defaultsFromMap.destroy(),this._set(`defaultsFromMap`,null),this.analysisViewManager=f(this.analysisViewManager),this.toolViewManager=f(this.toolViewManager),this.layerViewManager=f(this.layerViewManager),this.selectionManager=f(this.selectionManager),this.basemapView=f(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=f(this.map),this.updatingHandles.destroy())}_startup(){this._set(`ready`,!0)}_teardown(){this._set(`ready`,!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error(`#toMap()`,`Not implemented on this instance of View`),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get(`analyses`)}set analyses(e){this._set(`analyses`,e)}get animation(){return this._get(`animation`)}set animation(e){this._set(`animation`,e)}get focusRegion(){return null}get attributionItems(){return this.suspended?[]:U(this._get(`attributionItems`),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new W({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get(`extent`)}set extent(e){this._set(`extent`,e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get(`highlights`)??R()}set highlights(e){this._set(`highlights`,a(e,this._get(`highlights`),r.ofType(K)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===G)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;let{map:e,spatialReference:t}=this;return!!(!this.fatalError&&this._isValid&&!this._readyCycleForced&&e&&(!u(e)||e.loaded)&&this.width!==0&&this.height!==0&&t&&this._validateSpatialReference(t)&&(this._lockedSpatialReference||this.defaultsFromMap?.ready)&&this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){let t=this._get(`map`);e!==t&&(e?.destroyed&&(d.getLogger(this).warn(`#map`,`The provided map is already destroyed`,{map:e}),e=null),u(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set(`map`,e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get(`readyState`);if(!this.map)return`missing-map`;if(`container`in this&&!this.container)return`missing-container`;if(this.fatalError)return`rendering-error`;if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){let e=!(`loaded`in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?`empty-map`:(this._readyStateWaitingTask||(this._readyStateWaitingTask=n(e=>p(has(`view-readyState-waiting-delay`),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,`ready-state-task`)),this._readyStateWaitingTask?.finished?`map-content-error`:`loading`)}return this._readyStateWaitingTask=ee(this._readyStateWaitingTask),this.removeHandles(`ready-state-task`),this.ready?`ready`:`loading`}get spatialReference(){let{_userSpatialReference:e}=this;if(e&&e.vcsWkid!==null)return e;let t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,n=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return n?.equals(t)?n:t}set spatialReference(e){let t=!E(e,this._get(`spatialReference`));this._set(`_userSpatialReference`,e),t&&(this._set(`spatialReference`,e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??k}set timeZone(e){this._userTimeZone=e,j(e)||d.getLogger(this).warn(`#timeZone`,`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??`default`}acquireCursor(e,t=`low`){let n=t===`high`?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},i=l(()=>n.remove(r));return n.add(r),this.addHandles(i),i}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new F}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&`heightModelInfo`in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o(`view:importLayerView-missing`,`importLayerView() not implemented`)}hasLayerViewModule(e){return!1}async validate(){let e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn(`#validate()`,e.message),e;let t=await Y();if(t)throw d.getLogger(this).warn(`#validate()`,t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return this.getSpatialReferenceSupport(e)!=null}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn(`#when()`,`Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead.`),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){let e=document.createElement(`div`);e.setAttribute(`style`,`display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;`);let t=document.createElement(`div`);t.innerHTML=`Unable to display map. WebGL2 support is required.`,t.setAttribute(`style`,`font-size: 24px; font-weight: bold;`);let n=document.createElement(`div`);n.innerHTML=`Ensure that your browser and hardware meet the minimum requirements.`,n.setAttribute(`style`,`font-size: 18px;`);let r=document.createElement(`a`);r.innerHTML=`https://esriurl.com/webgl-faq`,r.target=`_blank`,r.setAttribute(`style`,`font-size: 18px;`),r.href=`https://esriurl.com/webgl-faq`,e.appendChild(t),e.appendChild(n),e.appendChild(r);let i=this.getSurface();i&&i.appendChild(e)}};e([b()],Q.prototype,`_userSpatialReference`,void 0),e([b()],Q.prototype,`activeTool`,null),e([b({readOnly:!0})],Q.prototype,`allLayerViews`,void 0),e([b({readOnly:!0})],Q.prototype,`layerviewCollections`,null),e([b(S(D,`analyses`))],Q.prototype,`analyses`,null),e([b()],Q.prototype,`animation`,null),e([b()],Q.prototype,`animationsEnabled`,void 0),e([b()],Q.prototype,`focusRegionVisible`,void 0),e([b()],Q.prototype,`focusRegionShortcutEnabled`,void 0),e([b()],Q.prototype,`focusRegion`,null),e([b({readOnly:!0})],Q.prototype,`attributionItems`,null),e([b()],Q.prototype,`attributionVisible`,void 0),e([b()],Q.prototype,`basemapView`,void 0),e([b()],Q.prototype,`center`,null),e([b()],Q.prototype,`defaultsFromMapSettings`,null),e([b()],Q.prototype,`defaultsFromMap`,null),e([b()],Q.prototype,`dependencies`,void 0),e([b()],Q.prototype,`displayFilterEnabled`,void 0),e([b({type:ne})],Q.prototype,`extent`,null),e([b()],Q.prototype,`fatalError`,void 0),e([b(S(O,`graphics`))],Q.prototype,`graphics`,void 0),e([b({readOnly:!0,type:w})],Q.prototype,`heightModelInfo`,null),e([b({type:r.ofType(K)})],Q.prototype,`highlights`,null),e([b({readOnly:!0})],Q.prototype,`interacting`,null),e([b({constructOnly:!0})],Q.prototype,`layerViewFilter`,void 0),e([b({readOnly:!0})],Q.prototype,`navigating`,null),e([b({readOnly:!0})],Q.prototype,`preconditionsReady`,null),e([b({readOnly:!0})],Q.prototype,`typeSpecificPreconditionsReady`,void 0),e([b({type:r,readOnly:!0})],Q.prototype,`layerViews`,void 0),e([b()],Q.prototype,`resolution`,null),e([b({type:N})],Q.prototype,`magnifier`,void 0),e([b({nonNullable:!0,type:V})],Q.prototype,`options`,void 0),e([b({value:null,type:t})],Q.prototype,`map`,null),e([b()],Q.prototype,`padding`,void 0),e([b({readOnly:!0})],Q.prototype,`ready`,void 0),e([b({readOnly:!0})],Q.prototype,`canZoomIn`,null),e([b({readOnly:!0})],Q.prototype,`canZoomOut`,null),e([b()],Q.prototype,`_readyStateWaitingTask`,void 0),e([b({readOnly:!0})],Q.prototype,`readyState`,null),e([b({type:T})],Q.prototype,`spatialReference`,null),e([b()],Q.prototype,`stationary`,null),e([b({type:A})],Q.prototype,`timeExtent`,null),e([b({type:String,nonNullable:!0})],Q.prototype,`timeZone`,null),e([b()],Q.prototype,`tools`,null),e([b()],Q.prototype,`toolViewManager`,void 0),e([b({readOnly:!0})],Q.prototype,`type`,void 0),e([b({type:Number})],Q.prototype,`scale`,void 0),e([b({readOnly:!0})],Q.prototype,`updating`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtentRequired`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtent`,null),e([b()],Q.prototype,`cursor`,null),e([b({readOnly:!0})],Q.prototype,`input`,void 0),e([b({type:H,nonNullable:!0})],Q.prototype,`navigation`,void 0),e([b()],Q.prototype,`layerViewManager`,void 0),e([b()],Q.prototype,`analysisViewManager`,void 0),e([b()],Q.prototype,`selectionManager`,void 0),e([b()],Q.prototype,`width`,void 0),e([b()],Q.prototype,`height`,void 0),e([b({readOnly:!0})],Q.prototype,`resizing`,void 0),e([b({value:null,readOnly:!0})],Q.prototype,`size`,null),e([b({readOnly:!0})],Q.prototype,`suspended`,void 0),e([b({readOnly:!0})],Q.prototype,`viewEvents`,void 0),e([b()],Q.prototype,`_isValid`,void 0),e([b()],Q.prototype,`_readyCycleForced`,void 0),e([b()],Q.prototype,`_lockedSpatialReference`,void 0),e([b()],Q.prototype,`_userTimeZone`,void 0),e([b()],Q.prototype,`_lockedTimeZone`,void 0),e([b()],Q.prototype,`_userTimeExtent`,void 0),e([b()],Q.prototype,`_lockedTimeExtent`,void 0),e([b({type:F})],Q.prototype,`theme`,void 0),e([b({readOnly:!0,type:F})],Q.prototype,`effectiveTheme`,null),e([b({readOnly:!0})],Q.prototype,`registeredComponents`,void 0),Q=Z=e([x(`esri.views.View`)],Q);const $=globalThis.$arcgis;$&&!$.views&&Object.defineProperty($,"views",{configurable:!1,enumerable:!0,writable:!1,value:Q.views});function re(e){return e.layerViews}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import i from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as s}from"../core/Evented.js";import c from"../core/Handles.js";import{makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as u}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as f,abortMaybe as ee}from"../core/maybe.js";import{EsriPromise as te}from"../core/Promise.js";import{after as p}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{watch as h,sync as g,whenOnce as _,when as v,syncAndInitial as y}from"../core/reactiveUtils.js";import{property as b,subclass as x}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import{UpdatingHandles as C}from"../core/support/UpdatingHandles.js";import ne from"../geometry/Extent.js";import w from"../geometry/HeightModelInfo.js";import T from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as D}from"../support/AnalysesCollection.js";import{GraphicsCollection as O}from"../support/GraphicsCollection.js";import{system as k}from"../time/constants.js";import A from"../time/TimeExtent.js";import{isTimeZoneValid as j}from"../time/timeZoneUtils.js";import M from"./BasemapView.js";import N from"./Magnifier.js";import P from"./SelectionManager.js";import F from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{GlyphMosaic as L}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as R}from"./3d/support/DefaultHighlights.js";import z from"./input/Input.js";import{ViewEvents as B}from"./input/ViewEvents.js";import V from"./interactive/options/ViewOptions.js";import H from"./navigation/Navigation.js";import{deduplicateAttributionItems as U}from"./support/attributionUtils.js";import{DefaultsFromMap as W}from"./support/DefaultsFromMap.js";import{defaultHighlightName as G}from"./support/HighlightDefaults.js";import K from"./support/HighlightOptions.js";import q from"./support/LayerViewManager.js";import J from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Y}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Z;let Q=class extends s(te){static{Z=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new c,this.updatingHandles=new C,this.allLayerViews=new i({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new N,this.options=new V,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new z,this.navigation=new H,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new B(this),this.requiredFieldsOptions=new J,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new m,this.handles.add(h(()=>this.preconditionsReady,e=>{let t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Z.views.add(this)):(this._lockedSpatialReference=null,Z.views.remove(this)),this.notifyChange(`spatialReference`),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(e){queueMicrotask(()=>{this.fatalError=new o(`view:startup-error`,`View._startup failed`,e)});return}this._glyphMosaic=new L(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},g)),this.analyses=new D}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,_(()=>this.ready)))),this.basemapView=new M({view:this}),this.layerViewManager=new q({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>this.readyState===`map-content-error`&&!this.spatialReference,()=>{d.getLogger(this).warn(`#spatialReference`,`no spatial reference could be derived from the currently added map layers`)}),h(()=>[this.defaultsFromMap,this.initialExtentRequired],([e,t])=>{e&&(e.required={...e.required,extent:t})},y),h(()=>[this.defaultsFromMap,this.ready],([e,t])=>{e&&(e.viewReady=t)},g),h(()=>[this.defaultsFromMap,this.defaultsFromMapInputSpatialReference()],([e,t])=>{e&&(e.inputSpatialReference=t)},y),h(()=>[this.defaultsFromMap,this.defaultsFromMapInputHeightModelInfo()],([e,t])=>{e&&(e.inputHeightModelInfo=t)},y)])}get _layerToLayerviewMapping(){return Z._layerToLayerview}static{this._layerToLayerview=[[`view.map.basemap.baseLayers`,`view.basemapView.baseLayerViews`],[`view.map.basemap.groundLayers`,`view.basemapView.groundLayerViews`],[`view.map.basemap.referenceLayers`,`view.basemapView.referenceLayerViews`],[`view.map.layers`,`view.layerViews`]]}destroy(){this.destroyed||(Z.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set(`navigation`,null)),this.graphics=f(this.graphics),this.analyses=f(this.analyses),this.defaultsFromMap.destroy(),this._set(`defaultsFromMap`,null),this.analysisViewManager=f(this.analysisViewManager),this.toolViewManager=f(this.toolViewManager),this.layerViewManager=f(this.layerViewManager),this.selectionManager=f(this.selectionManager),this.basemapView=f(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=f(this.map),this.updatingHandles.destroy())}_startup(){this._set(`ready`,!0)}_teardown(){this._set(`ready`,!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error(`#toMap()`,`Not implemented on this instance of View`),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get(`analyses`)}set analyses(e){this._set(`analyses`,e)}get animation(){return this._get(`animation`)}set animation(e){this._set(`animation`,e)}get focusRegion(){return null}get attributionItems(){return this.suspended?[]:U(this._get(`attributionItems`),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new W({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get(`extent`)}set extent(e){this._set(`extent`,e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get(`highlights`)??R()}set highlights(e){this._set(`highlights`,a(e,this._get(`highlights`),r.ofType(K)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===G)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;let{map:e,spatialReference:t}=this;return!!(!this.fatalError&&this._isValid&&!this._readyCycleForced&&e&&(!u(e)||e.loaded)&&this.width!==0&&this.height!==0&&t&&this._validateSpatialReference(t)&&(this._lockedSpatialReference||this.defaultsFromMap?.ready)&&this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){let t=this._get(`map`);e!==t&&(e?.destroyed&&(d.getLogger(this).warn(`#map`,`The provided map is already destroyed`,{map:e}),e=null),u(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set(`map`,e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get(`readyState`);if(!this.map)return`missing-map`;if(`container`in this&&!this.container)return`missing-container`;if(this.fatalError)return`rendering-error`;if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){let e=!(`loaded`in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?`empty-map`:(this._readyStateWaitingTask||(this._readyStateWaitingTask=n(e=>p(has(`view-readyState-waiting-delay`),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,`ready-state-task`)),this._readyStateWaitingTask?.finished?`map-content-error`:`loading`)}return this._readyStateWaitingTask=ee(this._readyStateWaitingTask),this.removeHandles(`ready-state-task`),this.ready?`ready`:`loading`}get spatialReference(){let{_userSpatialReference:e}=this;if(e&&e.vcsWkid!==null)return e;let t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,n=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return n?.equals(t)?n:t}set spatialReference(e){let t=!E(e,this._get(`spatialReference`));this._set(`_userSpatialReference`,e),t&&(this._set(`spatialReference`,e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??k}set timeZone(e){this._userTimeZone=e,j(e)||d.getLogger(this).warn(`#timeZone`,`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??`default`}acquireCursor(e,t=`low`){let n=t===`high`?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},i=l(()=>n.remove(r));return n.add(r),this.addHandles(i),i}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new F}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&`heightModelInfo`in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o(`view:importLayerView-missing`,`importLayerView() not implemented`)}hasLayerViewModule(e){return!1}async validate(){let e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn(`#validate()`,e.message),e;let t=await Y();if(t)throw d.getLogger(this).warn(`#validate()`,t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return this.getSpatialReferenceSupport(e)!=null}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn(`#when()`,`Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead.`),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){let e=document.createElement(`div`);e.setAttribute(`style`,`display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;`);let t=document.createElement(`div`);t.innerHTML=`Unable to display map. WebGL2 support is required.`,t.setAttribute(`style`,`font-size: 24px; font-weight: bold;`);let n=document.createElement(`div`);n.innerHTML=`Ensure that your browser and hardware meet the minimum requirements.`,n.setAttribute(`style`,`font-size: 18px;`);let r=document.createElement(`a`);r.innerHTML=`https://esriurl.com/webgl-faq`,r.target=`_blank`,r.setAttribute(`style`,`font-size: 18px;`),r.href=`https://esriurl.com/webgl-faq`,e.appendChild(t),e.appendChild(n),e.appendChild(r);let i=this.getSurface();i&&i.appendChild(e)}};e([b()],Q.prototype,`_userSpatialReference`,void 0),e([b()],Q.prototype,`activeTool`,null),e([b({readOnly:!0})],Q.prototype,`allLayerViews`,void 0),e([b({readOnly:!0})],Q.prototype,`layerviewCollections`,null),e([b(S(D,`analyses`))],Q.prototype,`analyses`,null),e([b()],Q.prototype,`animation`,null),e([b()],Q.prototype,`animationsEnabled`,void 0),e([b()],Q.prototype,`focusRegionVisible`,void 0),e([b()],Q.prototype,`focusRegionShortcutEnabled`,void 0),e([b()],Q.prototype,`focusRegion`,null),e([b({readOnly:!0})],Q.prototype,`attributionItems`,null),e([b()],Q.prototype,`attributionVisible`,void 0),e([b()],Q.prototype,`basemapView`,void 0),e([b()],Q.prototype,`center`,null),e([b()],Q.prototype,`defaultsFromMapSettings`,null),e([b()],Q.prototype,`defaultsFromMap`,null),e([b()],Q.prototype,`dependencies`,void 0),e([b()],Q.prototype,`displayFilterEnabled`,void 0),e([b({type:ne})],Q.prototype,`extent`,null),e([b()],Q.prototype,`fatalError`,void 0),e([b(S(O,`graphics`))],Q.prototype,`graphics`,void 0),e([b({readOnly:!0,type:w})],Q.prototype,`heightModelInfo`,null),e([b({type:r.ofType(K)})],Q.prototype,`highlights`,null),e([b({readOnly:!0})],Q.prototype,`interacting`,null),e([b({constructOnly:!0})],Q.prototype,`layerViewFilter`,void 0),e([b({readOnly:!0})],Q.prototype,`navigating`,null),e([b({readOnly:!0})],Q.prototype,`preconditionsReady`,null),e([b({readOnly:!0})],Q.prototype,`typeSpecificPreconditionsReady`,void 0),e([b({type:r,readOnly:!0})],Q.prototype,`layerViews`,void 0),e([b()],Q.prototype,`resolution`,null),e([b({type:N})],Q.prototype,`magnifier`,void 0),e([b({nonNullable:!0,type:V})],Q.prototype,`options`,void 0),e([b({value:null,type:t})],Q.prototype,`map`,null),e([b()],Q.prototype,`padding`,void 0),e([b({readOnly:!0})],Q.prototype,`ready`,void 0),e([b({readOnly:!0})],Q.prototype,`canZoomIn`,null),e([b({readOnly:!0})],Q.prototype,`canZoomOut`,null),e([b()],Q.prototype,`_readyStateWaitingTask`,void 0),e([b({readOnly:!0})],Q.prototype,`readyState`,null),e([b({type:T})],Q.prototype,`spatialReference`,null),e([b()],Q.prototype,`stationary`,null),e([b({type:A})],Q.prototype,`timeExtent`,null),e([b({type:String,nonNullable:!0})],Q.prototype,`timeZone`,null),e([b()],Q.prototype,`tools`,null),e([b()],Q.prototype,`toolViewManager`,void 0),e([b({readOnly:!0})],Q.prototype,`type`,void 0),e([b({type:Number})],Q.prototype,`scale`,void 0),e([b({readOnly:!0})],Q.prototype,`updating`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtentRequired`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtent`,null),e([b()],Q.prototype,`cursor`,null),e([b({readOnly:!0})],Q.prototype,`input`,void 0),e([b({type:H,nonNullable:!0})],Q.prototype,`navigation`,void 0),e([b()],Q.prototype,`layerViewManager`,void 0),e([b()],Q.prototype,`analysisViewManager`,void 0),e([b()],Q.prototype,`selectionManager`,void 0),e([b()],Q.prototype,`width`,void 0),e([b()],Q.prototype,`height`,void 0),e([b({readOnly:!0})],Q.prototype,`resizing`,void 0),e([b({value:null,readOnly:!0})],Q.prototype,`size`,null),e([b({readOnly:!0})],Q.prototype,`suspended`,void 0),e([b({readOnly:!0})],Q.prototype,`viewEvents`,void 0),e([b()],Q.prototype,`_isValid`,void 0),e([b()],Q.prototype,`_readyCycleForced`,void 0),e([b()],Q.prototype,`_lockedSpatialReference`,void 0),e([b()],Q.prototype,`_userTimeZone`,void 0),e([b()],Q.prototype,`_lockedTimeZone`,void 0),e([b()],Q.prototype,`_userTimeExtent`,void 0),e([b()],Q.prototype,`_lockedTimeExtent`,void 0),e([b({type:F})],Q.prototype,`theme`,void 0),e([b({readOnly:!0,type:F})],Q.prototype,`effectiveTheme`,null),e([b({readOnly:!0})],Q.prototype,`registeredComponents`,void 0),Q=Z=e([x(`esri.views.View`)],Q);const $=globalThis.$arcgis;$&&!$.views&&Object.defineProperty($,"views",{configurable:!1,enumerable:!0,writable:!1,value:Q.views});function re(e){return e.layerViews}export{Q as default};