@arcgis/core 4.33.0-next.20250424 → 4.33.0-next.20250426

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 (183) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.js +1 -1
  4. package/analysis/support/AnalysisOriginWebScene.d.ts +1 -1
  5. package/analysis/support/AnalysisOriginWebScene.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
  8. package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
  9. package/assets/esri/core/workers/chunks/{5958af341014e13475d2.js → 2bed8a5ed9ae3760fa2f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{7ffa68d69c138db1295d.js → 2e3019ce49e972a815ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{d696abbb1b13ac1a689b.js → 345993291540433d3d92.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{db5913824d5e5a2a8365.js → 360c8cff7c3b25d2b2d2.js} +1 -1
  13. package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
  14. package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
  15. package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
  16. package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
  17. package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
  18. package/assets/esri/core/workers/chunks/73f9c3a74a815baa239c.js +1 -0
  19. package/assets/esri/core/workers/chunks/76575d2c1c56e37c1315.js +319 -0
  20. package/assets/esri/core/workers/chunks/{f2cef954b58c6604642c.js → 87dcfbbcf290e0fa5c0f.js} +160 -167
  21. package/assets/esri/core/workers/chunks/91acd69dcf7dac109017.js +1 -0
  22. package/assets/esri/core/workers/chunks/{265f69d153b7b6f07e42.js → 92836e3a2c5226296fec.js} +1 -1
  23. package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
  24. package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
  25. package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
  26. package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
  27. package/assets/esri/core/workers/chunks/{75a04b073231da70c18d.js → d44e99b4bb1cec6a922b.js} +1 -1
  28. package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
  29. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  30. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  31. package/assets/esri/themes/base/_core.scss +2 -0
  32. package/assets/esri/themes/base/widgets/_Legend.scss +64 -0
  33. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +77 -0
  34. package/assets/esri/themes/dark/main.css +1 -1
  35. package/assets/esri/themes/light/main.css +1 -1
  36. package/assets/esri/themes/light/view.css +1 -1
  37. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  38. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  39. package/chunks/ShadowCastAccumulate.glsl.js +13 -9
  40. package/chunks/ShadowCastVisualize.glsl.js +24 -9
  41. package/chunks/boundedPlane.js +1 -1
  42. package/chunks/lyr3DMain.js +1 -1
  43. package/chunks/lyr3DWorker.js +1 -1
  44. package/geometry/support/boundedPlane.js +1 -1
  45. package/interfaces.d.ts +528 -70
  46. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  47. package/layers/KnowledgeGraphLayer.js +1 -1
  48. package/layers/LinkChartLayer.js +1 -1
  49. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  50. package/layers/ParquetLayer.js +1 -1
  51. package/layers/mixins/ImageryTileMixin.js +1 -1
  52. package/layers/ogc/wfsUtils.js +1 -1
  53. package/layers/orientedImagery/transformations/utils.js +1 -1
  54. package/layers/support/ParquetEncodingLocation.d.ts +4 -0
  55. package/layers/support/ParquetEncodingLocation.js +1 -1
  56. package/layers/support/ParquetEncodingWkb.d.ts +4 -0
  57. package/layers/support/ParquetEncodingWkb.js +1 -1
  58. package/layers/support/RasterStorageInfo.js +1 -1
  59. package/layers/support/layerUtils.js +1 -1
  60. package/layers/support/parquetUtils.d.ts +3 -0
  61. package/layers/support/parquetUtils.js +1 -1
  62. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  63. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  64. package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
  65. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  66. package/package.json +2 -2
  67. package/portal/schemas/definitions.js +1 -1
  68. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  69. package/smartMapping/renderers/size.js +1 -1
  70. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  71. package/support/revision.js +1 -1
  72. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  73. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  74. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  75. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  76. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  77. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  78. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  79. package/views/3d/analysis/Slice/SliceController.js +1 -1
  80. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  81. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  82. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  83. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  84. package/views/3d/layers/Lyr3DWorker.js +1 -1
  85. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  86. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  87. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  88. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  89. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  90. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  91. package/views/3d/layers/graphics/pipeline/FeatureProcessingContext.js +5 -0
  92. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  93. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  94. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  95. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  96. package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
  97. package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
  98. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  99. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  100. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  101. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  102. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  103. package/views/3d/support/ViewSlice.js +5 -0
  104. package/views/3d/webgl/ManagedFBO.js +1 -1
  105. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  106. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +7 -13
  107. package/views/3d/webgl-engine/core/shaderLibrary/shading/AnalyticalSkyModel.glsl.js +3 -6
  108. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +15 -15
  109. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +0 -9
  110. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
  111. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  112. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  113. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  114. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  115. package/views/3d/webgl-engine/shaders/BlackLevelLightSoftCompression.glsl.js +10 -0
  116. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  117. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  118. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
  119. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  120. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  121. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  122. package/views/PopupView.js +1 -1
  123. package/views/SceneView.js +1 -1
  124. package/views/SelectionManager.js +1 -1
  125. package/views/analysis/analysisViewUtils.js +1 -1
  126. package/views/input/InputManager.js +1 -1
  127. package/views/input/ViewEvents.js +1 -1
  128. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  129. package/views/support/selectionUtils.js +1 -1
  130. package/webscene/support/analysisUtils.js +1 -1
  131. package/webscene/types.d.ts +5 -0
  132. package/webscene/types.js +5 -0
  133. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  134. package/widgets/Editor/UpdateWorkflow.js +1 -1
  135. package/widgets/Editor/workflowUtils.js +1 -1
  136. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  137. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  138. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  139. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  140. package/widgets/FeatureTable.js +1 -1
  141. package/widgets/Legend/styles/card/SizeRamp.js +1 -1
  142. package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
  143. package/widgets/Legend/styles/support/sizeRampUtils.js +5 -0
  144. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  145. package/widgets/Legend/styles/support/utils.js +1 -1
  146. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  147. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  148. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  149. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  150. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  151. package/widgets/OrientedImageryViewer/components/NavigationNode.js +5 -0
  152. package/widgets/OrientedImageryViewer/components/NavigationUI.js +5 -0
  153. package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +5 -0
  154. package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +5 -0
  155. package/widgets/OrientedImageryViewer/css.js +1 -1
  156. package/widgets/OrientedImageryViewer/utils.js +1 -1
  157. package/widgets/OrientedImageryViewer.js +1 -1
  158. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  159. package/widgets/ShadowCast/DiscreteOptions.d.ts +4 -0
  160. package/widgets/ShadowCast/DiscreteOptions.js +1 -1
  161. package/widgets/ShadowCast/DurationOptions.d.ts +4 -0
  162. package/widgets/ShadowCast/DurationOptions.js +1 -1
  163. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  164. package/widgets/ShadowCast/ThresholdOptions.d.ts +4 -0
  165. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  166. package/widgets/Sketch/SketchViewModel.js +1 -1
  167. package/widgets/TimeZoneLabel.js +1 -1
  168. package/widgets/VideoPlayer.js +1 -1
  169. package/widgets/support/AnalysisViewModel.js +1 -1
  170. package/assets/esri/core/workers/chunks/0a48b9734ab4c64a6f4f.js +0 -1
  171. package/assets/esri/core/workers/chunks/1427e7953c3d8c87c5e8.js +0 -1
  172. package/assets/esri/core/workers/chunks/146b3699a9e8b1f2dcc2.js +0 -1
  173. package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
  174. package/assets/esri/core/workers/chunks/7c7ff11246479382974c.js +0 -1
  175. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
  176. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +0 -1
  177. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
  178. package/assets/esri/core/workers/chunks/9f416cc5673665f8c37c.js +0 -1
  179. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
  180. package/assets/esri/core/workers/chunks/bd0dbad694ce5531deab.js +0 -1
  181. package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
  182. package/assets/esri/core/workers/chunks/d8474dca270b25705699.js +0 -1
  183. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../analysis/SlicePlane.js";import a from"../../../../core/Accessor.js";import t from"../../../../core/Logger.js";import{watch as l}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as r}from"../../../../chunks/boundedPlane.js";import o from"../../../../layers/Layer.js";import c from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isIBuildingSceneLayerView3D as h,projectAndElevationAlignShape as u,projectedShapeToPlane as d,planeToShape as p}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as y}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as w}from"../../terrain/isTerrainSurfaceLayer.js";let v=class extends a{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",(e=>{const i=e.item;null!=i&&(i instanceof o||i instanceof c)?i instanceof o&&w(i)?(t.getLogger(this).error("excludedLayers",`Layer '${i.title}, id:${i.id}' of type '${i.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(i)&&e.preventDefault():(t.getLogger(this).error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())}))),V(this.view,this),this.addHandles([l((()=>this.analysisViewData.plane),(()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()}),{sync:!0}),l((()=>this.analysis.excludeGroundSurface),(()=>this._updateLayerViews()),{sync:!0}),this.analysis.excludedLayers.on("change",(()=>this._updateLayerViews())),l((()=>[this.analysisViewData.active,this.analysisViewData.visible]),(()=>{this._updateActiveController(),this._updateViewSlicePlane()}),{sync:!0}),l((()=>this._allLayerAndSubLayerViews),(()=>this._updateLayerViews()))]),this.addHandles([l((()=>this.analysis.shape),(()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())}),{sync:!0})],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slicePlane=null,this._updateActiveController(),this._updateViewSlicePlane()),L(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(h).flatMap((({sublayerViews:e})=>e.items)))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,i=this._currentSlicePlane;if(null==i&&null==e||null!=i&&null!=e&&e.equals(i))return;let a=null,l=null;if(null!=e?.position){const i=e.position.spatialReference,s=u(e,this.view);null==s&&y(this.analysis,i,t.getLogger(this)),a=d(s,this.view,{tiltEnabled:this.analysis.tiltEnabled},r()),null!=a&&(l={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=l,this._internalChange=!0,this.analysisViewData.plane=a,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,a=p(e,this.view,this.view.spatialReference,new i);let t=null;null!=a&&(t={heading:a.heading,tilt:a.tilt,position:a.position,width:a.width,height:a.height}),this._currentSlicePlane=t,this._internalChange=!0,this.analysis.shape=a,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(m)return;const e=_(this.view);if(!e)return;if(this.analysisViewData.active)null!=e.activeController&&e.activeController!==this?(m=!0,e.activeController.analysisViewData.active=!1,m=!1):null!=e.activeController&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(null!=e.activeController&&e.activeController!==this)return;null!=e.activeController&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){g(this.view)}_updateLayerViews(){const e=null!=this.analysisViewData.plane&&this.analysisViewData.visible&&this.analysisViewData.active,i=[],a=e=>{"layers"in e?e.layers.forEach(a):i.push(e)};this.analysis.excludedLayers.forEach(a),this.view.allLayerViews.forEach((a=>{a.destroyed||("slicePlaneEnabled"in a&&(a.slicePlaneEnabled=e&&!i.includes(a.layer)),"sublayerViews"in a&&a.sublayerViews.forEach((a=>{a.slicePlaneEnabled=e&&!i.includes(a.sublayer)})))})),null!=this.view.basemapTerrain&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([s()],v.prototype,"view",void 0),e([s()],v.prototype,"analysis",void 0),e([s()],v.prototype,"analysisViewData",void 0),e([s()],v.prototype,"_allLayerAndSubLayerViews",null),v=e([n("esri.views.3d.analysis.Slice.SliceController")],v);const f=new Map;let m=!1;function g(e){const i=_(e),a=i?.activeController;null!=a?.analysisViewData.plane&&a.analysisViewData.visible?e.slicePlane=a.analysisViewData.plane:e.slicePlane=null}function V(e,i){f.has(e)||f.set(e,{all:[],activeController:null}),f.get(e)?.all.push(i)}function _(e){return f.get(e)}function L(e,i){if(!f.has(e))throw new Error("view expected in global slice register");const a=f.get(e),t=a?.all.lastIndexOf(i)??-1;if(!a||-1===t)throw new Error("controller expected in global slice register");a.all.splice(t,1),0===a.all.length&&f.delete(e)}export{v as SliceController};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Accessor.js";import a from"../../../../core/Logger.js";import{watch as l,sync as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as o}from"../../../../chunks/boundedPlane.js";import c from"../../../../layers/Layer.js";import h from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isIBuildingSceneLayerView3D as u,projectAndElevationAlignShape as d,projectedShapeToPlane as p,planeToShape as y}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as w}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as v}from"../../terrain/isTerrainSurfaceLayer.js";let f=class extends t{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",(e=>{const i=e.item;null!=i&&(i instanceof c||i instanceof h)?i instanceof c&&v(i)?(a.getLogger(this).error("excludedLayers",`Layer '${i.title}, id:${i.id}' of type '${i.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(i)&&e.preventDefault():(a.getLogger(this).error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())}))),S(this.view,this),this.addHandles([l((()=>this.analysisViewData.plane),(()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()}),s),l((()=>this.analysis.excludeGroundSurface),(()=>this._updateLayerViews()),s),this.analysis.excludedLayers.on("change",(()=>this._updateLayerViews())),l((()=>[this.analysisViewData.active,this.analysisViewData.visible]),(()=>{this._updateActiveController(),this._updateViewSlicePlane()}),s),l((()=>this._allLayerAndSubLayerViews),(()=>this._updateLayerViews()))]),this.addHandles([l((()=>this.analysis.shape),(()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())}),s),l((()=>"web-scene"!==this.analysis.origin?.type),(()=>this._updateViewSlicePlaneDecoration()),s)],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),L(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(u).flatMap((({sublayerViews:e})=>e.items)))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,i=this._currentSlicePlane;if(null==i&&null==e||null!=i&&null!=e&&e.equals(i))return;let t=null,l=null;if(null!=e?.position){const i=e.position.spatialReference,s=d(e,this.view);null==s&&w(this.analysis,i,a.getLogger(this)),t=p(s,this.view,{tiltEnabled:this.analysis.tiltEnabled},o()),null!=t&&(l={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=l,this._internalChange=!0,this.analysisViewData.plane=t,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,t=y(e,this.view,this.view.spatialReference,new i);let a=null;null!=t&&(a={heading:t.heading,tilt:t.tilt,position:t.position,width:t.width,height:t.height}),this._currentSlicePlane=a,this._internalChange=!0,this.analysis.shape=t,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(g)return;const e=b(this.view);if(!e)return;if(this.analysisViewData.active)null!=e.activeController&&e.activeController!==this?(g=!0,e.activeController.analysisViewData.active=!1,g=!1):null!=e.activeController&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(null!=e.activeController&&e.activeController!==this)return;null!=e.activeController&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){V(this.view)}_updateViewSlicePlaneDecoration(){_(this.view)}_updateLayerViews(){const e=null!=this.analysisViewData.plane&&this.analysisViewData.visible&&this.analysisViewData.active,i=[],t=e=>{"layers"in e?e.layers.forEach(t):i.push(e)};this.analysis.excludedLayers.forEach(t),this.view.allLayerViews.forEach((t=>{t.destroyed||("slicePlaneEnabled"in t&&(t.slicePlaneEnabled=e&&!i.includes(t.layer)),"sublayerViews"in t&&t.sublayerViews.forEach((t=>{t.slicePlaneEnabled=e&&!i.includes(t.sublayer)})))})),null!=this.view.basemapTerrain&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([n()],f.prototype,"view",void 0),e([n()],f.prototype,"analysis",void 0),e([n()],f.prototype,"analysisViewData",void 0),e([n()],f.prototype,"_allLayerAndSubLayerViews",null),f=e([r("esri.views.3d.analysis.Slice.SliceController")],f);const m=new Map;let g=!1;function V(e){const i=b(e),t=i?.activeController;null!=t?.analysisViewData.plane&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function _(e){const i=b(e),t=i?.activeController;e.slice.isDecoration="web-scene"!==t?.analysis.origin?.type}function S(e,i){m.has(e)||m.set(e,{all:[],activeController:null}),m.get(e)?.all.push(i)}function b(e){return m.get(e)}function L(e,i){if(!m.has(e))throw new Error("view expected in global slice register");const t=m.get(e),a=t?.all.lastIndexOf(i)??-1;if(!t||-1===a)throw new Error("controller expected in global slice register");t.all.splice(a,1),0===t.all.length&&m.delete(e)}export{f as SliceController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../../core/scheduling.js";import{createScreenPoint as h,screenPointObjectToArray as p}from"../../../../core/screenUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as d,fromScaling as _,multiply as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{f as P,l as y,c as m,h as w,g,t as f,n as M,i as D}from"../../../../chunks/vec32.js";import{clone as V,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{d as k,a as S,n as x,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as C,intersectRay as R,getNormal as O}from"../../../../geometry/support/plane.js";import{create as I}from"../../../../geometry/support/ray.js";import{sv3d as z,sm4d as G,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as A}from"../images/Factory.js";import{ResizeManipulator as K}from"./ResizeManipulator.js";import{RotateManipulator as B}from"./RotateManipulator.js";import{getOutlineColor as F,planeColor as N}from"./settings.js";import{ShiftManipulator as q,OffsetMode as Z}from"./ShiftManipulator.js";import{pointerMoveTimerMs as W,planePreviewOutlineWidth as J,forceVerticalModifier as Q,forceHorizontalModifier as X,previewFadeDotThreshold as Y,previewFadeDurationSeconds as $,initialDepthOffsetFrac as tt}from"./sliceToolConfig.js";import{createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as wt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as gt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as ft}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Mt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=class extends gt{static{Vt=this}constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=W,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=h(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&S(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new q(this.view,Z.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new B(this.view,((t,e)=>U(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new B(this.view,((t,e)=>A(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new K(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=J,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r));const o=n((()=>this.state),(t=>{"sliced"===t&&(this.finishToolCreation(),this.stop())}),l);this.addHandles([o,n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}static{this.disableEngineLayers=!1}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}stop(){this.active&&(this.view.activeTool=null)}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.stop())}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!kt(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!kt(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!kt(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),S(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=k();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=wt(this.view.state.camera,i,xt);this.inputState=Et(e,t.pointerId,a.origin,a)}return S(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===Q||t.key===X)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==Q&&t.key!==X||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=wt(this.view.state.camera,t.screenPoint,xt);S(this.analysisViewData.plane,this._startPlane),this.inputState=Et(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(x(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=m(z.get(),this._startPlane.origin),i=m(z.get(),x(this._startPlane));w(i,i,-t.depth),g(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=wt(this.view.state.camera,t.screenPoint,xt),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=wt(this.view.state.camera,t.screenPoint,xt),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=d(G.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=f(z.get(),this._startPlane.basis1,e),a=f(z.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,k());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=wt(this.view.state.camera,t.screenPoint,xt),a=z.get();R(this.analysisViewData.plane.plane,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:V(a)})}_createResizeDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=S(this.analysisViewData.plane,k());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,S(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:k();if(i=null!=i?S(i,St):null,this._pickPlane(t,!0,e,a)){const t=Y;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(M(z.get(),i.basis1),M(z.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=o({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=p(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=z.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(z.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&w(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*tt,p=w(z.get(),r,h);g(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[Q]?ot.VERTICAL:i[X]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(z.get(),y(t.basis1),y(t.basis2),1),s=_(G.get(),a),n=v(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=F(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=T(N);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=E}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};t([u()],bt.prototype,"_clock",void 0),t([u({constructOnly:!0})],bt.prototype,"view",void 0),t([u()],bt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],bt.prototype,"state",null),t([u({readOnly:!0})],bt.prototype,"cursor",null),t([u()],bt.prototype,"analysis",null),t([u()],bt.prototype,"removeIncompleteOnCancel",void 0),t([u()],bt.prototype,"_layersMode",void 0),t([u()],bt.prototype,"layersMode",null),t([u({value:null})],bt.prototype,"inputState",null),t([u()],bt.prototype,"_isPlacingSlicePlane",null),t([u()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([c("esri.views.3d.analysis.Slice.SliceTool")],bt);const Tt=bt;function Et(t,e,i,a){const s=Pt(i,x(a),t.direction,C()),n=b();return R(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function kt(t){return"mouse"!==t.pointerType||0===t.button}const St=k(),xt=I();export{Tt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,when as r,sync as l,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{createScreenPoint as p,screenPointObjectToArray as u}from"../../../../core/screenUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as _,fromScaling as v,multiply as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{f as y,l as m,c as w,h as g,g as f,t as M,n as D,i as V}from"../../../../chunks/vec32.js";import{clone as b,create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as E,ZEROS as k}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{d as S,a as x,n as j,f as H}from"../../../../chunks/boundedPlane.js";import{signedDistance as C,create as R,intersectRay as O,getNormal as I}from"../../../../geometry/support/plane.js";import{create as z}from"../../../../geometry/support/ray.js";import{sv3d as G,sm4d as L,sv2d as U}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as A,getTiltRotateTexture as K}from"../images/Factory.js";import{ResizeManipulator as B}from"./ResizeManipulator.js";import{RotateManipulator as F}from"./RotateManipulator.js";import{getOutlineColor as N,planeColor as q}from"./settings.js";import{ShiftManipulator as Z,OffsetMode as W}from"./ShiftManipulator.js";import{pointerMoveTimerMs as J,planePreviewOutlineWidth as Q,forceVerticalModifier as X,forceHorizontalModifier as Y,previewFadeDotThreshold as $,previewFadeDurationSeconds as tt,initialDepthOffsetFrac as et}from"./sliceToolConfig.js";import{createGridVisualElement as it,createOutlineVisualElement as at,planeToShape as st,createRotatePlane as nt,RotationAxis as rt,resizePlane as lt,calculatePlaneHalfSize as ot,SliceOrientation as ht,createPlane as pt,DidPointerMoveRecentlyFlag as ut,calculateBoundedPlaneTranslateRotate as ct,updateShiftRestartHandle as dt,updateRotateHeadingHandle as _t,updateRotateTiltHandle as vt,updateResizeHandle as Pt,createShiftPlane as yt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as mt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as gt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as ft}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Mt}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Dt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Vt}from"../../../support/screenUtils.js";var bt;let Tt=class extends ft{static{bt=this}constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=J,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=S(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=p(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Dt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new Z(this.view,W.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new F(this.view,((t,e)=>A(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new F(this.view,((t,e)=>K(this.view.stage.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new B(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=it(this.view),this._previewPlaneOutlineVisualElement=at(this.view),this._previewPlaneOutlineVisualElement.width=Q,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),l)),this.addHandles([r((()=>"sliced"===this.state),(()=>{this.finishToolCreation(),this.stop()}),o),n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}static{this.disableEngineLayers=!1}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}stop(){this.active&&(this.view.activeTool=null)}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.stop())}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!St(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!St(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!St(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Vt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Vt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Vt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Vt(t),a=S();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=gt(this.view.state.camera,i,jt);this.inputState=kt(e,t.pointerId,a.origin,a)}return x(a,this._startPlane),this.analysis.shape=st(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Vt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===X||t.key===Y)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==X&&t.key!==Y||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=gt(this.view.state.camera,t.screenPoint,jt);x(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(y(j(this.analysisViewData.plane),e.ray.direction)/m(e.ray.direction)))/i,1),s=-C(this._startPlane.plane,e.renderEnd),n=-C(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=w(G.get(),this._startPlane.origin),i=w(G.get(),j(this._startPlane));g(i,i,-t.depth),f(i,i,e);const a=H(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,S());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.HEADING,R()),i=gt(this.view.state.camera,t.screenPoint,jt),a=T();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.TILT,R()),i=gt(this.view.state.camera,t.screenPoint,jt),a=T();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,S()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=I(t.rotatePlane),a=mt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=_(L.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=M(G.get(),this._startPlane.basis1,e),a=M(G.get(),this._startPlane.basis2,e),s=H(this.analysisViewData.plane.origin,i,a,S());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=gt(this.view.state.camera,t.screenPoint,jt),a=G.get();O(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:b(a)})}_createResizeDragPipeline(t){return Mt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=x(this.analysisViewData.plane,S());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=lt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:S();if(i=null!=i?x(i,xt):null,this._pickPlane(t,!0,e,a)){const t=$;let e=!1;null!=i&&(e=y(I(i.plane),I(a.plane))<t||y(D(G.get(),i.basis1),D(G.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=h({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*tt),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=u(t,U.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=G.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(G.get()),l=this.view.state.camera;y(r,l.viewForward)>0&&g(r,r,-1);const o=ot(n,l),h=(e?1:-1)*o*et,p=g(G.get(),r,h);f(p,p,n);const u=this.analysis.tiltEnabled?ht.TILTED:ht.HORIZONTAL_OR_VERTICAL,c=i[X]?ht.VERTICAL:i[Y]?ht.HORIZONTAL:u;return pt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ut,this.rotateHeadingManipulator.state|=ut,this.rotateTiltManipulator.state|=ut,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ut,this.rotateHeadingManipulator.state&=~ut,this.rotateTiltManipulator.state&=~ut}),this._pointerMoveTimerMs)}_updateManipulators(){if(bt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ct(t,L.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),dt(this.shiftManipulator,i,t,this.view.state.camera),_t(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),vt(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>Pt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=V(G.get(),m(t.basis1),m(t.basis2),1),s=v(L.get(),a),n=P(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=N(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=E(q);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=k}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};t([c()],Tt.prototype,"_clock",void 0),t([c({constructOnly:!0})],Tt.prototype,"view",void 0),t([c()],Tt.prototype,"analysisViewData",void 0),t([c({readOnly:!0})],Tt.prototype,"state",null),t([c({readOnly:!0})],Tt.prototype,"cursor",null),t([c()],Tt.prototype,"analysis",null),t([c()],Tt.prototype,"removeIncompleteOnCancel",void 0),t([c()],Tt.prototype,"_layersMode",void 0),t([c()],Tt.prototype,"layersMode",null),t([c({value:null})],Tt.prototype,"inputState",null),t([c()],Tt.prototype,"_isPlacingSlicePlane",null),t([c()],Tt.prototype,"_creatingPointerId",null),Tt=bt=t([d("esri.views.3d.analysis.Slice.SliceTool")],Tt);const Et=Tt;function kt(t,e,i,a){const s=yt(i,j(a),t.direction,R()),n=T();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function St(t){return"mouse"!==t.pointerType||0===t.button}const xt=S(),jt=z();export{Et as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import i from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as o}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{watch as d,when as l,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{c as u,p as w}from"../../../chunks/vec32.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectOrLoad as f,canProjectWithoutEngine as V,isLoaded as y}from"../../../geometry/projection.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{empty as j,containsPoint as g}from"../../../geometry/support/aaBoundingRect.js";import{AnalysisView3D as R}from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as b}from"./support/projectionUtils.js";import{ViewshedAnalysisVisualization as D}from"./Viewshed/ViewshedAnalysisVisualization.js";import{ViewshedComputedData as C}from"./Viewshed/ViewshedComputedData.js";import F from"./Viewshed/ViewshedTool.js";import{newIntersector as H}from"../webgl-engine/lib/Intersector.js";import{StoreResults as T}from"../webgl-engine/lib/IntersectorInterfaces.js";import{Viewshed as O}from"../webgl-engine/lib/Viewshed.js";import{connectAnalysisViewToTool as k,removeAnalysisViewTool as S,activateAnalysisViewTool as U}from"../../analysis/analysisViewUtils.js";let A=class extends(R(i)){constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this.tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this._placementTask=null,this._viewshedRenderer=null,this._intersector=null}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){this._unselectOtherViewsheds(e),this._selectedViewshed=e}get selectedViewshedComputedData(){return this.tool?.selectedViewshedComputedData}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this._viewshedRenderer=new O({view:e,selectedViewshed:()=>this.selectedViewshed??this.tool?.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=H(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=T.MIN,this.viewshedComputedDataHandles=o((()=>this.analysis.viewsheds),(t=>{const s=new C({renderCoordsHelper:e.renderCoordsHelper,viewshed:t}),i=Symbol();return this.addHandles([d((()=>({valid:s.valid,canProject:V(s.observer?.spatialReference,this.view.spatialReference)||y()})),(({valid:e,canProject:t},i)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):i?.valid&&i?.canProject&&this._removeViewshedsFromRenderer(s),t||b(this.analysis,s.observer.spatialReference,r.getLogger(this)))}),c),...this._createFeatureReferenceHandles(s)],i),{viewshedComputedData:s,remove:()=>{this.removeHandles(i),this._removeViewshedsFromRenderer(s),s.destroy()}}})),this._analysisVisualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this.addHandles([d((()=>this.visible),(e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map((e=>e.viewshedComputedData)).filter((e=>e.valid)).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)})),d((()=>e.renderCoordsHelper),(e=>{this.viewshedComputedDataHandles?.forEach((({viewshedComputedData:t})=>t.renderCoordsHelper=e))})),k(this,F),l((()=>this.interactive),(()=>{this._unselectOtherViewsheds(this.selectedViewshed)}),h)])}destroy(){this._placementTask=a(this._placementTask),S(this),this._analysisVisualization=n(this._analysisVisualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map((e=>e.viewshedComputedData)).toArray())}_createFeatureReferenceHandles(e){const{view:t}=this;return[d((()=>[t.state.camera,t.slicePlane,e.viewshed.observer,e.targetRenderSpace,e.verticalFieldOfView,e.horizontalFieldOfView,e.feature]),(()=>{this._updateObserverFromFeature(t,e)}),c),this._createElevationUpdateHandle(e),l((()=>e.needUpdateByFeature),(()=>{this._updateObserverFromFeature(t,e),e.needUpdateByFeature=!1}))]}_createElevationUpdateHandle(e){const t=(s,i)=>{const{view:r}=this,{observer:o}=e;if(null==o)return;const a=f(o,r.spatialReference);if(null!=a.pending)return void a.pending.finally((()=>t(s,i)));const n=a.geometry;null!=n&&(_(s,i,I,r.spatialReference),g(I,[n.x,n.y])&&(e.needUpdateByFeature=!0))};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:s})=>t(e,s)))}async createViewsheds(e){return this._placementTask=a(this._placementTask),this._placementTask=U(this,e),null!=this.tool&&this.tool.createViewsheds(),await this._placementTask.promise}_addViewshedsToRenderer(e){this._viewshedRenderer.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderer.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.observerRenderSpace,o=i.targetRenderSpace,a=u(v(),r),n={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(v(),o),targetFeatureId:null};s(e,this._intersector,n,(e=>Math.min(e,.05*i.farDistanceRenderSpace))),i.observerRenderSpaceOverride=w(a,r)?null:a}_unselectOtherViewsheds(e){if(null!=e)for(const t of this.view.tools.items)t!==this.tool&&t instanceof F&&(t.analysisViewData.selectedViewshed=null)}get test(){}};e([p({readOnly:!0})],A.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],A.prototype,"analysis",void 0),e([p()],A.prototype,"tool",void 0),e([p()],A.prototype,"_selectedViewshed",void 0),e([p()],A.prototype,"selectedViewshed",null),e([p()],A.prototype,"selectedViewshedComputedData",null),e([p()],A.prototype,"viewshedComputedDataHandles",void 0),e([p()],A.prototype,"_analysisVisualization",void 0),e([p()],A.prototype,"_placementTask",void 0),e([p()],A.prototype,"_viewshedRenderer",void 0),A=e([m("esri.views.3d.analysis.ViewshedAnalysisView3D")],A);const z=A,I=j();export{z as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import i from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as o}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{watch as d,when as l,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{c as u,p as w}from"../../../chunks/vec32.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectOrLoad as f,canProjectWithoutEngine as V,isLoaded as y}from"../../../geometry/projection.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{empty as j,containsPoint as g}from"../../../geometry/support/aaBoundingRect.js";import{AnalysisView3D as R}from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as b}from"./support/projectionUtils.js";import{ViewshedAnalysisVisualization as D}from"./Viewshed/ViewshedAnalysisVisualization.js";import{ViewshedComputedData as C}from"./Viewshed/ViewshedComputedData.js";import F from"./Viewshed/ViewshedTool.js";import{newIntersector as H}from"../webgl-engine/lib/Intersector.js";import{StoreResults as T}from"../webgl-engine/lib/IntersectorInterfaces.js";import{Viewshed as O}from"../webgl-engine/lib/Viewshed.js";import{connectAnalysisViewToTool as k,removeAnalysisViewTool as S,activateAnalysisViewTool as U}from"../../analysis/analysisViewUtils.js";let A=class extends(R(i)){constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this.tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this._placementTask=null,this._viewshedRenderer=null,this._intersector=null}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){this._unselectOtherViewsheds(e),this._selectedViewshed=e}get selectedViewshedComputedData(){return this.tool?.selectedViewshedComputedData}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this._viewshedRenderer=new O({view:e,selectedViewshed:()=>this.selectedViewshed??this.tool?.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=H(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=T.MIN,this.viewshedComputedDataHandles=o((()=>this.analysis.viewsheds),(t=>{const s=new C({renderCoordsHelper:e.renderCoordsHelper,viewshed:t}),i=Symbol();return this.addHandles([d((()=>({valid:s.valid,canProject:V(s.observer?.spatialReference,this.view.spatialReference)||y()})),(({valid:e,canProject:t},i)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):i?.valid&&i?.canProject&&this._removeViewshedsFromRenderer(s),t||b(this.analysis,s.observer.spatialReference,r.getLogger(this)))}),c),...this._createFeatureReferenceHandles(s)],i),{viewshedComputedData:s,remove:()=>{this.removeHandles(i),this._removeViewshedsFromRenderer(s),s.destroy()}}})),this._analysisVisualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this.addHandles([d((()=>this.visible),(e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map((e=>e.viewshedComputedData)).filter((e=>e.valid)).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)})),d((()=>e.renderCoordsHelper),(e=>{this.viewshedComputedDataHandles?.forEach((({viewshedComputedData:t})=>t.renderCoordsHelper=e))})),k(this,F),l((()=>this.interactive),(()=>{this._unselectOtherViewsheds(this.selectedViewshed)}),h)])}destroy(){this._placementTask=a(this._placementTask),S(this),this._analysisVisualization=n(this._analysisVisualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map((e=>e.viewshedComputedData)).toArray())}_createFeatureReferenceHandles(e){const{view:t}=this;return[d((()=>[t.state.camera,t.slice.plane,e.viewshed.observer,e.targetRenderSpace,e.verticalFieldOfView,e.horizontalFieldOfView,e.feature]),(()=>{this._updateObserverFromFeature(t,e)}),c),this._createElevationUpdateHandle(e),l((()=>e.needUpdateByFeature),(()=>{this._updateObserverFromFeature(t,e),e.needUpdateByFeature=!1}))]}_createElevationUpdateHandle(e){const t=(s,i)=>{const{view:r}=this,{observer:o}=e;if(null==o)return;const a=f(o,r.spatialReference);if(null!=a.pending)return void a.pending.finally((()=>t(s,i)));const n=a.geometry;null!=n&&(_(s,i,I,r.spatialReference),g(I,[n.x,n.y])&&(e.needUpdateByFeature=!0))};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:s})=>t(e,s)))}async createViewsheds(e){return this._placementTask=a(this._placementTask),this._placementTask=U(this,e),null!=this.tool&&this.tool.createViewsheds(),await this._placementTask.promise}_addViewshedsToRenderer(e){this._viewshedRenderer.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderer.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.observerRenderSpace,o=i.targetRenderSpace,a=u(v(),r),n={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(v(),o),targetFeatureId:null};s(e,this._intersector,n,(e=>Math.min(e,.05*i.farDistanceRenderSpace))),i.observerRenderSpaceOverride=w(a,r)?null:a}_unselectOtherViewsheds(e){if(null!=e)for(const t of this.view.tools.items)t!==this.tool&&t instanceof F&&(t.analysisViewData.selectedViewshed=null)}get test(){}};e([p({readOnly:!0})],A.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],A.prototype,"analysis",void 0),e([p()],A.prototype,"tool",void 0),e([p()],A.prototype,"_selectedViewshed",void 0),e([p()],A.prototype,"selectedViewshed",null),e([p()],A.prototype,"selectedViewshedComputedData",null),e([p()],A.prototype,"viewshedComputedDataHandles",void 0),e([p()],A.prototype,"_analysisVisualization",void 0),e([p()],A.prototype,"_placementTask",void 0),e([p()],A.prototype,"_viewshedRenderer",void 0),A=e([m("esri.views.3d.analysis.ViewshedAnalysisView3D")],A);const z=A,I=j();export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{watch as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as o}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as p}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as c}from"../../SnappingVisualizer3D.js";import{SurfaceType as d,screenToMap3D as h,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as g}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as v}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as y}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as P}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,resetProperties as w}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as S}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as M}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as j}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as b}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as L}from"../../../../support/screenUtils.js";let x=class extends y{constructor(t){super(t),this._updatingHandles=new o,this._emulatedDrag=null,this.lineState="initial",this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=i((t=>new M({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new S(new _("point",P(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new c})))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:s}=this;this.measurementView=new g({toolState:this,view:t,analysis:e,analysisViewData:i,visible:s});const r=j(t);this._snappingManagerResult=r,this.addHandles(r);const{start:o,end:p,cursor:c}=this.measurementView.createManipulators(),d=(t,e,i)=>f(t,((t,n,a,s)=>{const r=m(t),o=this._snappingManager,p=this._getSnappingContext(s),c=this._updatingHandles,{lineState:d}=this;a=a.next(r).next(w(this,[i,e])).next((i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i}));const g=h(this.view),v=t=>{const n=g(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let y=n.next(r).next(v);if("touch"!==s||"editing"===d){const{snappingStep:t,cancelSnapping:e}=D({snappingManager:o,snappingContext:p,updatingHandles:c});a=a.next(e),y=y.next(...t)}y.next((t=>"start"!==t.action?t:null)).next((n=>{const a=u(n.mapEnd,new l);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)}))})),v=t=>t.events.on("grab-changed",(()=>{const t=o.grabbing||p.grabbing;this.lineState=t?"editing":"measured"}));this.addHandles([d(o,"startPoint","startPointSurfaceLocation"),d(p,"endPoint","endPointSurfaceLocation"),d(c,"cursorPoint","cursorPointSurfaceLocation"),v(o),v(p)]),this.manipulators.add(o),this.manipulators.add(p),this.manipulators.add(c),this.startManipulator=o,this.endManipulator=p,this.cursorManipulator=c,this.addHandles(n((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),a)),b(this)}destroy(){this._updatingHandles=e(this._updatingHandles),this.measurementView=e(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(null==t.startPoint&&null==t.endPoint)return"ready";const{lineState:e}=this;return this.validMeasurement&&"editing"!==e&&"drawing"!==e?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.lineState?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return null!=this.analysis.startPoint&&null!=this.analysis.endPoint}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}onShow(){this.measurementView.show(),this._updateManipulatorAvailability()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}this._updateManipulatorAvailability()}_handlePointerMove(t){if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if("mouse"!==e)return;const i=L(t),{lineState:n,cursorManipulator:a,endManipulator:s}=this;let r=!1;null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(a,e,i),r=!0),"initial"===n&&(this._emulatedDrag?.update(i),r=!0),"drawing"===n&&(s.events.emit("drag",{action:"update",start:i,screenPoint:i}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){if(!this.active)return;if(!p(t))return;const e=L(t),{pointerType:i}=t,{cursorManipulator:n,startManipulator:a,endManipulator:s,lineState:r}=this;let o=!1;switch(null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=V(n,i,e)),r){case"initial":if(this._emulatedDrag?.update(e),null!=this.cursorPoint){this._emulatedDrag?.end(e),this._emulatedDrag=null;const{cursorPoint:t}=this;this.startPoint=t,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,a.location=t,a.interactive=!1,s.interactive=!1,this.lineState="drawing",this._emulatedDrag=V(s,i,e),o=!0}break;case"drawing":this._emulatedDrag?.update(e),null!=this.endPoint&&(this._emulatedDrag?.end(e),this._emulatedDrag=null,a.interactive=!0,s.interactive=!0,this.lineState="measured",o=!0)}o&&t.stopPropagation()}_surfaceLocation(t,e){return e===d.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_updateManipulatorAvailability(){this.startManipulator.available=null!=this.analysis.startPoint,this.endManipulator.available=null!=this.analysis.endPoint}_getElevation(t){return this.view.basemapTerrain.ready?v(this.view.elevationProvider,t)??0:0}get test(){}};function V(t,e,i){return t.events.emit("drag",{action:"start",pointerType:e,start:i,screenPoint:i}),{update:e=>t.events.emit("drag",{action:"update",start:e,screenPoint:e}),end:e=>t.events.emit("drag",{action:"end",start:e,screenPoint:e}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}t([s({readOnly:!0})],x.prototype,"state",null),t([s()],x.prototype,"lineState",void 0),t([s({readOnly:!0})],x.prototype,"cursor",null),t([s()],x.prototype,"startPoint",null),t([s()],x.prototype,"endPoint",null),t([s()],x.prototype,"cursorPoint",null),t([s({constructOnly:!0})],x.prototype,"analysis",void 0),t([s({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([s()],x.prototype,"measurementView",void 0),t([s({constructOnly:!0})],x.prototype,"view",void 0),t([s({readOnly:!0})],x.prototype,"validMeasurement",null),t([s({value:null})],x.prototype,"startPointSurfaceLocation",void 0),t([s({value:null})],x.prototype,"endPointSurfaceLocation",void 0),t([s({value:null})],x.prototype,"cursorPointSurfaceLocation",void 0),t([s()],x.prototype,"updating",null),x=t([r("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],x);const H=x;export{H as default};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{when as n,syncAndInitial as a,watch as s}from"../../../../../core/reactiveUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import u from"../../../../../geometry/Point.js";import{clonePoint as p}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as c}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{SurfaceType as m,screenToMap3D as h,hideManipulatorWhileDragging as g}from"../../editingTools/dragEventPipeline3D.js";import{DirectLineMeasurement3DView as v}from"./DirectLineMeasurement3DView.js";import{getElevationAtPoint as P}from"../../../support/ElevationProvider.js";import{AnalysisToolBase as y}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as f}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as w,resetProperties as S}from"../../../../interactive/dragEventPipeline.js";import{EditGeometry as _}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as M}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as D}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as j}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as b}from"../../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as L}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as x}from"../../../../support/screenUtils.js";let V=class extends y{constructor(t){super(t),this._updatingHandles=new l,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=i((t=>new D({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new M(new _("point",f(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new d})))}initialize(){const{view:t,analysis:e,analysisViewData:i,visible:r}=this;this.measurementView=new v({toolState:this,view:t,analysis:e,analysisViewData:i,visible:r});const o=b(t);this._snappingManagerResult=o,this.addHandles(o);const{start:l,end:c,cursor:d}=this.measurementView.createManipulators(),m=(t,e,i)=>w(t,((t,n,a,s)=>{const r=g(t),o=this._snappingManager,l=this._getSnappingContext(s),c=this._updatingHandles,{lineState:d}=this;a=a.next(r).next(S(this,[i,e])).next((i=>{if("cursorPoint"!==e){const i=this.analysis[e];null!=i&&(t.location=i)}return i}));const m=h(this.view),v=t=>{const n=m(t);return n||"drawing"!==this.lineState&&"initial"!==this.lineState||(this[e]=null,this[i]=null),n};let P=n.next(r).next(v);if("touch"!==s||"editing"===d){const{snappingStep:t,cancelSnapping:e}=j({snappingManager:o,snappingContext:l,updatingHandles:c});a=a.next(e),P=P.next(...t)}P.next((t=>"start"!==t.action?t:null)).next((n=>{const a=p(n.mapEnd,new u);this[e]=a,t.location=a,this[i]=this._surfaceLocation(a,n.surfaceType)}))})),P=t=>t.events.on("grab-changed",(()=>{const t=l.grabbing||c.grabbing;this.lineState=t?"editing":"measured"}));this.addHandles([m(l,"startPoint","startPointSurfaceLocation"),m(c,"endPoint","endPointSurfaceLocation"),m(d,"cursorPoint","cursorPointSurfaceLocation"),P(l),P(c)]),this.manipulators.add(l),this.manipulators.add(c),this.manipulators.add(d),this.startManipulator=l,this.endManipulator=c,this.cursorManipulator=d,this.addHandles([n((()=>"measured"===this.state),(()=>{this.finishToolCreation(),this.active&&(this.view.activeTool=null)}),a),s((()=>({startPointAvailable:null!=this.startPoint,endPointAvailable:null!=this.endPoint})),(({startPointAvailable:t,endPointAvailable:e})=>{this.startManipulator.available=t,this.endManipulator.available=e}),a)]),L(this)}destroy(){this._updatingHandles=e(this._updatingHandles),this.measurementView=e(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(null==t.startPoint&&null==t.endPoint)return"ready";const{lineState:e}=this;return this.validMeasurement&&"editing"!==e&&"drawing"!==e?"measured":"measuring"}get cursor(){return this.active&&("ready"===this.state||"drawing"===this.lineState)?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return null!=this.analysis.startPoint&&null!=this.analysis.endPoint}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}resetCreated(){super.resetCreated(),this.lineState="initial",this.measurementView.cursorPoint=null}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._emulatedDrag?.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}}_handlePointerMove(t){if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if("mouse"!==e)return;const i=x(t),{lineState:n,cursorManipulator:a,endManipulator:s}=this;let r=!1;null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=C(a,e,i),r=!0),"initial"===n&&(this._emulatedDrag?.update(i),r=!0),"drawing"===n&&(s.events.emit("drag",{action:"update",start:i,screenPoint:i}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){if(!this.active)return;if(!c(t))return;const e=x(t),{pointerType:i}=t,{cursorManipulator:n,startManipulator:a,endManipulator:s,lineState:r}=this;let o=!1;switch(null==this.cursorPoint&&(this._emulatedDrag?.cancel(),this._emulatedDrag=C(n,i,e)),r){case"initial":if(this._emulatedDrag?.update(e),null!=this.cursorPoint){this._emulatedDrag?.end(e),this._emulatedDrag=null;const{cursorPoint:t}=this;this.startPoint=t,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,a.location=t,a.interactive=!1,s.interactive=!1,this.lineState="drawing",this._emulatedDrag=C(s,i,e),o=!0}break;case"drawing":this._emulatedDrag?.update(e),null!=this.endPoint&&(this._emulatedDrag?.end(e),this._emulatedDrag=null,a.interactive=!0,s.interactive=!0,this.lineState="measured",o=!0)}o&&t.stopPropagation()}_surfaceLocation(t,e){return e===m.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_getElevation(t){return this.view.basemapTerrain.ready?P(this.view.elevationProvider,t)??0:0}get test(){}};function C(t,e,i){return t.events.emit("drag",{action:"start",pointerType:e,start:i,screenPoint:i}),{update:e=>t.events.emit("drag",{action:"update",start:e,screenPoint:e}),end:e=>t.events.emit("drag",{action:"end",start:e,screenPoint:e}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}t([r({readOnly:!0})],V.prototype,"state",null),t([r()],V.prototype,"lineState",void 0),t([r({readOnly:!0})],V.prototype,"cursor",null),t([r()],V.prototype,"startPoint",null),t([r()],V.prototype,"endPoint",null),t([r()],V.prototype,"cursorPoint",null),t([r({constructOnly:!0})],V.prototype,"analysis",void 0),t([r({constructOnly:!0})],V.prototype,"analysisViewData",void 0),t([r()],V.prototype,"measurementView",void 0),t([r()],V.prototype,"removeIncompleteOnCancel",void 0),t([r({constructOnly:!0})],V.prototype,"view",void 0),t([r({readOnly:!0})],V.prototype,"validMeasurement",null),t([r({value:null})],V.prototype,"startPointSurfaceLocation",void 0),t([r({value:null})],V.prototype,"endPointSurfaceLocation",void 0),t([r({value:null})],V.prototype,"cursorPointSurfaceLocation",void 0),t([r()],V.prototype,"updating",null),V=t([o("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],V);const H=V;export{H as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec2f as M,BufferViewVec4f as P,BufferViewVec4u8 as O,BufferViewVec4u16 as U,BufferViewVec3f as E,BufferViewVec3u8 as I,BufferViewVec3u16 as V,BufferViewInt16 as A,BufferViewUint32 as H,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as D,Lyr3DUvWrapMode as L,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as J}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as X,getLyr3DWasm as Q}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ie}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{Obb as ne,compute as ae}from"../support/orientedBoundingBox.js";import{ObjectParameters as le}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ce,createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ge}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as be,AlphaDiscardMode as ye,TextureEncodingMimeType as we}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as _e}from"../webgl-engine/lib/Normals.js";import{Texture as ve}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as xe}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as je,writeBufferVec2 as Ce}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Me}from"../../support/layerViewUtils.js";import{alphaCutoff as Pe}from"../../../webscene/support/AlphaCutoff.js";var Oe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Oe||(Oe={}));class Ue{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ee(e){return Math.round(e/1048.576)/1e3}let Ie=class extends(J(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Oe.Error),this._dbg(Oe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=K(this).then((e=>{this._intersectionHandler=new ie(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([i((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=i((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Oe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=s(this._memCache),this._updatingHandles=s(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=n((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?be.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return Q(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Me(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,s=0,i=0,o=0;return this._lyrHandleToObjects.forEach((n=>{n.isVisible?(e+=n.texMemoryUsage,t+=n.vboMemoryUsage,i++):(r+=n.texMemoryUsage,s+=n.vboMemoryUsage,o++)})),new $(this.usedMemory,i,o,Ee(t),Ee(e),Ee(s),Ee(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),s=new Array,i=new Map,o=new Ue;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,l;if("global"===this.view.viewingMode){const e=f();j(x,r,e,n),a=c(h(),e),l=m(h(),a)}else a=d,l=d;const P=f();u(P,P,r);const O=p(_(),P);let U=null;const E=_();if(t.desc.obb){const e=t.desc.obb.quaternion;U=new ne(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Oe.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Oe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,{positionView:u,positionAttr:p,normalsView:f,normalsAttr:g,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,a);if(null==p||null==u||null==j)continue;const P=new ce(null!=w,x?pe.Default:pe.None,null!=f,this._shadeNormals,this._applySSAO),I=p.data.length/p.size,V=(e,t)=>!e||e.data.length/e.size===I||(this._dbg(Oe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!V(x,"numTexcoord")||!V(w,"numColors")||!V(g,"normals"))continue;const A=me(P);if(null!=U?U=U.clone():(U=ae(p),b(E,U.center,r),U.center=E),a!==d)for(let t=0;t<u.count;t++)u.getVec(t,E),y(E,E,a),u.setVec(t,E);const H=A.createBuffer(p.data.length);if(je(xe.POSITION,p,null,null,H,0),null!=x){const e=H.getField(xe.UV0,M);Ce(x,e,0)}null!=w&&je(xe.COLOR,p,null,null,H,0),null!=g&&je(xe.NORMALCOMPRESSED,g,null,null,H,0);const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:H.buffer,count:H.byteLength/A.stride,layoutParameters:P},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,L=_(),k=[1,1,1];C(O,F,k,n)||this._dbg(Oe.Error,"Unsupported coordinate system for IM overlay"),T(O,F,L,n);const B=this._collection.createObject(new le(v(L[0],L[1],k[0],k[1]),new de(O,l),U,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,i),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveBaseColor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,i),e.emissionTexture=this._getTexture(m.emissiveTex,t,i),e.occlusionTexture=this._getTexture(m.occlusionTex,t,i),e.normalTexture=this._getTexture(m.normalTex,t,i)),e.objectOpacity=0,e.alphaDiscardMode=ye.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);s.push(n),n.then((()=>{e.alphaDiscardMode=ee[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?te[m.faceCulling]:be.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??Pe,e.alphaDiscardMode=ee[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(s),i.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let s=0;s<r;++s){const r=e[s],i=t[s];if(!i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let s=0;s<r;++s){const r=e[s],i=t[s];if(i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const i=t.desc.images[e?.imageId];if(s=r.get(i),!s&&i){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!i.mipCount||o>1,a=re[e.wrapMode??L.None];let l=i.alpha?4:3;const c=new Uint8Array(t.data.buffer,i.data.byteOffset,i.data.byteCount);let m=null,d=null,h=null;switch(i.format){case k.Raw:i.pixelFormat===B.R8?(m=c,l=1,d=""):i.pixelFormat===B.Rgb8?(m=c,l=3,d=""):i.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=we.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=we.DDS_ENCODING;break;case k.Basis:m=c,l=3,d=we.KTX2_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Oe.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Oe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(s=new ve(m,{mipmap:n,maxAnisotropy:o,encoding:d,wrap:a,components:l,noUnpackFlip:!0,width:i.mip0Width,height:i.mip0Height}),this._stage.add(s),r.set(i,s))}}return s?new ue(this.view.stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let s,i,o,n,a,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/se[u.type],b=[...Array(g).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Oe.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new E(t,u.byteOffset,p,f),i=new ge(s.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Oe.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new E(t,u.byteOffset,p,f),s=_e(e.typedBuffer,r);a=new A(s),l=new ge(a.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Oe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new ge(new M(t,u.byteOffset,p,f).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new P(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new O(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new U(t,u.byteOffset,p,f))):3===u.ncomp&&(u.type===G.F32&&(m=new E(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new I(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new V(t,u.byteOffset,p,f))),null==m?this._dbg(Oe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ge(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Oe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Oe.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,s=void 0,i=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,s,i);break;case G.U32:c=new H(t,r.byteOffset,s,i);break;case G.U8:default:this._dbg(Oe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new H(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:i,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Oe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([a()],Ie.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],Ie.prototype,"layer",void 0),e([a({readOnly:!0})],Ie.prototype,"visibleAtCurrentScale",null),e([a()],Ie.prototype,"elevationOffset",null),Ie=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ie);const Ve=Ie;export{Ve as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec2f as T,BufferViewVec4f as P,BufferViewVec4u8 as O,BufferViewVec4u16 as U,BufferViewVec3f as E,BufferViewVec3u8 as H,BufferViewVec3u16 as I,BufferViewInt16 as V,BufferViewUint32 as A,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as D,Lyr3DUvWrapMode as L,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import z from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as W}from"../../../support/elevationInfoUtils.js";import{ViewingMode as $}from"../../ViewingMode.js";import{toWasmModification as q}from"./I3SMeshWorkerHandle.js";import{IntegratedMesh3DTilesViewPerformanceInfo as J}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as K}from"./interfaces.js";import{LayerView3D as X}from"./LayerView3D.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as Y,getLyr3DWasm as Z}from"./Lyr3DWasm.js";import{LayerElevationProvider as ee}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as te,alphaModeConversion as re,faceCullingConversion as ie,wrapModeConversion as se,lyr3DTypeToByteSize as oe}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ae}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ne}from"../support/ElevationRange.js";import{Obb as le,compute as ce}from"../support/orientedBoundingBox.js";import{ObjectParameters as me}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as de,createVertexBufferLayout as he}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ue}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as pe}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as fe}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as ge}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as be}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ye}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as we,AlphaDiscardMode as _e,TextureEncodingMimeType as ve}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as xe}from"../webgl-engine/lib/Normals.js";import{Texture as je}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as Ce}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Me,writeBufferVec2 as Te}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Pe from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Oe}from"../../support/layerViewUtils.js";import{alphaCutoff as Ue}from"../../../webscene/support/AlphaCutoff.js";var Ee;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Ee||(Ee={}));class He{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ie(e){return Math.round(e/1048.576)/1e3}let Ve=class extends(X(Pe)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=K.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}get hasModifications(){return this._modifications&&this._modifications.length>0}initialize(){if(this._dbgFlags.add(Ee.Error),this._dbg(Ee.VerboseAPI,"Tiles3DLayerView3D initialize() called"),this._updatingHandles.add((()=>this.layer.modifications),(()=>this._loadModifications()),s),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=Q(this).then((e=>{this._intersectionHandler=new ae(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),s),this._elevationProvider=new ee({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([o((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=o((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),s)})).catch((e=>{if(Y(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Ee.VerboseAPI,"Tiles3DLayerView3D destroy() called"),Y(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=i(this._memCache),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=q(null,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?we.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,W(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return Z(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Oe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach((a=>{a.isVisible?(e+=a.texMemoryUsage,t+=a.vboMemoryUsage,s++):(r+=a.texMemoryUsage,i+=a.vboMemoryUsage,o++)})),new J(this.usedMemory,s,o,Ie(t),Ie(e),Ie(i),Ie(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===$.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return W(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ne(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),i=new Array,s=new Map,o=new He;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const a=this.view.basemapTerrain.spatialReference;let n,l;if("global"===this.view.viewingMode){const e=f();j(x,r,e,a),n=c(h(),e),l=m(h(),n)}else n=d,l=d;const P=f();u(P,P,r);const O=p(_(),P);let U=null;const E=_();if(t.desc.obb){const e=t.desc.obb.quaternion;U=new le(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Ee.VerboseAPI,JSON.stringify(e));if(null==te[e.ptype]||null==t.data){this._dbg(Ee.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,{positionView:u,positionAttr:p,normalsView:f,normalsAttr:g,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,n);if(null==p||null==u||null==j)continue;const P=new de(null!=w,x?ge.Default:ge.None,null!=f,this._shadeNormals,this._applySSAO),H=p.data.length/p.size,I=(e,t)=>!e||e.data.length/e.size===H||(this._dbg(Ee.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(x,"numTexcoord")||!I(w,"numColors")||!I(g,"normals"))continue;const V=he(P);if(null!=U?U=U.clone():(U=ce(p),b(E,U.center,r),U.center=E),n!==d)for(let t=0;t<u.count;t++)u.getVec(t,E),y(E,E,n),u.setVec(t,E);const A=V.createBuffer(p.data.length);if(Me(Ce.POSITION,p,null,null,A,0),null!=x){const e=A.getField(Ce.UV0,T);Te(x,e,0)}null!=w&&Me(Ce.COLOR,p,null,null,A,0),null!=g&&Me(Ce.NORMALCOMPRESSED,g,null,null,A,0);const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:A.buffer,count:A.byteLength/V.stride,layoutParameters:P},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,L=_(),k=[1,1,1];C(O,F,k,a)||this._dbg(Ee.Error,"Unsupported coordinate system for IM overlay"),M(O,F,L,a);const B=this._collection.createObject(new me(v(L[0],L[1],k[0],k[1]),new ue(O,l),U,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,s),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveBaseColor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,s),e.emissionTexture=this._getTexture(m.emissiveTex,t,s),e.occlusionTexture=this._getTexture(m.occlusionTex,t,s),e.normalTexture=this._getTexture(m.normalTex,t,s)),e.objectOpacity=0,e.alphaDiscardMode=_e.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const a=Promise.all(r);i.push(a),a.then((()=>{e.alphaDiscardMode=re[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?ie[m.faceCulling]:we.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=pe.All,e.textureAlphaCutoff=m.alphaCutoff??Ue,e.alphaDiscardMode=re[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=be(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(i),s.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let i=null;if(e&&t.desc?.images&&t.data?.buffer){const s=t.desc.images[e?.imageId];if(i=r.get(s),!i&&s){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!s.mipCount||o>1,n=se[e.wrapMode??L.None];let l=s.alpha?4:3;const c=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,d=null,h=null;switch(s.format){case k.Raw:s.pixelFormat===B.R8?(m=c,l=1,d=""):s.pixelFormat===B.Rgb8?(m=c,l=3,d=""):s.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=ve.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=ve.DDS_ENCODING;break;case k.Basis:m=c,l=3,d=ve.KTX2_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Ee.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Ee.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(i=new je(m,{mipmap:a,maxAnisotropy:o,encoding:d,wrap:n,components:l,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height}),this._stage.add(i),r.set(s,i))}}return i?new fe(this.view.stage.renderView.textures,i.id):null}getBufferViews(e,t,r){let i,s,o,a,n,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/oe[u.type],b=[...Array(g).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Ee.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(i=new E(t,u.byteOffset,p,f),s=new ye(i.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Ee.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new E(t,u.byteOffset,p,f),i=xe(e.typedBuffer,r);n=new V(i),l=new ye(n.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Ee.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ye(new T(t,u.byteOffset,p,f).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new P(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new O(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new U(t,u.byteOffset,p,f))):3===u.ncomp&&(u.type===G.F32&&(m=new E(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new H(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new I(t,u.byteOffset,p,f))),null==m?this._dbg(Ee.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ye(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Ee.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Ee.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,i,s);break;case G.U32:c=new A(t,r.byteOffset,i,s);break;case G.U8:default:this._dbg(Ee.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=i){const e=i.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new A(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:i,positionAttr:s,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange((()=>e),(()=>this._modifications=e.toArray()),s),"modifications")}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Ee.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([n({type:[z]})],Ve.prototype,"_modifications",void 0),e([n()],Ve.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],Ve.prototype,"layer",void 0),e([n({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),e([n()],Ve.prototype,"elevationOffset",null),Ve=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ve);const Ae=Ve;export{Ae as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{Lyr3DWasmWorkerOutputStatus as s}from"../../../layers/ILyr3DWasmPerSceneView.js";import{loadLyr3DWorkerWASM as t}from"../../../libs/lyr3d/Lyr3DModule.js";let e,n;async function r(t){if(await o(),t.inputs.length<1)return{result:{status:s.Failed,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[]},transferList:[]};const e={ptrs:[],sizes:[]};for(const s of t.inputs){const t=n._malloc(s.byteLength);new Uint8Array(n.HEAPU8.buffer,t,s.byteLength).set(new Uint8Array(s)),e.ptrs.push(t),e.sizes.push(s.byteLength)}const r=n.process(t.jobDescJson,e,t.isMissingResourceCase),i=r.status===s.Succeeded&&r.data,a=r.status===s.MissingInputs&&r.missingInputUrls.length>0;if(i){const s=r.data.slice();r.data=s}else a&&(r.jobDescJson=r.jobDescJson.slice(),r.originalInputs=t.inputs.slice());for(let s=0;s<e.ptrs.length;++s)n._free(e.ptrs[s]);const l=[];if(i)l.push(r.data.buffer);else if(a)for(const s of t.inputs)l.push(s);return{result:r,transferList:l}}function i(){n&&(n.uninitialize_lyr3d_worker_wasm(),n=null)}function o(){return n?Promise.resolve():(e||(e=t().then((s=>{n=s,n.initialize_lyr3d_worker_wasm(),e=null}))),e)}export{i as destroyWasm,o as initialize,r as process};
5
+ import{Lyr3DWasmWorkerOutputStatus as s}from"../../../layers/ILyr3DWasmPerSceneView.js";import{loadLyr3DWorkerWASM as t}from"../../../libs/lyr3d/Lyr3DModule.js";let e,r;async function n(t){await o();const e={status:s.Failed,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[]};if(t.inputs.length<1)return{result:e,transferList:[]};const n={ptrs:[],sizes:[]};for(const s of t.inputs){const t=r._malloc(s.byteLength);new Uint8Array(r.HEAPU8.buffer,t,s.byteLength).set(new Uint8Array(s)),n.ptrs.push(t),n.sizes.push(s.byteLength)}const i=r.process(t.jobDescJson,t.id,n,t.isMissingResourceCase);e.status=i.status,e.missingInputUrls=i.missingInputUrls.slice();const u=i.status===s.Succeeded&&i.data,l=e.status===s.MissingInputs&&e.missingInputUrls.length>0;e.jobDescJson=i.jobDescJson.slice(),e.error=i.error.slice(),u?e.data=i.data.slice():l&&(e.originalInputs=t.inputs.slice());for(let s=0;s<n.ptrs.length;++s)r._free(n.ptrs[s]);const a=[];if(u)a.push(e.data.buffer);else if(l)for(const s of t.inputs)a.push(s);return{result:e,transferList:a}}function i(){r&&(r.uninitialize_lyr3d_worker_wasm(),r=null)}function o(){return r?Promise.resolve():(e||(e=t().then((s=>{r=s,r.initialize_lyr3d_worker_wasm(),e=null}))),e)}export{i as destroyWasm,o as initialize,n as process};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import t from"../../../core/Logger.js";import{watch as i,initial as r}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{e as l,n,i as h}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{empty as m,expandWithVec3 as p}from"../../../geometry/support/aaBoundingBox.js";import{equals as y}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as b}from"./LayerView3D.js";import{VoxelGraphic as V}from"./VoxelGraphic.js";import{addLayerViewToWasm as _,removeLayerViewFromWasm as w,getVoxelWasm as f}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as g}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as S}from"./support/PopupSceneLayerView.js";import v from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as W,isInEffectiveScaleRange as T}from"../../support/layerViewUtils.js";var x;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(x||(x={}));const L=c(),A=c();let E=class extends(S(b(v))){constructor(){super(...arguments),this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this.ignoresMemoryFactor=!0,this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path??""}get wasmLayerId(){return this._wasmLayerId}initialize(){if(this._dbgFlags.add(x.Error),"local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!!!this.view.stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!y(e,this.view.spatialReference))throw W("voxel layer",e.wkid,this.view.spatialReference.wkid);const t=this.layer.currentVariableId,o=this.layer.getVolume(t),a=this.layer.getVariable(t);if(null!=o&&null!=a){const e=o.dimensions[0],s=o.dimensions[1],t=o.zDimension;if(t>1){const i=o.dimensions[t],r=e.size*s.size*i.size;let l=1;switch(a.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*r}}const l=_(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=i((()=>this.suspended),(e=>{const s=f(this.view);s&&s.setEnabled(this,!e)}),r),this.addHandles([i((()=>this.layer.renderMode),(e=>this._pushRenderModeToWasm(e))),i((()=>this.layer.currentVariableId),(e=>this._pushCurrentVariableIdToWasm(e))),i((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),i((()=>this.layer.getVariableStyles()),(e=>this._pushVariableStylesToWasm(e))),i((()=>this.layer.getVolumeStyles()),(e=>this._pushVolumeStylesToWasm(e))),i((()=>this.layer.enableDynamicSections),(e=>this._pushEnableDynamicSectionsToWasm(e))),i((()=>this.layer.enableIsosurfaces),(e=>this._pushEnableIsosurfacesToWasm(e))),i((()=>this.layer.enableSections),(e=>this._pushEnableSectionsToWasm(e))),i((()=>this.layer.enableSlices),(e=>this._pushEnableSlicesToWasm(e))),i((()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime]),(()=>this._updateLayerTimeProperties())),i((()=>this.slicePlaneEnabled),(e=>this._pushAnalysisSliceToWasm(e,this.view.slicePlane))),i((()=>this.view.slicePlane),(e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e)))])})).catch((e=>{if(w(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(l)}destroy(){w(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=f(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new g(this.usedMemory)}get visibleAtCurrentScale(){return T(this.layer.effectiveScaleRange,this.view.scale)}whenGraphicBounds(e,s){const t=e.attributes["Voxel.WorldPosition"];if(t){const e=m(),s=JSON.parse(t);if(u(s,this.view.renderSpatialReference,A,this.view.spatialReference||d.WGS84))return p(e,A),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}async whenGraphicAttributes(e,s){const t=f(this.view);if(!t)return e;const i=[];for(const r of e)this._isValidVoxelGraphic(r)&&i.push(r);return i.length&&await t.getOtherFieldPopupValues(i,s),e}_isValidVoxelGraphic(e){return e instanceof V}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=f(this.view);e?.captureFrustum()}toggleFullVolumeExtentDraw(){const e=f(this.view);e?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=f(this.view);return e?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){const e=f(this.view);return e?.getCurrentLayerTimeIndex(this)??0}dropQueryRenderTarget(){const e=f(this.view);e?.dropQueryRenderTarget()}_pushRenderModeToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setRenderMode(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setStaticSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s?.setCurrentVariable(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setVariableStyles(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const t=null!=s?s:this.layer.enableSlices;for(let i=0;i<e.length;++i){const s=e[i];for(const e of s.slices)e.enabled=e.enabled&&t}}_pushVolumeStylesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushVolumeStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s&&(this._accountForEnableSlices(e,null),s.setVolumeStyles(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushVolumeStylesToWasm() failed!"))}_pushAnalysisSliceToWasm(e,s){const t=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushAnalysisSliceToWasm() called, "+(t?"have WASM":"don't have WASM!!!"));let i=!1;if(t){if(s){const r=s.origin;l(L,s.basis1,s.basis2),n(L,L),i=t.setAnalysisSlice(this,e,r,L)}else h(L,0,0,1),i=t.setAnalysisSlice(this,!1,L,L);i||this._dbg(x.Error,"VoxelLayerView3D._pushAnalysisSliceToWasm() failed!")}}_updateLayerTimeProperties(){const e=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._updateLayerTimeProperties() called, "+(e?"have WASM":"don't have WASM!!!")),e&&e.updateLayerTimeProperties(this)}_pushEnableDynamicSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableDynamicSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!")}_pushEnableSlicesToWasm(e){const s=f(this.view);if(this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableSlicesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s){const t=this.layer.getVolumeStyles();this._accountForEnableSlices(t,e),s.setVolumeStyles(this,t)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableSlicesToWasm() failed!")}}_pushEnableIsosurfacesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableIsosurfaces(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!")}_pushEnableSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableSectionsToWasm() failed!")}_dbg(e,s){this._dbgFlags.has(e)&&(e===x.Error?t.getLogger(this).error(s):t.getLogger(this).warn(s))}};e([o()],E.prototype,"layer",void 0),e([o()],E.prototype,"baseUrl",null),e([o({type:Boolean})],E.prototype,"slicePlaneEnabled",void 0),e([o({readOnly:!0})],E.prototype,"visibleAtCurrentScale",null),E=e([a("esri.views.3d.layers.VoxelLayerView3D")],E);const M=E;export{M as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import t from"../../../core/Logger.js";import{watch as i,initial as r}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{e as l,n,i as h}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{empty as m,expandWithVec3 as p}from"../../../geometry/support/aaBoundingBox.js";import{equals as y}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as b}from"./LayerView3D.js";import{VoxelGraphic as V}from"./VoxelGraphic.js";import{addLayerViewToWasm as _,removeLayerViewFromWasm as w,getVoxelWasm as f}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as g}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as S}from"./support/PopupSceneLayerView.js";import v from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as W,isInEffectiveScaleRange as T}from"../../support/layerViewUtils.js";var x;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(x||(x={}));const L=c(),A=c();let E=class extends(S(b(v))){constructor(){super(...arguments),this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this.ignoresMemoryFactor=!0,this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path??""}get wasmLayerId(){return this._wasmLayerId}initialize(){if(this._dbgFlags.add(x.Error),"local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!!!this.view.stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!y(e,this.view.spatialReference))throw W("voxel layer",e.wkid,this.view.spatialReference.wkid);const t=this.layer.currentVariableId,o=this.layer.getVolume(t),a=this.layer.getVariable(t);if(null!=o&&null!=a){const e=o.dimensions[0],s=o.dimensions[1],t=o.zDimension;if(t>1){const i=o.dimensions[t],r=e.size*s.size*i.size;let l=1;switch(a.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*r}}const l=_(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=i((()=>this.suspended),(e=>{const s=f(this.view);s&&s.setEnabled(this,!e)}),r),this.addHandles([i((()=>this.layer.renderMode),(e=>this._pushRenderModeToWasm(e))),i((()=>this.layer.currentVariableId),(e=>this._pushCurrentVariableIdToWasm(e))),i((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),i((()=>this.layer.getVariableStyles()),(e=>this._pushVariableStylesToWasm(e))),i((()=>this.layer.getVolumeStyles()),(e=>this._pushVolumeStylesToWasm(e))),i((()=>this.layer.enableDynamicSections),(e=>this._pushEnableDynamicSectionsToWasm(e))),i((()=>this.layer.enableIsosurfaces),(e=>this._pushEnableIsosurfacesToWasm(e))),i((()=>this.layer.enableSections),(e=>this._pushEnableSectionsToWasm(e))),i((()=>this.layer.enableSlices),(e=>this._pushEnableSlicesToWasm(e))),i((()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime]),(()=>this._updateLayerTimeProperties())),i((()=>this.slicePlaneEnabled),(e=>this._pushAnalysisSliceToWasm(e,this.view.slice.plane))),i((()=>this.view.slice.plane),(e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e)))])})).catch((e=>{if(w(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(l)}destroy(){w(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=f(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new g(this.usedMemory)}get visibleAtCurrentScale(){return T(this.layer.effectiveScaleRange,this.view.scale)}whenGraphicBounds(e,s){const t=e.attributes["Voxel.WorldPosition"];if(t){const e=m(),s=JSON.parse(t);if(u(s,this.view.renderSpatialReference,A,this.view.spatialReference||d.WGS84))return p(e,A),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}async whenGraphicAttributes(e,s){const t=f(this.view);if(!t)return e;const i=[];for(const r of e)this._isValidVoxelGraphic(r)&&i.push(r);return i.length&&await t.getOtherFieldPopupValues(i,s),e}_isValidVoxelGraphic(e){return e instanceof V}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=f(this.view);e?.captureFrustum()}toggleFullVolumeExtentDraw(){const e=f(this.view);e?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=f(this.view);return e?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){const e=f(this.view);return e?.getCurrentLayerTimeIndex(this)??0}dropQueryRenderTarget(){const e=f(this.view);e?.dropQueryRenderTarget()}_pushRenderModeToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setRenderMode(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setStaticSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s?.setCurrentVariable(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setVariableStyles(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const t=null!=s?s:this.layer.enableSlices;for(let i=0;i<e.length;++i){const s=e[i];for(const e of s.slices)e.enabled=e.enabled&&t}}_pushVolumeStylesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushVolumeStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s&&(this._accountForEnableSlices(e,null),s.setVolumeStyles(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushVolumeStylesToWasm() failed!"))}_pushAnalysisSliceToWasm(e,s){const t=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushAnalysisSliceToWasm() called, "+(t?"have WASM":"don't have WASM!!!"));let i=!1;if(t){if(s){const r=s.origin;l(L,s.basis1,s.basis2),n(L,L),i=t.setAnalysisSlice(this,e,r,L)}else h(L,0,0,1),i=t.setAnalysisSlice(this,!1,L,L);i||this._dbg(x.Error,"VoxelLayerView3D._pushAnalysisSliceToWasm() failed!")}}_updateLayerTimeProperties(){const e=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._updateLayerTimeProperties() called, "+(e?"have WASM":"don't have WASM!!!")),e&&e.updateLayerTimeProperties(this)}_pushEnableDynamicSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableDynamicSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!")}_pushEnableSlicesToWasm(e){const s=f(this.view);if(this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableSlicesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s){const t=this.layer.getVolumeStyles();this._accountForEnableSlices(t,e),s.setVolumeStyles(this,t)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableSlicesToWasm() failed!")}}_pushEnableIsosurfacesToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableIsosurfaces(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!")}_pushEnableSectionsToWasm(e){const s=f(this.view);this._dbg(x.VerboseAPI,"VoxelLayerView3D._pushEnableSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableSections(this,e)||this._dbg(x.Error,"VoxelLayerView3D._pushEnableSectionsToWasm() failed!")}_dbg(e,s){this._dbgFlags.has(e)&&(e===x.Error?t.getLogger(this).error(s):t.getLogger(this).warn(s))}};e([o()],E.prototype,"layer",void 0),e([o()],E.prototype,"baseUrl",null),e([o({type:Boolean})],E.prototype,"slicePlaneEnabled",void 0),e([o({readOnly:!0})],E.prototype,"visibleAtCurrentScale",null),E=e([a("esri.views.3d.layers.VoxelLayerView3D")],E);const M=E;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,j as x,h as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=I(),ii=I(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new y}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,!1),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator||(this._activeIterator=di(this._active)),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator||(this._visibleIterator=di(this._visible)),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator||(this._sortIterator=_i(this._visible,this._sortArray,this.visibilityGroup)),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return void(t.culled=!0);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}null==l?t.culled=!0:(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as I}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,j as x,h as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=y(),ii=y(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new I}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,c.visible),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,a?.visible??!0);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=di(this._active),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator??=di(this._visible),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator??=_i(this._visible,this._sortArray,this.visibilityGroup),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return t.culled=!0,void(t.visible=!1);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}l?(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1):(t.culled=!0,t.visible=!0)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as a}from"../../../../chunks/boundedPlane.js";import{Deconflictor as n,DeconflictorGraphic as o}from"./Deconflictor.js";import{VisibilityGroup as c,VisibilityFlag as h}from"./enums.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as p}from"../../../support/Scheduler.js";let d=class extends n{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=c.GRAPHIC,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add((()=>this.view?.state?.camera),(()=>{this._updateViewState(),this.setDirty()})),this._updatingHandles.add((()=>this.view?.slicePlane),(()=>{this._updateSlicePlane(),this._slicePlaneChanged()}),s),this._frameTask=this.view.resourceController.scheduler.registerTask(p.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){super.runTask(e),this.running||this._labels.setDirty()}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?this.view.slicePlane:null;null!=e&&a(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labels.enabledChanged(e,t),featureReductionChange:()=>this.enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new o(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),m(e)?this.addToActiveGraphics(r):this.addToInactiveGraphics(r),e.labelsEnabled&&this._labels.addToActiveGraphics(r);const a=!this._graphicSupportsDeconfliction(i)||!m(e);i.setVisibilityFlag(c.GRAPHIC,h.DECONFLICTION,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromInactiveGraphics(s),this._labels.removeFromActiveGraphics(s),e.delete(i),this.setDirty())}enabledChanged(e,t){const i=m(e);i||u(e),this.setGraphicsActive(t,i),this.setGraphicsInactive(t,!i)}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach((e=>e.slicePlaneEnabled=i)),this.setDirty()}getGraphicsLayers(e){return e.layers}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function m(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function u(e){const t=e.graphics3DGraphics;t&&t.forEach((e=>e.setVisibilityFlag(c.GRAPHIC,h.DECONFLICTION,!0)))}d=e([r("esri.views.3d.layers.graphics.GraphicsDeconflictor")],d);export{d as GraphicsDeconflictor};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as a}from"../../../../chunks/boundedPlane.js";import{Deconflictor as n,DeconflictorGraphic as o}from"./Deconflictor.js";import{VisibilityGroup as c,VisibilityFlag as h}from"./enums.js";import{LabelDeconflictor as l}from"./LabelDeconflictor.js";import{TaskPriority as p}from"../../../support/Scheduler.js";let d=class extends n{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=c.GRAPHIC,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add((()=>this.view?.state?.camera),(()=>{this._updateViewState(),this.setDirty()})),this._updatingHandles.add((()=>this.view?.slice?.plane),(()=>{this._updateSlicePlane(),this._slicePlaneChanged()}),s),this._frameTask=this.view.resourceController.scheduler.registerTask(p.GRAPHICS_DECONFLICTOR,this),this._labels=new l({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){super.runTask(e),this.running||this._labels.setDirty()}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&a(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labels.enabledChanged(e,t),featureReductionChange:()=>this.enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new o(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),m(e)?this.addToActiveGraphics(r):this.addToInactiveGraphics(r),e.labelsEnabled&&this._labels.addToActiveGraphics(r);const a=!this._graphicSupportsDeconfliction(i)||!m(e);i.setVisibilityFlag(c.GRAPHIC,h.DECONFLICTION,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromInactiveGraphics(s),this._labels.removeFromActiveGraphics(s),e.delete(i),this.setDirty())}enabledChanged(e,t){const i=m(e);i||u(e),this.setGraphicsActive(t,i),this.setGraphicsInactive(t,!i)}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach((e=>e.slicePlaneEnabled=i)),this.setDirty()}getGraphicsLayers(e){return e.layers}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function m(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function u(e){const t=e.graphics3DGraphics;t&&t.forEach((e=>e.setVisibilityFlag(c.GRAPHIC,h.DECONFLICTION,!0)))}d=e([r("esri.views.3d.layers.graphics.GraphicsDeconflictor")],d);export{d as GraphicsDeconflictor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import n from"../../../../../core/Promise.js";import{on as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as l}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as p}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as y}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let h=class extends n{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer:unsupported-symbology-snapping","Symbology snapping not supported")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("featurelayer:unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),o(this._renderer)}async setup(){const{layer:e,view:t,uid:o}=this.layerView,{spatialReference:n,renderSpatialReference:s,resourceController:u,renderCoordsHelper:l,elevationProvider:y}=t,m=t.state.viewingMode;if(this._renderer=new p({view:t,layerViewUid:o}),"feature"!==e.type)throw new r("featurelayer:unsupported-layertype","Only FeatureLayer is supported");const c=new d({schedule:e=>u.immediate.schedule(e),layer:e,viewSpatialReference:n,renderSpatialReference:s,viewingMode:m,renderer:this._renderer,elevationProvider:y,renderCoordsHelper:l});this._workerHandle=await c.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),t.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e))),a((()=>this.layerView.fullOpacity),(e=>this._workerHandle.onLayerOpacityChange(e)),{sync:!0})])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new l(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return y}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("featurelayer:unsupported-elevation-alignment","Elevation alignment not supported")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],h.prototype,"layerView",void 0),e([s()],h.prototype,"updating",null),e([s()],h.prototype,"totalFeatures",null),h=e([u("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],h);export{h as Feature3DPipeline};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import o from"../../../../../core/Promise.js";import{on as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as l}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as p}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as y}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";import{UpdatePolicy as c}from"../../../webgl-engine/lib/UpdatePolicy.js";let h=class extends o{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer:unsupported-symbology-snapping","Symbology snapping not supported")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("featurelayer:unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),n(this._renderer)}async setup(){const{layer:e,view:t,uid:n}=this.layerView,{spatialReference:o,renderSpatialReference:s,resourceController:u,renderCoordsHelper:l,elevationProvider:y}=t,m=t.state.viewingMode;if(this._renderer=new p({view:t,layerViewUid:n}),"feature"!==e.type)throw new r("featurelayer:unsupported-layertype","Only FeatureLayer is supported");const c=new d({schedule:e=>u.immediate.schedule(e),layer:e,viewSpatialReference:o,renderSpatialReference:s,viewingMode:m,renderer:this._renderer,elevationProvider:y,renderCoordsHelper:l});this._workerHandle=await c.when(),this.addHandles([this.layerView.view.featureTiles.addClient(),i((()=>this.layerView.view.featureTiles.tiles),"change",(e=>{this._workerHandle.onTileTreeChange(e)}),{onListenerAdd:e=>this._workerHandle.onTileTreeChange({added:e.toArray(),removed:[]}),onListenerRemove:e=>this._workerHandle.onTileTreeChange({added:[],removed:e.toArray()})}),t.elevationProvider.on("elevation-change",(e=>this._workerHandle.onElevationChange(e))),a((()=>this.layerView.fullOpacity),(e=>this._workerHandle.onLayerOpacityChange(e)),{sync:!1}),a((()=>e.renderer),(e=>this._workerHandle.onRendererChange(e)),{sync:!1})])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return c.ASYNC}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new l(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlight(e){return y}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("featurelayer:unsupported-elevation-alignment","Elevation alignment not supported")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],h.prototype,"layerView",void 0),e([s()],h.prototype,"updating",null),e([s()],h.prototype,"totalFeatures",null),h=e([u("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],h);export{h as Feature3DPipeline};