@arcgis/core 6.0.0-next.35 → 6.0.0-next.37

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 (188) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0202eb8c2b2865f99981.js → 00311d1b18d5952a014b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/0b21d0e2e5a91c34a108.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f717005e14a7e9141df7.js → 2050c844b5a29b1df28a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +1 -0
  6. package/assets/esri/core/workers/chunks/2f9072563194026e320e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d9a240a3c6bf85124474.js → 342a97974a78007b25e0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{4d18b48d4a282a0f341c.js → 427d929dc7f89b0a1ea9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +1 -0
  11. package/assets/esri/core/workers/chunks/46969f379623810b2eca.js +1 -0
  12. package/assets/esri/core/workers/chunks/592b5db1459c02cf6a0c.js +1 -0
  13. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +1 -0
  14. package/assets/esri/core/workers/chunks/{379db67f78161ebd5468.js → 7023651ed6398dcf8efb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{90360c0bd053d3e3fd77.js → 7027a0e7bfabb3bb7fc2.js} +1 -1
  16. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +1 -0
  17. package/assets/esri/core/workers/chunks/{40c2674dae73f0942751.js → 7d497df6e13162156342.js} +1 -1
  18. package/assets/esri/core/workers/chunks/8a3dfe997712dc2ddead.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81bcc495e6eaf2cf7474.js → 8f82a0a6747f673a2a7e.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d3369ffed19f4c264dcd.js → 9ab0735e86cf8932bf9d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +1 -0
  23. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +1 -0
  24. package/assets/esri/core/workers/chunks/{796c6195b6bf59dcc9bd.js → b25a05c58b0fd0f6ac60.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +1 -0
  26. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +1 -0
  27. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +1 -0
  28. package/assets/esri/core/workers/chunks/ce0274847ccce6a1ac53.js +1 -0
  29. package/assets/esri/core/workers/chunks/cf2e5f827cea7d7319ce.js +1 -0
  30. package/assets/esri/core/workers/chunks/dae2036faa28dade2119.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e8fb2ba7b7a4f0916325.js → eed4b90494a54f8b337b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +1 -0
  33. package/chunks/Clouds.glsl.js +7 -11
  34. package/chunks/RibbonLine.glsl.js +158 -84
  35. package/config.js +1 -1
  36. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  37. package/kernel.js +1 -1
  38. package/layers/BaseElevationLayer.js +1 -1
  39. package/layers/ElevationLayer.js +1 -1
  40. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  41. package/layers/IntegratedMeshLayer.d.ts +2 -0
  42. package/layers/IntegratedMeshLayer.js +1 -1
  43. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  44. package/layers/support/ElevationQuery.js +1 -1
  45. package/layers/video/VideoController.js +3 -3
  46. package/layers/video/types.d.ts +12 -0
  47. package/package.json +3 -3
  48. package/support/timeUtils.js +1 -1
  49. package/views/2d/engine/Bitmap.js +1 -1
  50. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  51. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  52. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  53. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  54. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  55. package/views/2d/engine/webgl/Overlay.js +1 -1
  56. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  57. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  58. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  59. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  60. package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
  61. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  71. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  72. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +1 -1
  74. package/views/2d/engine/webgl/textureUtils.js +1 -1
  75. package/views/2d/layers/LayerView2D.js +1 -1
  76. package/views/2d/webglDeps.js +1 -1
  77. package/views/3d/GroundView3D.js +1 -1
  78. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  79. package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
  80. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  81. package/views/3d/input/SceneInputManager.js +1 -1
  82. package/views/3d/interactive/Manipulator3D.js +1 -1
  83. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  84. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  85. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  86. package/views/3d/layers/I3SMeshView3D.js +1 -1
  87. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  88. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  89. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  90. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  91. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  92. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  93. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  94. package/views/3d/support/engineContent/line.js +1 -1
  95. package/views/3d/support/engineContent/marker.js +1 -1
  96. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  97. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  98. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  99. package/views/3d/support/flow/geometryUtils.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  101. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  102. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  103. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  104. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  105. package/views/3d/support/gaussianSplatting/GaussianTileBuilder.js +2 -0
  106. package/views/3d/support/gaussianSplatting/formatConstants.js +2 -0
  107. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  108. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  109. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  110. package/views/3d/terrain/OverlayRenderer.js +1 -1
  111. package/views/3d/terrain/TerrainRenderer.js +1 -1
  112. package/views/3d/terrain/TerrainSurface.js +1 -1
  113. package/views/3d/terrain/TileCompositor.js +1 -1
  114. package/views/3d/terrain/TileRenderer.js +1 -1
  115. package/views/3d/webgl/RenderNode.d.ts +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  117. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  118. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  119. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +15 -11
  121. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  122. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  123. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  124. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  125. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  126. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  127. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  128. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  129. package/views/3d/webgl-engine/lib/AttributeView.js +1 -1
  130. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  131. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  132. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  133. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  134. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  135. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  136. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  137. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  139. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  140. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  141. package/views/3d/webgl-engine/lib/VerticesView.js +2 -0
  142. package/views/3d/webgl-engine/lib/attributeViewUtils.js +1 -1
  143. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  144. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  145. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  146. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  148. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  149. package/views/3d/webgl-engine/materials/internal/lineMarkerBufferUtils.js +2 -0
  150. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +2 -0
  151. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  152. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  153. package/views/draw/DrawTool.js +1 -1
  154. package/views/draw/support/ManagedTooltipField.js +1 -1
  155. package/views/support/TextureCompressionHelper.js +1 -1
  156. package/views/support/imageReprojection.js +1 -1
  157. package/views/webgl/FramebufferObject.js +1 -1
  158. package/views/webgl/RenderingContext.js +1 -1
  159. package/views/webgl/Texture.js +1 -1
  160. package/views/webgl/rasterUtils.js +1 -1
  161. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  162. package/views/webgl/textureUtils.js +1 -1
  163. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  164. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  165. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  166. package/widgets/OrientedImageryViewer.js +2 -2
  167. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
  168. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +0 -1
  169. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +0 -1
  170. package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +0 -1
  171. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +0 -1
  172. package/assets/esri/core/workers/chunks/3223f9fbc76ba9ef8d13.js +0 -1
  173. package/assets/esri/core/workers/chunks/3fdcc383bbd9cf0d274c.js +0 -1
  174. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +0 -1
  175. package/assets/esri/core/workers/chunks/48b8b57f559a53c6c513.js +0 -1
  176. package/assets/esri/core/workers/chunks/4a979fce1c971b614a18.js +0 -1
  177. package/assets/esri/core/workers/chunks/5bd1414220e42cb8ebcf.js +0 -1
  178. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +0 -1
  179. package/assets/esri/core/workers/chunks/723df53cfa0189837d01.js +0 -1
  180. package/assets/esri/core/workers/chunks/7400b8c454b47ee4fb3c.js +0 -1
  181. package/assets/esri/core/workers/chunks/7af4edc6e87d27b9d467.js +0 -1
  182. package/assets/esri/core/workers/chunks/990e96139b5a1dccb061.js +0 -1
  183. package/assets/esri/core/workers/chunks/a607541959169741a943.js +0 -1
  184. package/assets/esri/core/workers/chunks/aa779896fd9e5c341349.js +0 -1
  185. package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +0 -1
  186. package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +0 -1
  187. package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +0 -1
  188. package/views/3d/webgl-engine/lib/GaussianSplatPrepassDepthRenderer.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../../../../../core/has.js";import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{Technique as t}from"../Technique.js";import{TextureStatisticsTechnique as n}from"../TextureStatisticsTechnique.js";import{getInterpolationDefines as r}from"./processor/textureUtils.js";import{RasterColorizerLUTShader as i}from"../shaders/raster/RasterColorizerLUTShader.js";import{RasterColorizerShadedReliefShader as a}from"../shaders/raster/RasterColorizerShadedReliefShader.js";import{RasterColorizerStretchShader as o}from"../shaders/raster/RasterColorizerStretchShader.js";import{SizedPixelFormat as s,PixelType as c}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as l}from"../../../../../../webgl/FramebufferObject.js";import u from"../../../../../../webgl/Texture.js";import{TextureDescriptor as d}from"../../../../../../webgl/TextureDescriptor.js";const f=new Set([`f32`,`f64`,`u16`,`s16`,`u32`,`s32`]);class p extends t{constructor(){super(...arguments),this.name=`BrushRasterColorizer`,this.type=0,this.shaders={lut:new i,stretch:new o,shadedRelief:new a},this._mosaicFbo=null,this._statisticsTechnique=null,this._draTimer=0}shutdown(t){super.shutdown(t),this._mosaicFbo=e(this._mosaicFbo),this._statisticsTechnique=e(this._statisticsTechnique)}render(t,n){let r=n.tiles.some(({bitmap:e})=>h(e));r||(this._mosaicFbo=e(this._mosaicFbo),this._statisticsTechnique=e(this._statisticsTechnique));let i=r?this._computeStatisticsTextures(t,n):void 0;for(let e of n.tiles){let{bitmap:n}=e;if(!n.source||n.suspended)continue;t.timeline.begin(this.name);let{painter:r}=t;r.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:`composite`}}),n.updateTexture(t),n.updateProcessedTexture(),e.bind(t.context);let{type:a}=n.symbolizerParameters,o=a===`stretch`?this._getStretchOptions(e,i):a===`lut`?this._getLutOptions(e):this._getShadedReliefOptions(e);n.interpolation===`bilinear`&&!t.context.capabilities.textureFloatLinear&&(o.defines.bilinear=!0),r.submitDrawMesh(t.context,o,r.quadMesh,n),t.timeline.end(this.name)}}_computeStatisticsTextures(e,t){this._statisticsTechnique??=new n;let r=this._statisticsTechnique,i=has(`esri-2d-dra-delay`);if(i==null){let e=t.tiles.find(({bitmap:e})=>h(e)).bitmap,{stretchType:n,bandCount:r}=e.symbolizerParameters,{pixelType:a}=e.source;n===`minMax`&&r>=3&&f.has(a)&&(i=160)}if(i){let n=performance.now();(n-this._draTimer>=i||e.stationary||!r.minValuesTexture)&&(this._mosaic(e,t),r.render(e,{fbo:this._mosaicFbo}),this._draTimer=n)}else this._mosaic(e,t),r.render(e,{fbo:this._mosaicFbo});return{minTexture:r.minValuesTexture,maxTexture:r.maxValuesTexture,meanTexture:r.meanValuesTexture,stddevTexture:r.stdDevValuesTexture}}_mosaic(e,t){let{context:n,painter:r}=e,i=n.boundFramebuffer;if(i==null)return;if(this._mosaicFbo)this._mosaicFbo.resize(i.width,i.height);else{let e=m(n,i.width,i.height);this._mosaicFbo=new l(n,e)}n.bindFramebuffer(this._mosaicFbo);let a=`RasterColorizerMosaic`;for(let n of t.tiles){let{bitmap:t}=n;if(!h(t))continue;e.timeline.begin(a),r.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:`composite`}});let i=t.interpolation;t.interpolation=`nearest`,t.updateTexture(e),t.updateProcessedTexture(),n.bind(e.context);let o=this._getStretchOptions(n,void 0,!0);o.defines.noOp=!0,r.submitDrawMesh(e.context,o,r.quadMesh,t),t.interpolation=i,e.timeline.end(a)}n.bindFramebuffer(i)}_getLutOptions(e){let{bitmap:t}=e,{config:n,projectionConfig:i,projectionTextures:a,colormapConfig:o,colormapTextures:s,textures:c,projectionDefines:l}=this._getCommonConfig(t),u=r(t);return{shader:this.shaders.lut,uniforms:{projectionConfig:i,config:n,colormapConfig:o},textures:{...c,projectionTextures:a,colormapTextures:s},defines:{...l,...u,applyPixelMask:!!c.pixelMaskTexture,applyPixelHighlights:!!c.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getStretchOptions(e,t,n=!1){let{bitmap:i}=e,a=i.symbolizerParameters,{config:o,projectionConfig:s,projectionTextures:c,colormapConfig:l,colormapTextures:u,textures:d,projectionDefines:f,textureUnit:p}=this._getCommonConfig(i),m=r(i),h=t?{numberOfStandardDeviations:a.numberOfStandardDeviations||2}:void 0,g=t?{minTexture:{texture:t.minTexture,unit:p},maxTexture:{texture:t.maxTexture,unit:p+1},meanTexture:{texture:t.meanTexture,unit:p+2},stddevTexture:{texture:t.stddevTexture,unit:p+3}}:void 0,_=t?a.stretchType===`standardDeviation`?2:1:0;return{shader:this.shaders.stretch,uniforms:{projectionConfig:s,config:o,stretchConfig:a,colormapConfig:l,statisticsConfig:h},textures:{...d,projectionTextures:c,colormapTextures:u,statisticsTextures:g},defines:{...f,...m,isMultiband:a.bandCount>1,applyColormap:!!l,useGamma:a.useGamma,noOp:i.isRenderedSource&&!i.processed,applyPixelMask:!!d.pixelMaskTexture,applyPixelHighlights:!n&&!!d.highlightTexture,draStretchType:_},optionalAttributes:null,useComputeBuffer:!1}}_getShadedReliefOptions(e){let{bitmap:t}=e,n=t.symbolizerParameters,{config:i,projectionConfig:a,projectionTextures:o,colormapConfig:s,colormapTextures:c,textures:l,projectionDefines:u}=this._getCommonConfig(t),d=r(t);return{shader:this.shaders.shadedRelief,uniforms:{projectionConfig:a,config:i,hillshadeConfig:n,colormapConfig:s},textures:{...l,projectionTextures:o,colormapTextures:c},defines:{...u,...d,isMultidirectional:n.hillshadeType>0,applyColormap:!!s,applyPixelMask:!!l.pixelMaskTexture,applyPixelHighlights:!!l.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getCommonConfig(e){let{coordScale:t,computedOpacity:n}=e,{names:r,textures:i}=e.getTextures({useProcessedTexture:e.processed}),a=i[r.indexOf(`u_image`)],o=e.getRasterTextureSize(),s=0,c={coordScale:t,srcImageSize:o,opacity:n},l={texture:{texture:a,unit:s++},pixelMaskTexture:null,highlightTexture:null},u=i[r.indexOf(`u_transformGrid`)],{transformGrid:d}=e,f=!!(u&&d),p=f?{targetImageSize:[e.width,e.height],transformSpacing:d.spacing,transformGridSize:d.size}:void 0,m=f?{transformTexture:{texture:u,unit:s++}}:void 0,h=i[r.indexOf(`u_colormap`)],{colormap:g,colormapOffset:_}=e.symbolizerParameters,v=h&&g?{colormapOffset:_??0,colormapMaxIndex:g.length/4-1}:void 0,y=h&&g?{colormapTexture:{texture:h,unit:s++}}:void 0,b=i[r.indexOf(`u_mask`)];b&&(l.pixelMaskTexture={texture:b,unit:s++});let{highlightTexture:x}=e;return x&&(l.highlightTexture={texture:x,unit:s++}),{config:c,projectionConfig:p,projectionTextures:m,colormapConfig:v,colormapTextures:y,textures:l,projectionDefines:{applyProjection:f,lookupProjection:f&&d.spacing[0]===1},textureUnit:s}}}function m(e,t,n){let r=new d(t,n);return r.internalFormat=s.RGBA32F,r.samplingMode=9728,r.dataType=c.FLOAT,r.wrapMode=33071,new u(e,r)}function h(e){return!e.suspended&&e.source!=null&&!e.isRenderedSource&&e.symbolizerParameters.type===`stretch`&&!!e.symbolizerParameters.dynamicRangeAdjustment}export{p as RasterColorizerTechnique};
2
+ import has from"../../../../../../../core/has.js";import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{Technique as t}from"../Technique.js";import{TextureStatisticsTechnique as n}from"../TextureStatisticsTechnique.js";import{getInterpolationDefines as r}from"./processor/textureUtils.js";import{RasterColorizerLUTShader as i}from"../shaders/raster/RasterColorizerLUTShader.js";import{RasterColorizerShadedReliefShader as a}from"../shaders/raster/RasterColorizerShadedReliefShader.js";import{RasterColorizerStretchShader as o}from"../shaders/raster/RasterColorizerStretchShader.js";import{SizedPixelFormat as s,PixelType as c}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as l}from"../../../../../../webgl/FramebufferObject.js";import{Texture as u}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as d}from"../../../../../../webgl/TextureDescriptor.js";const f=new Set([`f32`,`f64`,`u16`,`s16`,`u32`,`s32`]);class p extends t{constructor(){super(...arguments),this.name=`BrushRasterColorizer`,this.type=0,this.shaders={lut:new i,stretch:new o,shadedRelief:new a},this._mosaicFbo=null,this._statisticsTechnique=null,this._draTimer=0}shutdown(t){super.shutdown(t),this._mosaicFbo=e(this._mosaicFbo),this._statisticsTechnique=e(this._statisticsTechnique)}render(t,n){let r=n.tiles.some(({bitmap:e})=>h(e));r||(this._mosaicFbo=e(this._mosaicFbo),this._statisticsTechnique=e(this._statisticsTechnique));let i=r?this._computeStatisticsTextures(t,n):void 0;for(let e of n.tiles){let{bitmap:n}=e;if(!n.source||n.suspended)continue;t.timeline.begin(this.name);let{painter:r}=t;r.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:`composite`}}),n.updateTexture(t),n.updateProcessedTexture(),e.bind(t.context);let{type:a}=n.symbolizerParameters,o=a===`stretch`?this._getStretchOptions(e,i):a===`lut`?this._getLutOptions(e):this._getShadedReliefOptions(e);n.interpolation===`bilinear`&&!t.context.capabilities.textureFloatLinear&&(o.defines.bilinear=!0),r.submitDrawMesh(t.context,o,r.quadMesh,n),t.timeline.end(this.name)}}_computeStatisticsTextures(e,t){this._statisticsTechnique??=new n;let r=this._statisticsTechnique,i=has(`esri-2d-dra-delay`);if(i==null){let e=t.tiles.find(({bitmap:e})=>h(e)).bitmap,{stretchType:n,bandCount:r}=e.symbolizerParameters,{pixelType:a}=e.source;n===`minMax`&&r>=3&&f.has(a)&&(i=160)}if(i){let n=performance.now();(n-this._draTimer>=i||e.stationary||!r.minValuesTexture)&&(this._mosaic(e,t),r.render(e,{fbo:this._mosaicFbo}),this._draTimer=n)}else this._mosaic(e,t),r.render(e,{fbo:this._mosaicFbo});return{minTexture:r.minValuesTexture,maxTexture:r.maxValuesTexture,meanTexture:r.meanValuesTexture,stddevTexture:r.stdDevValuesTexture}}_mosaic(e,t){let{context:n,painter:r}=e,i=n.boundFramebuffer;if(i==null)return;if(this._mosaicFbo)this._mosaicFbo.resize(i.width,i.height);else{let e=m(n,i.width,i.height);this._mosaicFbo=new l(n,e)}n.bindFramebuffer(this._mosaicFbo);let a=`RasterColorizerMosaic`;for(let n of t.tiles){let{bitmap:t}=n;if(!h(t))continue;e.timeline.begin(a),r.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:`composite`}});let i=t.interpolation;t.interpolation=`nearest`,t.updateTexture(e),t.updateProcessedTexture(),n.bind(e.context);let o=this._getStretchOptions(n,void 0,!0);o.defines.noOp=!0,r.submitDrawMesh(e.context,o,r.quadMesh,t),t.interpolation=i,e.timeline.end(a)}n.bindFramebuffer(i)}_getLutOptions(e){let{bitmap:t}=e,{config:n,projectionConfig:i,projectionTextures:a,colormapConfig:o,colormapTextures:s,textures:c,projectionDefines:l}=this._getCommonConfig(t),u=r(t);return{shader:this.shaders.lut,uniforms:{projectionConfig:i,config:n,colormapConfig:o},textures:{...c,projectionTextures:a,colormapTextures:s},defines:{...l,...u,applyPixelMask:!!c.pixelMaskTexture,applyPixelHighlights:!!c.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getStretchOptions(e,t,n=!1){let{bitmap:i}=e,a=i.symbolizerParameters,{config:o,projectionConfig:s,projectionTextures:c,colormapConfig:l,colormapTextures:u,textures:d,projectionDefines:f,textureUnit:p}=this._getCommonConfig(i),m=r(i),h=t?{numberOfStandardDeviations:a.numberOfStandardDeviations||2}:void 0,g=t?{minTexture:{texture:t.minTexture,unit:p},maxTexture:{texture:t.maxTexture,unit:p+1},meanTexture:{texture:t.meanTexture,unit:p+2},stddevTexture:{texture:t.stddevTexture,unit:p+3}}:void 0,_=t?a.stretchType===`standardDeviation`?2:1:0;return{shader:this.shaders.stretch,uniforms:{projectionConfig:s,config:o,stretchConfig:a,colormapConfig:l,statisticsConfig:h},textures:{...d,projectionTextures:c,colormapTextures:u,statisticsTextures:g},defines:{...f,...m,isMultiband:a.bandCount>1,applyColormap:!!l,useGamma:a.useGamma,noOp:i.isRenderedSource&&!i.processed,applyPixelMask:!!d.pixelMaskTexture,applyPixelHighlights:!n&&!!d.highlightTexture,draStretchType:_},optionalAttributes:null,useComputeBuffer:!1}}_getShadedReliefOptions(e){let{bitmap:t}=e,n=t.symbolizerParameters,{config:i,projectionConfig:a,projectionTextures:o,colormapConfig:s,colormapTextures:c,textures:l,projectionDefines:u}=this._getCommonConfig(t),d=r(t);return{shader:this.shaders.shadedRelief,uniforms:{projectionConfig:a,config:i,hillshadeConfig:n,colormapConfig:s},textures:{...l,projectionTextures:o,colormapTextures:c},defines:{...u,...d,isMultidirectional:n.hillshadeType>0,applyColormap:!!s,applyPixelMask:!!l.pixelMaskTexture,applyPixelHighlights:!!l.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getCommonConfig(e){let{coordScale:t,computedOpacity:n}=e,{names:r,textures:i}=e.getTextures({useProcessedTexture:e.processed}),a=i[r.indexOf(`u_image`)],o=e.getRasterTextureSize(),s=0,c={coordScale:t,srcImageSize:o,opacity:n},l={texture:{texture:a,unit:s++},pixelMaskTexture:null,highlightTexture:null},u=i[r.indexOf(`u_transformGrid`)],{transformGrid:d}=e,f=!!(u&&d),p=f?{targetImageSize:[e.width,e.height],transformSpacing:d.spacing,transformGridSize:d.size}:void 0,m=f?{transformTexture:{texture:u,unit:s++}}:void 0,h=i[r.indexOf(`u_colormap`)],{colormap:g,colormapOffset:_}=e.symbolizerParameters,v=h&&g?{colormapOffset:_??0,colormapMaxIndex:g.length/4-1}:void 0,y=h&&g?{colormapTexture:{texture:h,unit:s++}}:void 0,b=i[r.indexOf(`u_mask`)];b&&(l.pixelMaskTexture={texture:b,unit:s++});let{highlightTexture:x}=e;return x&&(l.highlightTexture={texture:x,unit:s++}),{config:c,projectionConfig:p,projectionTextures:m,colormapConfig:v,colormapTextures:y,textures:l,projectionDefines:{applyProjection:f,lookupProjection:f&&d.spacing[0]===1},textureUnit:s}}}function m(e,t,n){let r=new d(t,n);return r.internalFormat=s.RGBA32F,r.samplingMode=9728,r.dataType=c.FLOAT,r.wrapMode=33071,new u(e,r)}function h(e){return!e.suspended&&e.source!=null&&!e.isRenderedSource&&e.symbolizerParameters.type===`stretch`&&!!e.symbolizerParameters.dynamicRangeAdjustment}export{p as RasterColorizerTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{tileSize as e}from"../../../definitions.js";import{Technique as t}from"../Technique.js";import{getInterpolationDefines as n}from"./processor/textureUtils.js";import{RasterRangeHighlightShader as r}from"../shaders/raster/RasterRangeHighlightShader.js";import{RasterXYBandHighlightShader as i}from"../shaders/raster/RasterXYBandHighlightShader.js";import{SizedPixelFormat as a,PixelType as o}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as s}from"../../../../../../webgl/FramebufferObject.js";import c from"../../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../../webgl/TextureDescriptor.js";class u extends t{constructor(){super(...arguments),this.name=`BrushRasterHighlight`,this.type=2,this.shaders={range:new r,xyBand:new i}}shutdown(e){super.shutdown(e),this._fbo?.dispose(),this._fbo=void 0}_getBandIds(e,t){let{type:n}=e,r=n===`xy-band`?e.bandIds:[e.bandId];return t?.length?r.map(e=>t.indexOf(e)):n===`xy-band`?[0,1]:[0]}_getSingleBandShaderOptions(e,t,r,i){let{config:a,projectionConfig:o,projectionTextures:s,textures:c,projectionDefines:l}=this._getCommonConfig(t),u=n(t,i),d={bandSwap:r,ranges:e.ranges,color:e.color};return{shader:this.shaders.range,uniforms:{projectionConfig:o,config:a,rangeHighlightConfig:d},textures:{...c,projectionTextures:s},defines:{...l,...u,applyPixelMask:!1,applyPixelHighlights:!1,hasExistingHighlights:!!c.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getXYBandShaderOptions(e,t,r,i,a){let{config:o,projectionConfig:s,projectionTextures:c,textures:l,projectionDefines:u}=this._getCommonConfig(t),d=n(t,i),f={bandSwap:r,xRange:e.xRange,yRange:e.yRange,color:e.color},p=a?{texture:a,unit:4}:void 0;return{shader:this.shaders.xyBand,uniforms:{projectionConfig:s,config:o,xyRangeHighlightConfig:f},textures:{...l,projectionTextures:c,xyMaskHighlightTexture:p},defines:{...u,...d,applyPixelMask:!1,applyPixelHighlights:!1,hasExistingHighlights:!!l.highlightTexture,useMask:!!p},optionalAttributes:null,useComputeBuffer:!1}}render(t,n){let{pixelHighlightOptions:r}=t;if(!r)return;let{context:i}=t;if(!this._fbo){let n=d(t.context,e,e);this._fbo=new s(i,n)}let{type:a}=r,o=a===`xy-band`?f(t.context,r):void 0,c=i.boundFramebuffer,l=i.getViewport();for(let s of n.bitmaps){if(!s.source||s.highlighted||s.suspended||s.isRenderedSource)continue;let n=this._getBandIds(r,s.bandIds);if(n.some(e=>e<0||e>2))continue;t.timeline.begin(this.name);let{painter:c}=t;c.setPipelineState({depth:!1,stencil:{test:!1,write:!1},color:{write:[!0,!0,!0,!0],blendMode:`custom`,blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},blendEquation:32774}}),s.updateTexture(t),s.updateProcessedTexture(!1);let l=new Float32Array(9);l[n[0]*3]=1,l[n[1]*3+1]=+(a===`xy-band`);let u=a===`single-band`?this._getSingleBandShaderOptions(r,s,l,i):this._getXYBandShaderOptions(r,s,l,i,o);i.bindFramebuffer(this._fbo),i.setViewport(0,0,e,e),c.submitDrawMesh(t.context,u,c.quadMesh);let f=d(t.context,e,e);this._fbo.copyToTexture(0,0,e,e,0,0,f),s.highlightTexture=f,t.timeline.end(this.name)}o?.dispose(),i.bindFramebuffer(c),i.setViewport(l.x,l.y,l.width,l.height)}_getCommonConfig(e){let{names:t,textures:n}=e.getTextures({forProcessing:!0,useProcessedTexture:e.processed}),r=n[t.indexOf(`u_image`)],i={coordScale:[1,1],srcImageSize:e.getRasterTextureSize(),opacity:1},a={texture:{texture:r,unit:0},pixelMaskTexture:null,highlightTexture:null},o=n[t.indexOf(`u_transformGrid`)],{transformGrid:s}=e,c=!!(o&&s),l=c?{targetImageSize:[e.width,e.height],transformSpacing:s.spacing,transformGridSize:s.size}:void 0,u=c?{transformTexture:{texture:o,unit:1}}:void 0,{highlightTexture:d}=e;return d&&(a.highlightTexture={texture:d,unit:2}),{config:i,projectionConfig:l,projectionTextures:u,textures:a,projectionDefines:{applyProjection:c,lookupProjection:c&&s.spacing[0]===1}}}}function d(e,t,n){let r=new l(t,n);return r.internalFormat=a.RGBA8,r.samplingMode=9728,r.dataType=o.UNSIGNED_BYTE,r.isImmutable=!0,r.wrapMode=33071,new c(e,r)}function f(e,t){let{mask:n,maskSize:r}=t;if(!(n?.length&&r?.length))return;let i=new l(r[0],r[1]);return i.internalFormat=a.R8,i.samplingMode=9728,i.dataType=o.UNSIGNED_BYTE,i.isImmutable=!0,i.wrapMode=33071,new c(e,i,n)}export{u as RasterHighlightTechnique};
2
+ import{tileSize as e}from"../../../definitions.js";import{Technique as t}from"../Technique.js";import{getInterpolationDefines as n}from"./processor/textureUtils.js";import{RasterRangeHighlightShader as r}from"../shaders/raster/RasterRangeHighlightShader.js";import{RasterXYBandHighlightShader as i}from"../shaders/raster/RasterXYBandHighlightShader.js";import{SizedPixelFormat as a,PixelType as o}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as s}from"../../../../../../webgl/FramebufferObject.js";import{Texture as c}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../../webgl/TextureDescriptor.js";class u extends t{constructor(){super(...arguments),this.name=`BrushRasterHighlight`,this.type=2,this.shaders={range:new r,xyBand:new i}}shutdown(e){super.shutdown(e),this._fbo?.dispose(),this._fbo=void 0}_getBandIds(e,t){let{type:n}=e,r=n===`xy-band`?e.bandIds:[e.bandId];return t?.length?r.map(e=>t.indexOf(e)):n===`xy-band`?[0,1]:[0]}_getSingleBandShaderOptions(e,t,r,i){let{config:a,projectionConfig:o,projectionTextures:s,textures:c,projectionDefines:l}=this._getCommonConfig(t),u=n(t,i),d={bandSwap:r,ranges:e.ranges,color:e.color};return{shader:this.shaders.range,uniforms:{projectionConfig:o,config:a,rangeHighlightConfig:d},textures:{...c,projectionTextures:s},defines:{...l,...u,applyPixelMask:!1,applyPixelHighlights:!1,hasExistingHighlights:!!c.highlightTexture},optionalAttributes:null,useComputeBuffer:!1}}_getXYBandShaderOptions(e,t,r,i,a){let{config:o,projectionConfig:s,projectionTextures:c,textures:l,projectionDefines:u}=this._getCommonConfig(t),d=n(t,i),f={bandSwap:r,xRange:e.xRange,yRange:e.yRange,color:e.color},p=a?{texture:a,unit:4}:void 0;return{shader:this.shaders.xyBand,uniforms:{projectionConfig:s,config:o,xyRangeHighlightConfig:f},textures:{...l,projectionTextures:c,xyMaskHighlightTexture:p},defines:{...u,...d,applyPixelMask:!1,applyPixelHighlights:!1,hasExistingHighlights:!!l.highlightTexture,useMask:!!p},optionalAttributes:null,useComputeBuffer:!1}}render(t,n){let{pixelHighlightOptions:r}=t;if(!r)return;let{context:i}=t;if(!this._fbo){let n=d(t.context,e,e);this._fbo=new s(i,n)}let{type:a}=r,o=a===`xy-band`?f(t.context,r):void 0,c=i.boundFramebuffer,l=i.getViewport();for(let s of n.bitmaps){if(!s.source||s.highlighted||s.suspended||s.isRenderedSource)continue;let n=this._getBandIds(r,s.bandIds);if(n.some(e=>e<0||e>2))continue;t.timeline.begin(this.name);let{painter:c}=t;c.setPipelineState({depth:!1,stencil:{test:!1,write:!1},color:{write:[!0,!0,!0,!0],blendMode:`custom`,blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},blendEquation:32774}}),s.updateTexture(t),s.updateProcessedTexture(!1);let l=new Float32Array(9);l[n[0]*3]=1,l[n[1]*3+1]=+(a===`xy-band`);let u=a===`single-band`?this._getSingleBandShaderOptions(r,s,l,i):this._getXYBandShaderOptions(r,s,l,i,o);i.bindFramebuffer(this._fbo),i.setViewport(0,0,e,e),c.submitDrawMesh(t.context,u,c.quadMesh);let f=d(t.context,e,e);this._fbo.copyToTexture(0,0,e,e,0,0,f),s.highlightTexture=f,t.timeline.end(this.name)}o?.dispose(),i.bindFramebuffer(c),i.setViewport(l.x,l.y,l.width,l.height)}_getCommonConfig(e){let{names:t,textures:n}=e.getTextures({forProcessing:!0,useProcessedTexture:e.processed}),r=n[t.indexOf(`u_image`)],i={coordScale:[1,1],srcImageSize:e.getRasterTextureSize(),opacity:1},a={texture:{texture:r,unit:0},pixelMaskTexture:null,highlightTexture:null},o=n[t.indexOf(`u_transformGrid`)],{transformGrid:s}=e,c=!!(o&&s),l=c?{targetImageSize:[e.width,e.height],transformSpacing:s.spacing,transformGridSize:s.size}:void 0,u=c?{transformTexture:{texture:o,unit:1}}:void 0,{highlightTexture:d}=e;return d&&(a.highlightTexture={texture:d,unit:2}),{config:i,projectionConfig:l,projectionTextures:u,textures:a,projectionDefines:{applyProjection:c,lookupProjection:c&&s.spacing[0]===1}}}}function d(e,t,n){let r=new l(t,n);return r.internalFormat=a.RGBA8,r.samplingMode=9728,r.dataType=o.UNSIGNED_BYTE,r.isImmutable=!0,r.wrapMode=33071,new c(e,r)}function f(e,t){let{mask:n,maskSize:r}=t;if(!(n?.length&&r?.length))return;let i=new l(r[0],r[1]);return i.internalFormat=a.R8,i.samplingMode=9728,i.dataType=o.UNSIGNED_BYTE,i.isImmutable=!0,i.wrapMode=33071,new c(e,i,n)}export{u as RasterHighlightTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{SizedPixelFormat as e,PixelType as t}from"../../../../../../../webgl/enums.js";import{DisposableFramebufferObject as n}from"../../../../../../../webgl/FramebufferObject.js";import r from"../../../../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../../../../webgl/TextureDescriptor.js";function a(n,r){let a=new i(n,r);return a.internalFormat=e.RGBA32F,a.samplingMode=9728,a.dataType=t.FLOAT,a.isImmutable=!0,a.wrapMode=33071,a}function o(e,t,n){let i=a(t,n);return new r(e,i)}function s(e,t,r){let i=a(t,r);return new n(e,i)}function c(e,t){let{symbolizerParameters:n}=e,{type:r}=n,i=r===`lut`?`nearest`:e.interpolation,a=i===`bilinear`?r===`lut`?!1:r!==`stretch`||n.bandCount===1:!1,o=i===`cubic`;return{bilinear:a||i===`bilinear`&&t!=null&&!t.capabilities.textureFloatLinear,bicubic:o,nearestOnEdge:a}}export{s as createNewFBO,o as createProcessedTexture,c as getInterpolationDefines};
2
+ import{SizedPixelFormat as e,PixelType as t}from"../../../../../../../webgl/enums.js";import{DisposableFramebufferObject as n}from"../../../../../../../webgl/FramebufferObject.js";import{Texture as r}from"../../../../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../../../../webgl/TextureDescriptor.js";function a(n,r){let a=new i(n,r);return a.internalFormat=e.RGBA32F,a.samplingMode=9728,a.dataType=t.FLOAT,a.isImmutable=!0,a.wrapMode=33071,a}function o(e,t,n){let i=a(t,n);return new r(e,i)}function s(e,t,r){let i=a(t,r);return new n(e,i)}function c(e,t){let{symbolizerParameters:n}=e,{type:r}=n,i=r===`lut`?`nearest`:e.interpolation,a=i===`bilinear`?r===`lut`?!1:r!==`stretch`||n.bandCount===1:!1,o=i===`cubic`;return{bilinear:a||i===`bilinear`&&t!=null&&!t.capabilities.textureFloatLinear,bicubic:o,nearestOnEdge:a}}export{s as createNewFBO,o as createProcessedTexture,c as getInterpolationDefines};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../../webgl/Texture.js";import{TextureDescriptor as t}from"../../../../../../webgl/TextureDescriptor.js";class n{shutdown(){this._ctx=null}getTexture(n,r){if(!this._ctx){let e=document.createElement(`canvas`);e.width=512,e.height=512,this._ctx=e.getContext(`2d`)}if(!r.tileDebugInfoTexture){let i=new t(512,512);i.wrapMode=33071,i.samplingMode=9729,i.isImmutable=!0,r.tileDebugInfoTexture=new e(n,i)}let i=this._ctx;i.clearRect(0,0,i.canvas.width,i.canvas.height),i.textAlign=`left`,i.textBaseline=`top`,i.font=`14px sans-serif`,i.lineWidth=2,i.fillStyle=`white`,i.strokeStyle=`black`;let{debugSlot:a}=r,o=8+99.2*a,s=`${a}) ${r.key.id} (${r.constructor.name})`;i.strokeText(s,8,o),i.fillText(s,8,o),o+=16;let{debugInfo:c}=r;if(c){let{length:e,minOrderedLength:t,minUnorderedLength:n,triangleCount:r}=c.display;if(e>0){let t=`Length: ${e}`;i.strokeText(t,8,o),i.fillText(t,8,o),o+=16}if(t){let e=`Min ordered length: ${t}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}if(n){let e=`Min unordered length: ${n}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}if(r>0){r>1e5&&(i.fillStyle=`red`,i.strokeStyle=`white`);let e=`Triangle count: ${r}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}let{bytesUsed:a,bytesReserved:s}=c.memory;if(i.fillStyle=`white`,i.strokeStyle=`black`,a>0||s>0){let e=`Memory usage: ${a} of ${s} bytes`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}}return r.tileDebugInfoTexture.setData(i.canvas),r.tileDebugInfoTexture}}export{n as TileDebugInfoTexture};
2
+ import{Texture as e}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as t}from"../../../../../../webgl/TextureDescriptor.js";class n{shutdown(){this._ctx=null}getTexture(n,r){if(!this._ctx){let e=document.createElement(`canvas`);e.width=512,e.height=512,this._ctx=e.getContext(`2d`)}if(!r.tileDebugInfoTexture){let i=new t(512,512);i.wrapMode=33071,i.samplingMode=9729,i.isImmutable=!0,r.tileDebugInfoTexture=new e(n,i)}let i=this._ctx;i.clearRect(0,0,i.canvas.width,i.canvas.height),i.textAlign=`left`,i.textBaseline=`top`,i.font=`14px sans-serif`,i.lineWidth=2,i.fillStyle=`white`,i.strokeStyle=`black`;let{debugSlot:a}=r,o=8+99.2*a,s=`${a}) ${r.key.id} (${r.constructor.name})`;i.strokeText(s,8,o),i.fillText(s,8,o),o+=16;let{debugInfo:c}=r;if(c){let{length:e,minOrderedLength:t,minUnorderedLength:n,triangleCount:r}=c.display;if(e>0){let t=`Length: ${e}`;i.strokeText(t,8,o),i.fillText(t,8,o),o+=16}if(t){let e=`Min ordered length: ${t}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}if(n){let e=`Min unordered length: ${n}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}if(r>0){r>1e5&&(i.fillStyle=`red`,i.strokeStyle=`white`);let e=`Triangle count: ${r}`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}let{bytesUsed:a,bytesReserved:s}=c.memory;if(i.fillStyle=`white`,i.strokeStyle=`black`,a>0||s>0){let e=`Memory usage: ${a} of ${s} bytes`;i.strokeText(e,8,o),i.fillText(e,8,o),o+=16}}return r.tileDebugInfoTexture.setData(i.canvas),r.tileDebugInfoTexture}}export{n as TileDebugInfoTexture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import e from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import"../../../../core/memoryEstimations.js";import"../../../webgl/enums.js";import"../../../webgl/Util.js";import{TextureDescriptor as t}from"../../../webgl/TextureDescriptor.js";function n(n,r,i){let a=new t(r.width,r.height);return a.dataType=r.dataType,r.depth&&(a.depth=r.depth),r.flipped&&(a.flipped=r.flipped),r.hasMipmap&&(a.hasMipmap=r.hasMipmap),a.internalFormat=r.internalFormat,r.isImmutable&&(a.isImmutable=r.isImmutable),r.isOpaque&&(a.isOpaque=r.isOpaque),r.maxAnisotropy&&(a.maxAnisotropy=r.maxAnisotropy),a.pixelFormat=r.pixelFormat,r.preMultiplyAlpha&&(a.preMultiplyAlpha=r.preMultiplyAlpha),r.samplingMode&&(a.samplingMode=r.samplingMode),r.target&&(a.target=r.target),r.unpackAlignment&&(a.unpackAlignment=r.unpackAlignment),r.wrapMode&&(a.wrapMode=r.wrapMode),new e(n,a,i)}export{n as createTexture};
2
+ import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as e}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import"../../../../core/memoryEstimations.js";import"../../../webgl/enums.js";import"../../../webgl/Util.js";import{TextureDescriptor as t}from"../../../webgl/TextureDescriptor.js";function n(n,r,i){let a=new t(r.width,r.height);return a.dataType=r.dataType,r.depth&&(a.depth=r.depth),r.flipped&&(a.flipped=r.flipped),r.hasMipmap&&(a.hasMipmap=r.hasMipmap),a.internalFormat=r.internalFormat,r.isImmutable&&(a.isImmutable=r.isImmutable),r.isOpaque&&(a.isOpaque=r.isOpaque),r.maxAnisotropy&&(a.maxAnisotropy=r.maxAnisotropy),a.pixelFormat=r.pixelFormat,r.preMultiplyAlpha&&(a.preMultiplyAlpha=r.preMultiplyAlpha),r.samplingMode&&(a.samplingMode=r.samplingMode),r.target&&(a.target=r.target),r.unpackAlignment&&(a.unpackAlignment=r.unpackAlignment),r.wrapMode&&(a.wrapMode=r.wrapMode),new e(n,a,i)}export{n as createTexture};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{referenceSetter as n}from"../../../core/collectionUtils.js";import{deprecatedFunction as r}from"../../../core/deprecate.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{watch as o,syncAndInitial as s,sync as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{isInEffectiveScaleRange as d}from"../../../geometry/support/scaleUtils.js";import{isLinkChartView as f}from"../../../linkChart/guards.js";import{Container as p}from"../engine/Container.js";import{ClipMesh as m}from"../engine/webgl/ClipMesh.js";import{maxHighlightGroups as h}from"../engine/webgl/definitions.js";import{HighlightRegistry as g}from"./support/HighlightRegistry.js";import{createOrReuseHighlightGradient as _}from"./support/util.js";import v from"../../layers/support/ClipRect.js";import y from"../../layers/support/GeometryClipArea.js";import b from"../../layers/support/Path.js";import{defaultHighlightName as x}from"../../support/HighlightDefaults.js";import S from"../../support/HighlightOptions.js";const C=t.ofType({key:`type`,base:null,typeMap:{rect:v,path:b,geometry:y}}),w=new(t.ofType(S)),T=v=>{let y=v,b=class extends y{constructor(){super(...arguments),this._highlightRegistry=new g,this.attached=!1,this.clips=new C,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){let e=this.view?.spatialReferenceLocked??!0;this.view?.spatialReference&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new i(`layerview:spatial-reference-incompatible`,`The spatial reference of this layer does not meet the requirements of the view`,{layer:this.layer}))):(this.container||=new p,this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,e=>{this.container&&(this.container.visible=!e)},s),o(()=>this.updateSuspended,e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()},s),o(()=>this.layer?.opacity??1,e=>{this.container&&(this.container.opacity=e)},s),o(()=>this.layer&&`blendMode`in this.layer?this.layer.blendMode:`normal`,e=>{this.container&&(this.container.blendMode=e)},s),o(()=>this.layer&&`effect`in this.layer?this.layer.effect:null,e=>{this.container&&(this.container.effect=e)},s),o(()=>this._effectiveHighlightOptions.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{this.container.highlightGradient=_(this.container.highlightGradient,this._effectiveHighlightOptions.items)},s),o(()=>this._getHighlightFilterGroups(),()=>this._onHighlightChange(),c),o(()=>this.clips.map(e=>e.version),async()=>{if(this.container&&this.view?.spatialReference){let e=this.view.featuresTilingScheme,t=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(t=>m.create(t,e))));for(let e of this.container.clips)e.destroy();this.container.clips=t.filter(e=>!!e)}},s),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null}),({scale:e,scaleRange:t})=>{let n=d(t,e);n!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=n)},s),o(()=>this.layer?.effectiveVisible,async e=>{this.container.requestDeclutter()})],`constructor`),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(e=>{e===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(let e of this.container?.clips??[])e.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:e})=>e===x)}set highlightOptions(e){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!e)return;this.highlights=new t([new S])}let n=this.highlights.find(({name:e})=>e===x);e?n?.assignFrom(e):(this.highlights.remove(n),this.highlights.length===0&&(this.highlights=null))}_logHighlightOptionsDeprecation(){r(a.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:`View.highlights`,version:`4.34`,see:`https://arcg.is/inbTa1#highlights`,warnOnce:!0})}get hasHighlight(){return this._highlightRegistry.size>0}get _effectiveHighlightOptions(){if(!this.view)return w;if(!this.highlights)return this.view.highlights;let e=this.view.highlights.clone();for(let t of this.highlights){let n=e.find(e=>e.name===t.name);n&&n.assignFrom(t)}return e}get highlightIds(){return this._highlightRegistry.highlightIds}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){let e=this.view?.spatialReference;return e==null||this.supportsSpatialReference(e)}get updating(){return this.spatialReferenceSupported?this.attached?this.suspended?!1:this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning:!0:!1}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles(`attach`),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(e){this.isFulfilled()&&!this.isResolved()?this.updateRequested=!1:(this._set(`updateParameters`,e),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(e)))}hitTest(e,t,n){return Promise.resolve(null)}supportsSpatialReference(e){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case`link-chart`:case`knowledge-graph-sublayer`:case`graphics`:break;default:if(f(this.view)&&!this.view.inGeographicLayout)return!1}return super.canResume()?this.visibleAtCurrentScale:!1}getSuspendInfo(){let e=super.getSuspendInfo(),t=!this.spatialReferenceSupported;return t&&(e.spatialReferenceNotSupported=t),e}addAttachHandles(e){this.addHandles(e,`attach`)}_addHighlightFilter(e,t){return this._highlightRegistry.register(t,e)}_removeHighlight(e){this._highlightRegistry.unregister(e)}_onHighlightChange(){}_getHighlightFilterGroups(){let e=[];for(let{name:t,filters:n}of this._highlightRegistry.highlightGroups){let r=this._effectiveHighlightOptions.findIndex(e=>e.name===t);r<0||r>=h||e.push({order:r,filters:n})}return e}};return e([l()],b.prototype,`attached`,void 0),e([l({type:C,set(e){let t=n(e,this._get(`clips`),C);this._set(`clips`,t)}})],b.prototype,`clips`,void 0),e([l()],b.prototype,`container`,void 0),e([l({type:S})],b.prototype,`highlightOptions`,null),e([l({type:t.ofType(S)})],b.prototype,`highlights`,void 0),e([l()],b.prototype,`_effectiveHighlightOptions`,null),e([l()],b.prototype,`moving`,void 0),e([l({readOnly:!0})],b.prototype,`spatialReferenceSupported`,null),e([l({readOnly:!0})],b.prototype,`updateParameters`,void 0),e([l()],b.prototype,`updateRequested`,void 0),e([l()],b.prototype,`updating`,null),e([l()],b.prototype,`view`,void 0),e([l()],b.prototype,`_visibleAtCurrentScale`,void 0),e([l({readOnly:!0})],b.prototype,`visibleAtCurrentScale`,null),b=e([u(`esri.views.2d.layers.LayerView2D`)],b),b};export{T as LayerView2D};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{referenceSetter as n}from"../../../core/collectionUtils.js";import{deprecatedFunction as r}from"../../../core/deprecate.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{watch as o,syncAndInitial as s,sync as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{isInEffectiveScaleRange as d}from"../../../geometry/support/scaleUtils.js";import{isLinkChartView as f}from"../../../linkChart/guards.js";import{Container as p}from"../engine/Container.js";import{ClipMesh as m}from"../engine/webgl/ClipMesh.js";import{maxHighlightGroups as h}from"../engine/webgl/definitions.js";import{HighlightRegistry as g}from"./support/HighlightRegistry.js";import{createOrReuseHighlightGradient as _}from"./support/util.js";import v from"../../layers/support/ClipRect.js";import y from"../../layers/support/GeometryClipArea.js";import b from"../../layers/support/Path.js";import{defaultHighlightName as x}from"../../support/HighlightDefaults.js";import S from"../../support/HighlightOptions.js";const C=t.ofType({key:`type`,base:null,typeMap:{rect:v,path:b,geometry:y}}),w=new(t.ofType(S)),T=v=>{let y=v,b=class extends y{constructor(){super(...arguments),this._clipUpdateId=0,this._highlightRegistry=new g,this.attached=!1,this.clips=new C,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){let e=this.view?.spatialReferenceLocked??!0;this.view?.spatialReference&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new i(`layerview:spatial-reference-incompatible`,`The spatial reference of this layer does not meet the requirements of the view`,{layer:this.layer}))):(this.container||=new p,this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,e=>{this.container&&(this.container.visible=!e)},s),o(()=>this.updateSuspended,e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()},s),o(()=>this.layer?.opacity??1,e=>{this.container&&(this.container.opacity=e)},s),o(()=>this.layer&&`blendMode`in this.layer?this.layer.blendMode:`normal`,e=>{this.container&&(this.container.blendMode=e)},s),o(()=>this.layer&&`effect`in this.layer?this.layer.effect:null,e=>{this.container&&(this.container.effect=e)},s),o(()=>this._effectiveHighlightOptions.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{this.container.highlightGradient=_(this.container.highlightGradient,this._effectiveHighlightOptions.items)},s),o(()=>this._getHighlightFilterGroups(),()=>this._onHighlightChange(),c),o(()=>this.clips.map(e=>e.version),async()=>{let e=++this._clipUpdateId;if(this.container&&this.view?.spatialReference){let t=this.view.featuresTilingScheme,n=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(e=>m.create(e,t))));if(this.destroyed||e!==this._clipUpdateId){for(let e of n)e?.destroy();return}for(let e of this.container.clips)e.destroy();this.container.clips=n.filter(e=>!!e)}},s),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null}),({scale:e,scaleRange:t})=>{let n=d(t,e);n!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=n)},s),o(()=>this.layer?.effectiveVisible,async e=>{this.container.requestDeclutter()})],`constructor`),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(e=>{e===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(let e of this.container?.clips??[])e.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:e})=>e===x)}set highlightOptions(e){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!e)return;this.highlights=new t([new S])}let n=this.highlights.find(({name:e})=>e===x);e?n?.assignFrom(e):(this.highlights.remove(n),this.highlights.length===0&&(this.highlights=null))}_logHighlightOptionsDeprecation(){r(a.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:`View.highlights`,version:`4.34`,see:`https://arcg.is/inbTa1#highlights`,warnOnce:!0})}get hasHighlight(){return this._highlightRegistry.size>0}get _effectiveHighlightOptions(){if(!this.view)return w;if(!this.highlights)return this.view.highlights;let e=this.view.highlights.clone();for(let t of this.highlights){let n=e.find(e=>e.name===t.name);n&&n.assignFrom(t)}return e}get highlightIds(){return this._highlightRegistry.highlightIds}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){let e=this.view?.spatialReference;return e==null||this.supportsSpatialReference(e)}get updating(){return this.spatialReferenceSupported?this.attached?this.suspended?!1:this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning:!0:!1}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles(`attach`),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(e){this.isFulfilled()&&!this.isResolved()?this.updateRequested=!1:(this._set(`updateParameters`,e),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(e)))}hitTest(e,t,n){return Promise.resolve(null)}supportsSpatialReference(e){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case`link-chart`:case`knowledge-graph-sublayer`:case`graphics`:break;default:if(f(this.view)&&!this.view.inGeographicLayout)return!1}return super.canResume()?this.visibleAtCurrentScale:!1}getSuspendInfo(){let e=super.getSuspendInfo(),t=!this.spatialReferenceSupported;return t&&(e.spatialReferenceNotSupported=t),e}addAttachHandles(e){this.addHandles(e,`attach`)}_addHighlightFilter(e,t){return this._highlightRegistry.register(t,e)}_removeHighlight(e){this._highlightRegistry.unregister(e)}_onHighlightChange(){}_getHighlightFilterGroups(){let e=[];for(let{name:t,filters:n}of this._highlightRegistry.highlightGroups){let r=this._effectiveHighlightOptions.findIndex(e=>e.name===t);r<0||r>=h||e.push({order:r,filters:n})}return e}};return e([l()],b.prototype,`attached`,void 0),e([l({type:C,set(e){let t=n(e,this._get(`clips`),C);this._set(`clips`,t)}})],b.prototype,`clips`,void 0),e([l()],b.prototype,`container`,void 0),e([l({type:S})],b.prototype,`highlightOptions`,null),e([l({type:t.ofType(S)})],b.prototype,`highlights`,void 0),e([l()],b.prototype,`_effectiveHighlightOptions`,null),e([l()],b.prototype,`moving`,void 0),e([l({readOnly:!0})],b.prototype,`spatialReferenceSupported`,null),e([l({readOnly:!0})],b.prototype,`updateParameters`,void 0),e([l()],b.prototype,`updateRequested`,void 0),e([l()],b.prototype,`updating`,null),e([l()],b.prototype,`view`,void 0),e([l()],b.prototype,`_visibleAtCurrentScale`,void 0),e([l({readOnly:!0})],b.prototype,`visibleAtCurrentScale`,null),b=e([u(`esri.views.2d.layers.LayerView2D`)],b),b};export{T as LayerView2D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- export{BufferObject}from"../webgl/BufferObject.js";export{FramebufferObject}from"../webgl/FramebufferObject.js";export{DisposableProgram}from"../webgl/Program.js";export{ProgramCache}from"../webgl/ProgramCache.js";export{Renderbuffer}from"../webgl/Renderbuffer.js";export{default as Texture}from"../webgl/Texture.js";export{VertexArrayObject}from"../webgl/VertexArrayObject.js";export{glslifyDefineMap}from"../webgl/programUtils.js";export{createProgram}from"../webgl/ProgramTemplate.js";
2
+ export{BufferObject}from"../webgl/BufferObject.js";export{FramebufferObject}from"../webgl/FramebufferObject.js";export{DisposableProgram}from"../webgl/Program.js";export{ProgramCache}from"../webgl/ProgramCache.js";export{Renderbuffer}from"../webgl/Renderbuffer.js";export{Texture}from"../webgl/Texture.js";export{VertexArrayObject}from"../webgl/VertexArrayObject.js";export{glslifyDefineMap}from"../webgl/programUtils.js";export{createProgram}from"../webgl/ProgramTemplate.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import has from"../../core/has.js";import{when as n,watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{create as s,equals as c,intersection as l,union as u}from"../../geometry/support/aaBoundingRect.js";import d from"../GroundView.js";import{ElevationRange as f}from"./support/ElevationRange.js";import{toBoundingRect as p}from"./support/extentUtils.js";import{webMercatorWorldExtent as m,geographicWorldExtent as h}from"./terrain/TerrainConst.js";import{isIntegratedMeshLayerView as g}from"../support/layerViewUtils.js";const _=Symbol(`integrated-mesh-elevation-providers`);let v=class extends t(d){initialize(){super.initialize(),this.addHandles(n(()=>this._terrainSurface,e=>e.on(`elevation-change`,e=>this._elevationChange(e)))),r(()=>[this.view?.basemapView?.groundLayerViews.toArray(),this.layerViews.toArray()],()=>{this.removeHandles(_),this.addHandles(this._integratedMeshGroundLayerViews.map(({elevationProvider:e})=>e.on(`elevation-change`,e=>this._elevationChange(e))),_)},i),this.addHandles([r(()=>this.memoizedElevationQueryDependencies,()=>{this.emit(`elevation-query-change`)})])}get memoizedElevationQueryDependencies(){return(this.ground?.allLayers??[]).filter(e=>e.type===`elevation`||e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain).map(e=>e.memoizedElevationQueryDependencies)}_elevationChange(e){this.emit(`elevation-change`,e)}get _integratedMeshGroundLayerViews(){return has(`enable-feature:im-as-ground`)?[...this.view?.basemapView?.groundLayerViews.filter(g)??[],...this.layerViews.filter(g)]:[...this.view?.basemapView?.groundLayerViews.filter(g).filter(e=>e.replacesTerrain)??[]]}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return!this.hasTerrainReplacement&&(this._terrainSurface?.enabled??!1)}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){let{spatialReference:e}=this,{clippingArea:t}=this.view;if(t==null||e==null)return null;let n=s(),r=p(t,n,e)?n:null,i=this._get(`userClippingExtent`);return c(r,i)?i:r}isUpdating(){return this._usingTerrain&&this._terrainSurface.updating||super.isUpdating()}getElevation(e,t,n,r){let i=this._usingTerrain?this._terrainSurface?.getElevation(e,t,n,r):null;return this._integratedMeshGroundLayerViews.reduce((i,a)=>{let o=a.elevationProvider.getElevation(e,t,n,r);return o==null?i:Math.max(o,i??o)},i)}getElevations(e,t,n){let r=this.view.groundSpatialReference;if(r==null)for(let e=0;e<t;++e)n(e,null);else for(let i=0;i<t;++i){let t=i*3;n(i,this.getElevation(e[t],e[t+1],e[t+2],r))}}intersect(e,t,n,r){this._usingTerrain&&this._terrainSurface.intersect(e,t,n,r),this._integratedMeshGroundLayerViews.forEach(i=>i.intersect(e,t,n,r))}getSphereElevationRange(e,t,n){let r=this._usingTerrain?this._terrainSurface?.getSphereElevationRange?.(e,t):null;return this._integratedMeshGroundLayerViews.reduce((n,r)=>{let i=r.elevationProvider.getSphereElevationRange?.(e,t);return i==null||(n??=new f,n.expandElevationRange(i)),n},r?new f(r.minElevation,r.maxElevation):null)}getRootElevationRange(){let e=this._usingTerrain?this._terrainSurface?.getRootElevationRange?.():null;return this._integratedMeshGroundLayerViews.reduce((e,t)=>{let n=t.elevationProvider.getRootElevationRange?.();return n==null||(e??=new f,e.expandElevationRange(n)),e},e?new f(e.minElevation,e.maxElevation):null)}get elevationQueryCache(){let e=this.view?.basemapTerrain;return e?.enabled?e.elevationQueryCache:null}get elevationQueryReady(){for(let e of this.ground?.allLayers??[])if(e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain&&e.loadStatus!==`failed`&&e.queryElevationCallback==null)return!1;return!0}get groundExtent(){let{fullGroundExtent:e}=this;return e?this.userClippingExtent?l(e,this.userClippingExtent,s()):this.fullGroundExtent:null}get fullGroundExtent(){let e=this._usingTerrain?this._terrainSurface.fullGroundExtent:null;if(this._integratedMeshGroundLayerViews.length===0)return e;let t=this.view.spatialReference;if(!t.isWebMercator&&!t.isWGS84)return e;let n=b(t);return e?u(e,n,s()):n}get visibleElevationRange(){let e=this._usingTerrain?this._terrainSurface.visibleElevationRange:null;return this._integratedMeshGroundLayerViews.reduce((e,t)=>e==null?new f(t.visibleElevationRange.minElevation,t.visibleElevationRange.maxElevation):(e.expandElevationRange(t.visibleElevationRange),e),e?new f(e.minElevation,e.maxElevation):null)??y}get opaque(){return this._usingTerrain&&this._terrainSurface.opaque||this._integratedMeshGroundLayerViews.some(({opaque:e})=>e)}get invisible(){return(!this._usingTerrain||this._terrainSurface.invisible)&&this._integratedMeshGroundLayerViews.every(({invisible:e})=>e)}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return this._usingTerrain?this._terrainSurface?.wireframe??!1:!1}get freeze(){return this._usingTerrain&&(this._terrainSurface?.freeze??!1)||this._integratedMeshGroundLayerViews.some(e=>e.type===`integrated-mesh-3dtiles`&&e.freeze)}set freeze(e){this._usingTerrain&&(this._terrainSurface.freeze=e),this._integratedMeshGroundLayerViews.forEach(t=>{t.type===`integrated-mesh-3dtiles`&&(t.freeze=e)})}get suspended(){return(!this._usingTerrain||super.suspended)&&this._integratedMeshGroundLayerViews.length>0&&this._integratedMeshGroundLayerViews.every(({suspended:e})=>e)}get ready(){return!this._usingTerrain&&this._integratedMeshGroundLayerViews.length===0?!1:(!this._usingTerrain||this._terrainSurface.ready)&&this._integratedMeshGroundLayerViews.every(({ready:e})=>e)}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([a()],v.prototype,`memoizedElevationQueryDependencies`,null),e([a({readOnly:!0})],v.prototype,`_integratedMeshGroundLayerViews`,null),e([a({readOnly:!0})],v.prototype,`_terrainSurface`,null),e([a({readOnly:!0})],v.prototype,`_usingTerrain`,null),e([a({readOnly:!0})],v.prototype,`spatialReference`,null),e([a({readOnly:!0})],v.prototype,`userClippingExtent`,null),e([a({readOnly:!0})],v.prototype,`elevationQueryCache`,null),e([a()],v.prototype,`elevationQueryReady`,null),e([a({readOnly:!0})],v.prototype,`groundExtent`,null),e([a({readOnly:!0})],v.prototype,`fullGroundExtent`,null),e([a({readOnly:!0})],v.prototype,`visibleElevationRange`,null),e([a({readOnly:!0})],v.prototype,`opaque`,null),e([a({readOnly:!0})],v.prototype,`invisible`,null),e([a({readOnly:!0})],v.prototype,`baseOpacity`,null),e([a({readOnly:!0})],v.prototype,`wireframe`,null),e([a()],v.prototype,`freeze`,null),e([a({readOnly:!0})],v.prototype,`suspended`,null),e([a({readOnly:!0})],v.prototype,`ready`,null),v=e([o(`esri.views.3d.GroundView3D`)],v);const y=new f(0,0);function b(e){return e.isWebMercator?m:h}export{v as GroundView3D};
2
+ import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import has from"../../core/has.js";import{when as n,watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{create as s,equals as c,intersection as l,union as u}from"../../geometry/support/aaBoundingRect.js";import d from"../GroundView.js";import{ElevationRange as f}from"./support/ElevationRange.js";import{toBoundingRect as p}from"./support/extentUtils.js";import{webMercatorWorldExtent as m,geographicWorldExtent as h}from"./terrain/TerrainConst.js";import{isIntegratedMeshLayerView as g}from"../support/layerViewUtils.js";const _=Symbol(`integrated-mesh-elevation-providers`);let v=class extends t(d){initialize(){super.initialize(),this.addHandles(n(()=>this._terrainSurface,e=>e.on(`elevation-change`,e=>this._elevationChange(e)))),r(()=>[this.view?.basemapView?.groundLayerViews.toArray(),this.layerViews.toArray()],()=>{this.removeHandles(_),this.addHandles(this._integratedMeshGroundLayerViews.map(({elevationProvider:e})=>e.on(`elevation-change`,e=>this._elevationChange(e))),_)},i),this.addHandles([r(()=>this.memoizedElevationQueryDependencies,()=>{this.emit(`elevation-query-change`)})])}get memoizedElevationQueryDependencies(){return(this.ground?.allLayers??[]).filter(e=>e.type===`elevation`||e.type===`integrated-mesh`||e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain).map(e=>e.memoizedElevationQueryDependencies)}_elevationChange(e){this.emit(`elevation-change`,e)}get _integratedMeshGroundLayerViews(){return has(`enable-feature:im-as-ground`)?[...this.view?.basemapView?.groundLayerViews.filter(g)??[],...this.layerViews.filter(g)]:[...this.view?.basemapView?.groundLayerViews.filter(g).filter(e=>e.replacesTerrain)??[]]}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return!this.hasTerrainReplacement&&(this._terrainSurface?.enabled??!1)}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){let{spatialReference:e}=this,{clippingArea:t}=this.view;if(t==null||e==null)return null;let n=s(),r=p(t,n,e)?n:null,i=this._get(`userClippingExtent`);return c(r,i)?i:r}isUpdating(){return this._usingTerrain&&this._terrainSurface.updating||super.isUpdating()}getElevation(e,t,n,r){let i=this._usingTerrain?this._terrainSurface?.getElevation(e,t,n,r):null;return this._integratedMeshGroundLayerViews.reduce((i,a)=>{let o=a.elevationProvider.getElevation(e,t,n,r);return o==null?i:Math.max(o,i??o)},i)}getElevations(e,t,n){let r=this.view.groundSpatialReference;if(r==null)for(let e=0;e<t;++e)n(e,null);else for(let i=0;i<t;++i){let t=i*3;n(i,this.getElevation(e[t],e[t+1],e[t+2],r))}}intersect(e,t,n,r){this._usingTerrain&&this._terrainSurface.intersect(e,t,n,r),this._integratedMeshGroundLayerViews.forEach(i=>i.intersect(e,t,n,r))}getSphereElevationRange(e,t,n){let r=this._usingTerrain?this._terrainSurface?.getSphereElevationRange?.(e,t):null;return this._integratedMeshGroundLayerViews.reduce((n,r)=>{let i=r.elevationProvider.getSphereElevationRange?.(e,t);return i==null||(n??=new f,n.expandElevationRange(i)),n},r?new f(r.minElevation,r.maxElevation):null)}getRootElevationRange(){let e=this._usingTerrain?this._terrainSurface?.getRootElevationRange?.():null;return this._integratedMeshGroundLayerViews.reduce((e,t)=>{let n=t.elevationProvider.getRootElevationRange?.();return n==null||(e??=new f,e.expandElevationRange(n)),e},e?new f(e.minElevation,e.maxElevation):null)}get elevationQueryCache(){let e=this.view?.basemapTerrain;return e?.enabled?e.elevationQueryCache:null}get elevationQueryReady(){for(let e of this.ground?.allLayers??[])if(e.type===`integrated-mesh-3dtiles`&&e.replacesTerrain&&e.loadStatus!==`failed`&&e.queryElevationCallback==null)return!1;return!0}get groundExtent(){let{fullGroundExtent:e}=this;return e?this.userClippingExtent?l(e,this.userClippingExtent,s()):this.fullGroundExtent:null}get fullGroundExtent(){let e=this._usingTerrain?this._terrainSurface.fullGroundExtent:null;if(this._integratedMeshGroundLayerViews.length===0)return e;let t=this.view.spatialReference;if(!t.isWebMercator&&!t.isWGS84)return e;let n=b(t);return e?u(e,n,s()):n}get visibleElevationRange(){let e=this._usingTerrain?this._terrainSurface.visibleElevationRange:null;return this._integratedMeshGroundLayerViews.reduce((e,t)=>e==null?new f(t.visibleElevationRange.minElevation,t.visibleElevationRange.maxElevation):(e.expandElevationRange(t.visibleElevationRange),e),e?new f(e.minElevation,e.maxElevation):null)??y}get opaque(){return this._usingTerrain&&this._terrainSurface.opaque||this._integratedMeshGroundLayerViews.some(({opaque:e})=>e)}get invisible(){return(!this._usingTerrain||this._terrainSurface.invisible)&&this._integratedMeshGroundLayerViews.every(({invisible:e})=>e)}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return this._usingTerrain?this._terrainSurface?.wireframe??!1:!1}get freeze(){return this._usingTerrain&&(this._terrainSurface?.freeze??!1)||this._integratedMeshGroundLayerViews.some(e=>e.type===`integrated-mesh-3dtiles`&&e.freeze)}set freeze(e){this._usingTerrain&&(this._terrainSurface.freeze=e),this._integratedMeshGroundLayerViews.forEach(t=>{t.type===`integrated-mesh-3dtiles`&&(t.freeze=e)})}get suspended(){return(!this._usingTerrain||super.suspended)&&this._integratedMeshGroundLayerViews.length>0&&this._integratedMeshGroundLayerViews.every(({suspended:e})=>e)}get ready(){return!this._usingTerrain&&this._integratedMeshGroundLayerViews.length===0?!1:(!this._usingTerrain||this._terrainSurface.ready)&&this._integratedMeshGroundLayerViews.every(({ready:e})=>e)}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([a()],v.prototype,`memoizedElevationQueryDependencies`,null),e([a({readOnly:!0})],v.prototype,`_integratedMeshGroundLayerViews`,null),e([a({readOnly:!0})],v.prototype,`_terrainSurface`,null),e([a({readOnly:!0})],v.prototype,`_usingTerrain`,null),e([a({readOnly:!0})],v.prototype,`spatialReference`,null),e([a({readOnly:!0})],v.prototype,`userClippingExtent`,null),e([a({readOnly:!0})],v.prototype,`elevationQueryCache`,null),e([a()],v.prototype,`elevationQueryReady`,null),e([a({readOnly:!0})],v.prototype,`groundExtent`,null),e([a({readOnly:!0})],v.prototype,`fullGroundExtent`,null),e([a({readOnly:!0})],v.prototype,`visibleElevationRange`,null),e([a({readOnly:!0})],v.prototype,`opaque`,null),e([a({readOnly:!0})],v.prototype,`invisible`,null),e([a({readOnly:!0})],v.prototype,`baseOpacity`,null),e([a({readOnly:!0})],v.prototype,`wireframe`,null),e([a()],v.prototype,`freeze`,null),e([a({readOnly:!0})],v.prototype,`suspended`,null),e([a({readOnly:!0})],v.prototype,`ready`,null),v=e([o(`esri.views.3d.GroundView3D`)],v);const y=new f(0,0);function b(e){return e.isWebMercator?m:h}export{v as GroundView3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{EventedAccessor as i}from"../../../../core/Evented.js";import a from"../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s}from"../../../../core/handleUtils.js";import c from"../../../../core/Logger.js";import{abortMaybe as l}from"../../../../core/maybe.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{initial as d,on as f}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{copy as h,subtract as g,normalize as _,scale as v,add as y,dist as b,sub as x}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Point.js";import{projectOrLoad as T}from"../../../../geometry/projectionUtils.js";import{intersectsSegment as E}from"../../../../geometry/support/aaBoundingBox.js";import{empty as D,intersectsSegment as O}from"../../../../geometry/support/aaBoundingRect.js";import{create as k,fromPoints as A}from"../../../../geometry/support/ray.js";import{zValueInAbsoluteHeightMode as j}from"../../../../support/elevationInfoUtils.js";import M from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as N}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as P}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as F}from"../support/projectionUtils.js";import{projectElevationUpdateExtent as I,containsElevationUpdatePoint as L}from"../../support/elevationUpdateExtentUtils.js";import{toGraphic as R}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as z,TaskPriority as B}from"../../../support/Scheduler.js";let V=class extends i{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode=`absolute-height`,this._observerFeatureId=null,this._updatingHandles=new C,this._frameTask=z,this._computationHandles=new a,this._externalObserverUpdate=!0}initialize(){let e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(B.LINE_OF_SIGHT_TOOL):z,this._intersector=new P({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){let t=e.computation,{inputPoints:n,computationResult:r}=t,{observerAdjusted:i,targetAdjusted:a}=n,{start:o,end:s}=r;h(o,i),h(s,a),this._canCompute(t)?this._computeIntersection(e):W(e),t.notifyResultChanged(),this.emit(`result-changed`,{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){let{view:n}=this,{inputPoints:r}=e,{observer:i,target:a,observerAdjusted:o,targetAdjusted:s}=r;h(o,i),h(s,a),t(n,this._intersector.intersector,r);let{observerSurfaceNormal:c,targetSurfaceNormal:l}=r,u=this._screenPixelSize,d=K;c==null?g(d,s,o):h(d,c);let f=u;_(d,d),v(d,d,Math.min(f,1)),y(o,o,d),l==null?g(d,o,s):h(d,l);let p=n.state.camera.computeScreenPixelSizeAt(s);_(d,d),v(d,d,Math.min(p,1)),y(s,s,d)}_computeIntersection({computation:e,interpolationInfo:t}){let{view:n}=this,{sceneIntersectionHelper:r,renderCoordsHelper:i}=n;if(r==null)return;let a=this._intersector.intersector,{computationResult:o,inputPoints:s}=e,{observer:c,target:l}=s,{start:u,end:d}=o,f=A(u,d,q);a.options.store=0,r.intersectToolIntersectorRay(f,a);let p=a.results.min,m=o.intersection,g=K,_=p!=null&&p.getIntersectionPoint(m),v=!0;if(_){h(t.originalIntersection,m),h(t.originalObserver,u),h(t.originalTarget,d),i.fromRenderCoords(m,g,n.spatialReference);let e=1-b(d,l)/b(u,l);v=b(c,m)>=e*b(c,l)}let y=new w(g,n.spatialReference);{let{result:t,target:r}=e;t==null?e.result=new M({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:v?null:R(p,n),intersectedLocation:v?null:y,visible:v}):(t.target=r,t.intersectedGraphic=v?null:R(p,n),t.intersectedLocation=v?null:y,t.visible=v)}o.isValid=s.isValid=!0,o.isTargetVisible=v}_canCompute(e){let t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(t==null||e.elevationAlignedTargetLocation==null||n==null)return!1;let{observerAdjusted:r,targetAdjusted:i}=e.inputPoints,a=n.intersectsPoint(r),o=n.intersectsPoint(i);return a&&o}_onObserverPositionChange(e,t,r,i,a){if(this._externalObserverUpdate=a,e==null){this.analysisViewData.elevationAlignedObserver=null,this._observerFeatureId=null;return}if(t==null){F(this.analysis,e.spatialReference,c.getLogger(this)),this.analysisViewData.elevationAlignedObserver=null;return}let o=H(t,r),{absoluteZ:s,elevation:l}=j(t.x,t.y,t.z,this.view.spatialReference,this.view,o),u=t.clone();u.z=s,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=u;let d=S();this.view.renderCoordsHelper.toRenderCoords(u,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=s-l,this._observerFeatureId=n(i),this.priority=B.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i){let{inputPoints:a}=e;switch(h(a.observer,t),a.observerFeatureId=i,a.observerSurfaceNormal=null,r){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(a.observer,n,a.observer);a.observerFeatureId??(a.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=B.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,r,i,a,o=!0){let s=e.inputPoints;if(o&&(s.isValid=!1),r==null){t!=null&&F(this.analysis,t.spatialReference,c.getLogger(this)),e.elevationAlignedTargetLocation=null,e.notifyInputPointsChanged();return}let l=H(r,i),{absoluteZ:u,elevation:d}=j(r.x,r.y,r.z,this.view.spatialReference,this.view,l),f=r.clone();switch(f.z=u,e.elevationAlignedTargetLocation=f,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,s.target),s.targetFeatureId=n(a),s.targetSurfaceNormal=null,l.mode){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(s.target,u-d,s.target);s.targetFeatureId??(s.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=B.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return o([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfoDependency:U(e.target.elevationInfo),targetFeatureInfo:e.target.feature,projectedTargetPosition:T(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetFeatureInfo:n,projectedTargetPosition:r})=>{r.pending==null?this._onTargetPositionChange(e,t,r.geometry,e.target.elevationInfo,n):this._updatingHandles.consumePromise(r.pending)},d)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:r,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i)},d)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){let t=(n,r)=>{let i=this.analysis.observer,a=e.target,o=null,s=null,c=null,l=null,u=null,d=null;if(i?.position!=null){let e=T(i.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}o=e.geometry,s=i.elevationInfo,c=i.feature}if(a.position!=null){let e=T(a.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}l=e.geometry,u=a.elevationInfo,d=a.feature}(o!=null||l!=null)&&(I(n,r,J,this.view.spatialReference),o!=null&&L(J,o.x,o.y,this.view.spatialReference)&&this._onObserverPositionChange(i==null?null:i.position,o,s,c,!1),l!=null&&L(J,l.x,l.y,this.view.spatialReference)&&this._onTargetPositionChange(e,a.position,l,u,d,!1),o!=null&&l!=null&&O(J,o,l)&&e.notifyInputPointsChanged())};return this.view.elevationProvider.on(`elevation-change`,({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null,n={computation:e,interpolationInfo:{originalIntersection:S(),originalObserver:S(),originalTarget:S()}};return o([this._updatingHandles.add(()=>e.inputPoints,()=>{t=l(t),t=r(async e=>{await u(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),s(()=>t=l(t))])}_connectComputationToContent(e){return f(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,`request-update`,t=>{let n=t?.renderBounds,{observerAdjusted:r,targetAdjusted:i}=e.inputPoints;(n==null||E(n,r,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){let t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(let e of t)this._disconnectComputation(e);for(let t of e)this._connectComputation(t)}_onTargetCollectionChange({added:e,removed:t}){for(let e of t)this._removeTarget(e);for(let t of e)this._addTarget(t)}_onCursorTargetChange(e,t){t!=null&&this._removeTarget(t),e!=null&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new N({target:e}))}_removeTarget(e){let t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return o([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer==null?null:this.analysis.observer.position,projectedObserverPosition:T(this.analysis.observer==null?null:this.analysis.observer.position,this.view.spatialReference),observerElevationInfoDependency:U(this.analysis.observer?.elevationInfo),observerFeatureInfo:this.analysis.observer==null?null:this.analysis.observer.feature}),({observerPosition:e,projectedObserverPosition:t,observerFeatureInfo:n})=>{t.pending==null?this._onObserverPositionChange(e,t.geometry,this.analysis.observer?.elevationInfo,n,!0):this._updatingHandles.consumePromise(t.pending)},d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return o([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){let e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(e==null)return!1;let r=K;n.toRenderCoords(e,r);let i=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>G}};e([p({constructOnly:!0})],V.prototype,`analysis`,void 0),e([p({constructOnly:!0})],V.prototype,`analysisViewData`,void 0),e([p({constructOnly:!0})],V.prototype,`view`,void 0),e([p()],V.prototype,`updating`,null),e([p()],V.prototype,`priority`,null),e([p()],V.prototype,`updateOnCameraChange`,void 0),e([p()],V.prototype,`_computations`,null),e([p()],V.prototype,`_elevationAlignedObserverPositionRenderSpace`,null),e([p()],V.prototype,`_observerGroundOffsetRenderSpace`,void 0),e([p()],V.prototype,`_effectiveObserverElevationMode`,void 0),e([p()],V.prototype,`_observerFeatureId`,void 0),e([p()],V.prototype,`_screenPixelSize`,null),e([p({readOnly:!0})],V.prototype,`_updatingHandles`,void 0),e([p()],V.prototype,`_frameTask`,void 0),e([p()],V.prototype,`_isCameraDirty`,null),V=e([m(`esri.views.3d.analysis.LineOfSight.LineOfSightController`)],V);function H(e,t){return e.hasZ?t??{mode:`absolute-height`,offset:0}:{mode:`on-the-ground`,offset:0}}function U(e){return{mode:e?.mode,offset:e?.offset,unit:e?.unit}}function W({computation:e,interpolationInfo:t}){let{computationResult:n,inputPoints:r}=e,{start:i,end:a,intersection:o}=n,{originalIntersection:s,originalObserver:c,originalTarget:l}=t;if(h(o,s),r.isValid){let e=K,t=b(c,s)/b(c,l);x(e,i,c),v(e,e,1-t),y(o,o,e),x(e,a,l),v(e,e,t),y(o,o,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}const G=.1,K=S(),q=k(),J=D();export{V as LineOfSightController};
2
+ import{__decorate as e}from"tslib";import{updatePointsFromFeatureReference as t,getFeatureId as n}from"../../../../analysis/featureReferenceUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{EventedAccessor as i}from"../../../../core/Evented.js";import a from"../../../../core/Handles.js";import{handlesGroup as o,makeHandle as s}from"../../../../core/handleUtils.js";import c from"../../../../core/Logger.js";import{abortMaybe as l}from"../../../../core/maybe.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{initial as d,on as f}from"../../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{copy as h,subtract as g,normalize as _,scale as v,add as y,dist as b,sub as x}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Point.js";import{projectOrLoad as T}from"../../../../geometry/projectionUtils.js";import{intersectsSegment as E}from"../../../../geometry/support/aaBoundingBox.js";import{empty as D,intersectsSegment as O}from"../../../../geometry/support/aaBoundingRect.js";import{create as k,fromPoints as A}from"../../../../geometry/support/ray.js";import{getInfo as j}from"../../../../geometry/support/spatialReferenceUtils.js";import{zValueInAbsoluteHeightMode as M}from"../../../../support/elevationInfoUtils.js";import N from"../LineOfSightAnalysisResult.js";import{LineOfSightComputation as P}from"./LineOfSightComputation.js";import{LineOfSightRayIntersector as F}from"./LineOfSightRayIntersector.js";import{logFailedGeometryProjectionError as I}from"../support/projectionUtils.js";import{projectElevationUpdateExtent as L,containsElevationUpdatePoint as R}from"../../support/elevationUpdateExtentUtils.js";import{toGraphic as z}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as B,TaskPriority as V}from"../../../support/Scheduler.js";let H=class extends i{constructor(e){super(e),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode=`absolute-height`,this._observerFeatureId=null,this._updatingHandles=new C,this._frameTask=B,this._computationHandles=new a,this._externalObserverUpdate=!0}initialize(){let e=this.view.resourceController?.scheduler;this._frameTask=e?e.registerTask(V.LINE_OF_SIGHT_TOOL):B,this._intersector=new F({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(e){this._frameTask.priority=e}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(e){this.analysisViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(e){let t=e.computation,{inputPoints:n,computationResult:r}=t,{observerAdjusted:i,targetAdjusted:a}=n,{start:o,end:s}=r;h(o,i),h(s,a),this._canCompute(t)?this._computeIntersection(e):G(e),t.notifyResultChanged(),this.emit(`result-changed`,{target:e.computation.target,result:t.result})}_adjustStartEndPositions(e){let{view:n}=this,{inputPoints:r}=e,{observer:i,target:a,observerAdjusted:o,targetAdjusted:s}=r;h(o,i),h(s,a),t(n,this._intersector.intersector,r);let{observerSurfaceNormal:c,targetSurfaceNormal:l}=r,u=this._screenPixelSize,d=q;c==null?g(d,s,o):h(d,c);let f=u;_(d,d),v(d,d,Math.min(f,1)),y(o,o,d),l==null?g(d,o,s):h(d,l);let p=n.state.camera.computeScreenPixelSizeAt(s);_(d,d),v(d,d,Math.min(p,1)),y(s,s,d)}_computeIntersection({computation:e,interpolationInfo:t}){let{view:n}=this,{sceneIntersectionHelper:r,renderCoordsHelper:i}=n;if(r==null)return;let a=this._intersector.intersector,{computationResult:o,inputPoints:s}=e,{observer:c,target:l}=s,{start:u,end:d}=o,f=A(u,d,J);a.options.store=0,r.intersectToolIntersectorRay(f,a);let p=a.results.min,m=o.intersection,g=q,_=p!=null&&p.getIntersectionPoint(m),v=!0;if(_){h(t.originalIntersection,m),h(t.originalObserver,u),h(t.originalTarget,d),i.fromRenderCoords(m,g,n.spatialReference);let e=1-b(d,l)/b(u,l);v=b(c,m)>=e*b(c,l)}let y=new w(g,n.spatialReference);{let{result:t,target:r}=e;t==null?e.result=new N({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:v?null:z(p,n),intersectedLocation:v?null:y,visible:v}):(t.target=r,t.intersectedGraphic=v?null:z(p,n),t.intersectedLocation=v?null:y,t.visible=v)}o.isValid=s.isValid=!0,o.isTargetVisible=v}_canCompute(e){let t=this.analysisViewData.elevationAlignedObserver,{frustum:n}=this.view;if(t==null||e.elevationAlignedTargetLocation==null||n==null)return!1;let{observerAdjusted:r,targetAdjusted:i}=e.inputPoints,a=n.intersectsPoint(r),o=n.intersectsPoint(i);return a&&o}_onObserverPositionChange(e,t,r,i,a){if(this._externalObserverUpdate=a,e==null){this.analysisViewData.elevationAlignedObserver=null,this._observerFeatureId=null;return}if(t==null){I(this.analysis,e.spatialReference,c.getLogger(this)),this.analysisViewData.elevationAlignedObserver=null;return}let o=U(t,r),{absoluteZ:s,elevation:l}=M(t.x,t.y,t.z,this.view.spatialReference,this.view,o),u=t.clone();u.z=s,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=u;let d=S();this.view.renderCoordsHelper.toRenderCoords(u,d),this._elevationAlignedObserverPositionRenderSpace=d,this._observerGroundOffsetRenderSpace=s-l,this._observerFeatureId=n(i),this.priority=V.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i){let{inputPoints:a}=e;switch(h(a.observer,t),a.observerFeatureId=i,a.observerSurfaceNormal=null,r){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(a.observer,n,a.observer);a.observerFeatureId??(a.observerSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=V.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(e,t,r,i,a,o=!0){let s=e.inputPoints;if(o&&(s.isValid=!1),r==null){t!=null&&I(this.analysis,t.spatialReference,c.getLogger(this)),e.elevationAlignedTargetLocation=null,e.notifyInputPointsChanged();return}let l=U(r,i),{absoluteZ:u,elevation:d}=M(r.x,r.y,r.z,this.view.spatialReference,this.view,l),f=r.clone();switch(f.z=u,e.elevationAlignedTargetLocation=f,this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,s.target),s.targetFeatureId=n(a),s.targetSurfaceNormal=null,l.mode){case`on-the-ground`:case`relative-to-ground`:{let e=this._intersector.updateFromGroundIntersection(s.target,u-d,s.target);s.targetFeatureId??(s.targetSurfaceNormal=e)}}this._adjustStartEndPositions(e),e.notifyInputPointsChanged(),this.priority=V.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(e){return o([this._updatingHandles.add(()=>({computation:e,targetPosition:e.target.position,targetElevationInfoDependency:W(e.target.elevationInfo),targetFeatureInfo:e.target.feature,projectedTargetPosition:T(e.target.position,this.view.spatialReference)}),({computation:e,targetPosition:t,targetFeatureInfo:n,projectedTargetPosition:r})=>{r.pending==null?this._onTargetPositionChange(e,t,r.geometry,e.target.elevationInfo,n):this._updatingHandles.consumePromise(r.pending)},d)])}_connectComputationToObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},d)}_connectComputationToRenderSpaceObserver(e){return this._updatingHandles.add(()=>({computation:e,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:t,observerGroundOffset:n,observerElevationMode:r,observerFeatureId:i})=>{this._onObserverRenderSpacePositionChangeForComputation(e,t,n,r,i)},d)}_connectComputationToCamera(e){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:t})=>{!this.updateOnCameraChange||e.inputPoints.isValid&&!t||e.notifyInputPointsChanged()})}_connectComputationToSlicePlane(e){return this._updatingHandles.add(()=>this.view.slice.plane,()=>{e.inputPoints.isValid=!1,e.notifyInputPointsChanged()})}_connectComputationToElevation(e){let t=(n,r)=>{let i=this.analysis.observer,a=e.target,o=null,s=null,c=null,l=null,u=null,d=null;if(i?.position!=null){let e=T(i.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}o=e.geometry,s=i.elevationInfo,c=i.feature}if(a.position!=null){let e=T(a.position,this.view.spatialReference);if(e.pending!=null){this._updatingHandles.consumePromise(e.pending),e.pending.finally(()=>t(n,r));return}l=e.geometry,u=a.elevationInfo,d=a.feature}if(o==null&&l==null)return;L(n,r,Y,this.view.spatialReference),o!=null&&R(Y,o.x,o.y,this.view.spatialReference)&&this._onObserverPositionChange(i==null?null:i.position,o,s,c,!1),l!=null&&R(Y,l.x,l.y,this.view.spatialReference)&&this._onTargetPositionChange(e,a.position,l,u,d,!1);let f=!1,p=this.view.state.viewingMode===1?j(this.view.spatialReference)?.valid:null;if(o!=null&&l!=null&&p!=null){let e=p[1]-p[0];if(X.x=l.x+Math.round((o.x-l.x)/e)*e,X.y=l.y,l=X,Y[2]-Y[0]>=e)Y[0]=Math.min(Y[0],o.x,l.x),Y[2]=Math.max(Y[2],o.x,l.x);else{let t=Math.round((o.x+l.x-Y[0]-Y[2])/(2*e))*e;t!==0&&(f=O(Y,o,l),Y[0]+=t,Y[2]+=t)}}o!=null&&l!=null&&(f||O(Y,o,l))&&e.notifyInputPointsChanged()};return this.view.elevationProvider.on(`elevation-change`,({extent:e,spatialReference:n})=>t(e,n))}_connectComputationToTask(e){let t=null,n={computation:e,interpolationInfo:{originalIntersection:S(),originalObserver:S(),originalTarget:S()}};return o([this._updatingHandles.add(()=>e.inputPoints,()=>{t=l(t),t=r(async e=>{await u(this._frameTask.schedule(()=>this._computeResult(n),e))})},{initial:!0,equals:()=>!1}),s(()=>t=l(t))])}_connectComputationToContent(e){return f(()=>this.view.pointsOfInterest?.contentGeometryUpdates.events,`request-update`,t=>{let n=t?.renderBounds,{observerAdjusted:r,targetAdjusted:i}=e.inputPoints;(n==null||E(n,r,i))&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())})}_connectComputation(e){let t=this._computationHandles;t.has(e)||t.add([this._connectComputationToTarget(e),this._connectComputationToObserver(e),this._connectComputationToRenderSpaceObserver(e),this._connectComputationToCamera(e),this._connectComputationToSlicePlane(e),this._connectComputationToElevation(e),this._connectComputationToTask(e),this._connectComputationToContent(e)],e)}_disconnectComputation(e){this._computationHandles.remove(e)}_onComputationCollectionChange({added:e,removed:t}){for(let e of t)this._disconnectComputation(e);for(let t of e)this._connectComputation(t)}_onTargetCollectionChange({added:e,removed:t}){for(let e of t)this._removeTarget(e);for(let t of e)this._addTarget(t)}_onCursorTargetChange(e,t){t!=null&&this._removeTarget(t),e!=null&&this._addTarget(e)}_addTarget(e){this._computations.some(t=>t.target===e)||this._computations.add(new P({target:e}))}_removeTarget(e){let t=this._computations.findIndex(t=>t.target===e);this._computations.removeAt(t)}_connectObserver(){return o([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer==null?null:this.analysis.observer.position,projectedObserverPosition:T(this.analysis.observer==null?null:this.analysis.observer.position,this.view.spatialReference),observerElevationInfoDependency:W(this.analysis.observer?.elevationInfo),observerFeatureInfo:this.analysis.observer==null?null:this.analysis.observer.feature}),({observerPosition:e,projectedObserverPosition:t,observerFeatureInfo:n})=>{t.pending==null?this._onObserverPositionChange(e,t.geometry,this.analysis.observer?.elevationInfo,n,!0):this._updatingHandles.consumePromise(t.pending)},d)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,e=>this._onComputationCollectionChange(e),{initial:!0,final:!0})}_connectTargets(){return o([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,e=>this._onTargetCollectionChange(e),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(e,t)=>{this._onCursorTargetChange(e,t)})])}get _isCameraDirty(){let e=this.analysisViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:n}=t;if(e==null)return!1;let r=q;n.toRenderCoords(e,r);let i=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((i-this._screenPixelSize)/this._screenPixelSize)>K}};e([p({constructOnly:!0})],H.prototype,`analysis`,void 0),e([p({constructOnly:!0})],H.prototype,`analysisViewData`,void 0),e([p({constructOnly:!0})],H.prototype,`view`,void 0),e([p()],H.prototype,`updating`,null),e([p()],H.prototype,`priority`,null),e([p()],H.prototype,`updateOnCameraChange`,void 0),e([p()],H.prototype,`_computations`,null),e([p()],H.prototype,`_elevationAlignedObserverPositionRenderSpace`,null),e([p()],H.prototype,`_observerGroundOffsetRenderSpace`,void 0),e([p()],H.prototype,`_effectiveObserverElevationMode`,void 0),e([p()],H.prototype,`_observerFeatureId`,void 0),e([p()],H.prototype,`_screenPixelSize`,null),e([p({readOnly:!0})],H.prototype,`_updatingHandles`,void 0),e([p()],H.prototype,`_frameTask`,void 0),e([p()],H.prototype,`_isCameraDirty`,null),H=e([m(`esri.views.3d.analysis.LineOfSight.LineOfSightController`)],H);function U(e,t){return e.hasZ?t??{mode:`absolute-height`,offset:0}:{mode:`on-the-ground`,offset:0}}function W(e){return{mode:e?.mode,offset:e?.offset,unit:e?.unit}}function G({computation:e,interpolationInfo:t}){let{computationResult:n,inputPoints:r}=e,{start:i,end:a,intersection:o}=n,{originalIntersection:s,originalObserver:c,originalTarget:l}=t;if(h(o,s),r.isValid){let e=q,t=b(c,s)/b(c,l);x(e,i,c),v(e,e,1-t),y(o,o,e),x(e,a,l),v(e,e,t),y(o,o,e),n.isValid=!0}else e.result=null,n.isValid=!1,n.isTargetVisible=!1}const K=.1,q=S(),J=k(),Y=D(),X=new w;export{H as LineOfSightController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,onCancel:_,onComplete:v,onManipulatorCountChange:y,shouldPreventVertexAdd:b}=u,x=g(),S=new r({analysis:d,analysisViewData:f,view:m}),C=new a({view:m}),w=new c,T=new o({elevationInfo:x,enableVertexVisuals:!1,hasZ:!0,renderer:S,toolOptions:w,snappingManager:p,view:m});return S.elevationInfo=x,T.addHandles([e(S),e(C),s(w,()=>m.options),T.on(`cancel`,()=>_(T)),T.on(`complete`,()=>v(T)),t(()=>[h(),f.visible,g()],([e,t,n])=>{T.visible=e&&t,S.analysisVisible=T.visible,T.elevationInfo=n,S.elevationInfo=n,S.refresh()},n),t(()=>T.manipulators.length,()=>y(T),n),t(()=>T.mostDownstreamPlugin,()=>{T.defaultZ=0},n),T.on([`before-vertex-add`,`before-vertex-add-at-point`],e=>{let t=e.detail.originalEvent;if(t?.type!==`immediate-click`)return;let n=l(t);if(b(n,t.pointerType)){e.preventDefault();return}let r=C.getScreenPointIntersection(n);if(r?.mapPoint==null)e.preventDefault();else{let e=T.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=r)}})]),{drawTool:T,renderer:S}}export{u as createDrawTool};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,onCancel:_,onComplete:v,onManipulatorCountChange:y,shouldPreventVertexAdd:b}=u,x=g(),S=new r({analysis:d,analysisViewData:f,view:m}),C=new a({view:m}),w=new c,T=new o({disableTouchDrag:!0,elevationInfo:x,enableVertexVisuals:!1,hasZ:!0,renderer:S,toolOptions:w,snappingManager:p,view:m});return S.elevationInfo=x,T.addHandles([e(S),e(C),s(w,()=>m.options),T.on(`cancel`,()=>_(T)),T.on(`complete`,()=>v(T)),t(()=>[h(),f.visible,g()],([e,t,n])=>{T.visible=e&&t,S.analysisVisible=T.visible,T.elevationInfo=n,S.elevationInfo=n,S.refresh()},n),t(()=>T.manipulators.length,()=>y(T),n),t(()=>T.mostDownstreamPlugin,()=>{T.defaultZ=0},n),T.on([`before-vertex-add`,`before-vertex-add-at-point`],e=>{let t=e.detail.originalEvent;if(t?.type!==`immediate-click`)return;let n=l(t);if(b(n,t.pointerType)){e.preventDefault();return}let r=C.getScreenPointIntersection(n);if(r?.mapPoint==null)e.preventDefault();else{let e=T.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=r)}})]),{drawTool:T,renderer:S}}export{u as createDrawTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({disableTouchDrag:!0,elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as r,initial as i,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as c}from"./handlers/DoubleClickZoom.js";import{DragRotate as l}from"./handlers/DragRotate.js";import{DragZoom as u}from"./handlers/DragZoom.js";import{DragZoomBox as d}from"./handlers/DragZoomBox.js";import{GamepadNavigation as f}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as p}from"./handlers/KeyboardNavigation.js";import{MouseWheelFov as m}from"./handlers/MouseWheelFov.js";import{MouseWheelZoom as h}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as g}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as _}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as v}from"./handlers/TwoFingerTilt.js";import{GroundDoubleClickMove as y}from"./handlers/ground/GroundDoubleClickMove.js";import{GroundMouseWheelMove as b}from"./handlers/ground/GroundMouseWheelMove.js";import{GroundNavigation as x}from"./handlers/ground/GroundNavigation.js";import{BrowserEventSource as S}from"../../input/BrowserEventSource.js";import{InputManager as C,ViewEventPriorities as w}from"../../input/InputManager.js";import{PreventContextMenu as T}from"../../input/handlers/PreventContextMenu.js";import{PreventTouchSelection as E}from"../../input/handlers/PreventTouchSelection.js";import{getPointerActions as D}from"../../input/handlers/support.js";import{Drag as O}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as k}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as A}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as j}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as M}from"../../input/recognizers/VerticalTwoFingerDrag.js";const N=`modeDependentNavigation`;let P=class extends t{constructor(){super(...arguments),this.mode=`default`,this._keys={fov:`Shift`,pan:{left:`ArrowLeft`,right:`ArrowRight`,forward:`ArrowUp`,backward:`ArrowDown`,up:[`u`,`U`],down:[`j`,`J`]},lookAround:{headingLeft:[`a`,`A`],headingRight:[`d`,`D`],tiltUp:[`w`,`W`],tiltDown:[`s`,`S`]},modifier:[`b`,`B`],zoom:{zoomIn:[`+`,`=`],zoomOut:[`-`,`_`]},reset:{heading:[`n`,`N`],tilt:[`p`,`P`]},precisionPanModifier:`Alt`,coarsePanModifier:`Shift`},this._updateMode=({mode:e,dragPrimary:t,dragSecondary:n,dragTertiary:r})=>{e===`pro`&&(n=`zoom`,r=t===`pan`?`rotate`:`pan`);let i={dragPrimary:t,dragSecondary:n,dragTertiary:r};this._modeDragPan&&(this._modeDragPan.pointerActions=D(`pan`,i)),this._modeGroundNavigation&&(this._modeGroundNavigation.pointerActions=D(`pan`,i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=D(`rotate`,i)),this._modeGroundNavigationDragRotate&&(this._modeGroundNavigationDragRotate.pointerActions=D(`rotate`,i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=D(`zoom`,i))}}destroy(){this.disconnect()}get primaryDragAction(){return this.view.navigation.actionMap.dragPrimary}set primaryDragAction(e){let{actionMap:t}=this.view.navigation;t.dragPrimary=e,t.dragSecondary=e===`pan`?`rotate`:`pan`}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get latestPenInfo(){return this._inputManager?.latestPenInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeGroundNavigation=null,this._modeDragRotate=null,this._modeGroundNavigationDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=n(this._inputManager),this._source=n(this._source)}connect(){let e=this.view;this._source=new S(this.view.surface,e.input);let t=[new k,new A,new j,new O(this.view.navigation),new M],n=new C({eventSource:this._source,recognizers:t});this._inputManager=n,n.installHandlers(`prevent-context-menu`,[new T],w.INTERNAL),n.installHandlers(`prevent-touch-text-selection-gesture`,[new E(this.view)],w.INTERNAL),this._modeDragPan=new g(e,[`primary`]),this._modeDragRotate=new l(e,[`secondary`],0),this._modeDragZoom=new u(e,[`tertiary`],this._keys.fov),this._modeKeyboardNavigation=new p(e,this._keys);let o=[new _(e),new c(e),new f(e),new m(e,this._keys.fov,!0),new h(e),new d(e),new l(e,[`primary`],1,this._keys.modifier),new x(e,[`secondary`],this._keys.modifier),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new v(e)];this._modeGroundNavigation=new x(e,[`primary`]),this._modeGroundNavigationDragRotate=new l(e,[`secondary`],1);let s=[this._modeGroundNavigation,new m(e,this._keys.fov,!1),new x(e,[`tertiary`]),this._modeGroundNavigationDragRotate,this._modeKeyboardNavigation,new y(e),new b(e)];this.view.viewEvents.connect(n),this.addHandles([r(()=>this.view.navigation.mode,e=>{switch(n.hasHandlers(N)&&n.uninstallHandlers(N),e.type){case`default`:n.installHandlers(N,o,w.INTERNAL);break;case`ground`:n.installHandlers(N,s,w.INTERNAL)}},{initial:!0}),r(()=>this.view.navigation?.browserTouchPanEnabled,e=>{this._source.browserTouchPanningEnabled=!e},i),r(()=>{let{actionMap:e}=this.view.navigation,{dragPrimary:t,dragSecondary:n,dragTertiary:r}=e;return{mode:this.mode,dragPrimary:t,dragSecondary:n,dragTertiary:r}},this._updateMode,a)])}isModifierKeyDown(e){return this._inputManager?.isModifierKeyDown(e)??!1}get test(){}};e([o()],P.prototype,`view`,void 0),e([o({type:[`default`,`pro`]})],P.prototype,`mode`,void 0),e([o({readOnly:!0})],P.prototype,`updating`,null),e([o()],P.prototype,`latestPointerInfo`,null),e([o()],P.prototype,`latestPenInfo`,null),e([o()],P.prototype,`multiTouchActive`,null),e([o()],P.prototype,`_inputManager`,void 0),P=e([s(`esri.views.3d.input.SceneInputManager`)],P);const F=P;export{F as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as r,initial as i,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as c}from"./handlers/DoubleClickZoom.js";import{DragRotate as l}from"./handlers/DragRotate.js";import{DragZoom as u}from"./handlers/DragZoom.js";import{DragZoomBox as d}from"./handlers/DragZoomBox.js";import{GamepadNavigation as f}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as p}from"./handlers/KeyboardNavigation.js";import{MouseWheelFov as m}from"./handlers/MouseWheelFov.js";import{MouseWheelZoom as h}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as g}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as _}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as v}from"./handlers/TwoFingerTilt.js";import{GroundDoubleClickMove as y}from"./handlers/ground/GroundDoubleClickMove.js";import{GroundMouseWheelMove as b}from"./handlers/ground/GroundMouseWheelMove.js";import{GroundNavigation as x}from"./handlers/ground/GroundNavigation.js";import{BrowserEventSource as S}from"../../input/BrowserEventSource.js";import{InputManager as C,ViewEventPriorities as w}from"../../input/InputManager.js";import{PreventContextMenu as T}from"../../input/handlers/PreventContextMenu.js";import{PreventTouchSelection as E}from"../../input/handlers/PreventTouchSelection.js";import{getPointerActions as D}from"../../input/handlers/support.js";import{Drag as O}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as k}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as A}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as j}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as M}from"../../input/recognizers/VerticalTwoFingerDrag.js";const N=`modeDependentNavigation`;let P=class extends t{constructor(){super(...arguments),this.mode=`default`,this._keys={fov:`Shift`,pan:{left:`ArrowLeft`,right:`ArrowRight`,forward:`ArrowUp`,backward:`ArrowDown`,up:[`u`,`U`],down:[`j`,`J`]},lookAround:{headingLeft:[`a`,`A`],headingRight:[`d`,`D`],tiltUp:[`w`,`W`],tiltDown:[`s`,`S`]},modifier:[`b`,`B`],zoom:{zoomIn:[`+`,`=`],zoomOut:[`-`,`_`]},reset:{heading:[`n`,`N`],tilt:[`p`,`P`]},precisionPanModifier:`Alt`,coarsePanModifier:`Shift`},this._updateMode=({mode:e,dragPrimary:t,dragSecondary:n,dragTertiary:r})=>{e===`pro`&&(n=`zoom`,r=t===`pan`?`rotate`:`pan`);let i={dragPrimary:t,dragSecondary:n,dragTertiary:r};this._modeDragPan&&(this._modeDragPan.pointerActions=D(`pan`,i)),this._modeGroundNavigation&&(this._modeGroundNavigation.pointerActions=D(`pan`,i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=D(`rotate`,i)),this._modeGroundNavigationDragRotate&&(this._modeGroundNavigationDragRotate.pointerActions=D(`rotate`,i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=D(`zoom`,i))}}destroy(){this.disconnect()}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get latestPenInfo(){return this._inputManager?.latestPenInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeGroundNavigation=null,this._modeDragRotate=null,this._modeGroundNavigationDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=n(this._inputManager),this._source=n(this._source)}connect(){let e=this.view;this._source=new S(this.view.surface,e.input);let t=[new k,new A,new j,new O(this.view.navigation),new M],n=new C({eventSource:this._source,recognizers:t});this._inputManager=n,n.installHandlers(`prevent-context-menu`,[new T],w.INTERNAL),n.installHandlers(`prevent-touch-text-selection-gesture`,[new E(this.view)],w.INTERNAL),this._modeDragPan=new g(e,[`primary`]),this._modeDragRotate=new l(e,[`secondary`],0),this._modeDragZoom=new u(e,[`tertiary`],this._keys.fov),this._modeKeyboardNavigation=new p(e,this._keys);let o=[new _(e),new c(e),new f(e),new m(e,this._keys.fov,!0),new h(e),new d(e),new l(e,[`primary`],1,this._keys.modifier),new x(e,[`secondary`],this._keys.modifier),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new v(e)];this._modeGroundNavigation=new x(e,[`primary`]),this._modeGroundNavigationDragRotate=new l(e,[`secondary`],1);let s=[this._modeGroundNavigation,new m(e,this._keys.fov,!1),new x(e,[`tertiary`]),this._modeGroundNavigationDragRotate,this._modeKeyboardNavigation,new y(e),new b(e)];this.view.viewEvents.connect(n),this.addHandles([r(()=>this.view.navigation.mode,e=>{switch(n.hasHandlers(N)&&n.uninstallHandlers(N),e.type){case`default`:n.installHandlers(N,o,w.INTERNAL);break;case`ground`:n.installHandlers(N,s,w.INTERNAL)}},{initial:!0}),r(()=>this.view.navigation?.browserTouchPanEnabled,e=>{this._source.browserTouchPanningEnabled=!e},i),r(()=>{let{actionMap:e}=this.view.navigation,{dragPrimary:t,dragSecondary:n,dragTertiary:r}=e;return{mode:this.mode,dragPrimary:t,dragSecondary:n,dragTertiary:r}},this._updateMode,a)])}isModifierKeyDown(e){return this._inputManager?.isModifierKeyDown(e)??!1}get test(){}};e([o()],P.prototype,`view`,void 0),e([o({type:[`default`,`pro`]})],P.prototype,`mode`,void 0),e([o({readOnly:!0})],P.prototype,`updating`,null),e([o()],P.prototype,`latestPointerInfo`,null),e([o()],P.prototype,`latestPenInfo`,null),e([o()],P.prototype,`multiTouchActive`,null),e([o()],P.prototype,`_inputManager`,void 0),P=e([s(`esri.views.3d.input.SceneInputManager`)],P);const F=P;export{F as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as a,screenPointObjectToArray as o,castRenderScreenPointArray as s}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,exactEquals as f,getTranslation as p,set as m,multiply as h,identity as ee}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as _}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as v,transformMat3 as y,transformMat4 as b,scale as x,copy as S,squaredDistance as te,exactEquals as ne,set as re,subtract as ie}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C,ZEROS as ae}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import T from"../../../geometry/Point.js";import{canProjectWithoutEngine as oe,projectPoint as se}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as ce}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as E}from"../../../geometry/projection/projectors.js";import{containsPointObject as D}from"../../../geometry/support/aaBoundingRect.js";import{distance2 as le,fromPoints as O,closestRayDistance2 as ue,create as de}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as k,intersectRay as A,create as j}from"../../../geometry/support/plane.js";import{create as M}from"../../../geometry/support/ray.js";import{sv3d as N}from"../../../geometry/support/vectorStacks.js";import{clonePoint as P}from"../../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as F}from"../../../layers/graphics/hydratedSpatialReference.js";import{getElevationOffset as I}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as L}from"../support/ElevationProvider.js";import{fromScreen as R}from"../support/geometryUtils/ray.js";import{fromValues as z}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as B}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as V}from"../webgl-engine/lib/WebGLLayer.js";class fe{constructor(t){this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:`point`},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=g(),this._worldFrame=null,this._renderLocation=C(),this._renderLocationDirty=!0,this._location=new T({x:0,y:0,z:0}),this._elevationAlignedLocation=new T,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:a(),renderScreenPointArray:i(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t)}destroy(){this._applyObjectTransform=_e,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){H(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||=g(),pe(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&=null),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){P(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty&&(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation()),this._elevationAlignedLocation}set elevationAlignedLocation(e){P(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}_updateElevationAlignedLocation(){let e=this._elevation.override==null?this.location.z||0:this._elevation.override;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=F(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit(`select-changed`,{action:e?`select`:`deselect`}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit(`focus-changed`,{action:e===!0?`focus`:`unfocus`}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;let e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t=H(this._modelTransform),n;if(t){let e=this._calculateModelTransformOffset(ge);n=v(e,e,this.renderLocation)}else n=this.renderLocation;e.projectToRenderScreen(n,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;let n=this.view.state.camera,r=o(e,me),i=this._getCollisionRadius(t),a=this.collisionPriority*-1;switch(this.collisionType.type){case`point`:if(_(this.screenLocation.screenPointArray,r)<i*i)return this.screenLocation.renderScreenPointArray[2]+a;break;case`line`:{let e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),o=this._calculateObjectTransform(t,K),c=i*this.screenLocation.pixelSize,l=R(n,r,W);if(l==null)return null;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],o);for(let r=1;r<t.length;r++){let i=b(Y,t[r],o),u=ue(O(e,i,U),l);if(u!=null&&u<c*c){let t=v(N.get(),e,i);x(t,t,.5);let r=s(N.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}case`disc`:{let e=this.collisionType.direction,t=this.collisionType.offset??ae,o=this._getWorldToScreenObjectScale(),s=this._calculateObjectTransform(o,K),c=i*this.screenLocation.pixelSize,u=R(n,r,W);if(u==null)return null;let d=l(G,s),f=y(Z,e,d),p=b(Q,t,s);k(p,f,q);let m=X;if(A(q,u,m)&&te(m,p)<c*c)return this.screenLocation.renderScreenPointArray[2]+a;break}case`ribbon`:{let{paths:e,direction:t}=this.collisionType,o=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(o,K),u=i*n.computeScreenPixelSizeAt(this.renderLocation),d=R(n,r,W);if(d==null)return null;let f=l(G,c),p=y(Z,t,f),m=this._calculateModelTransformPosition(Q);k(m,p,q);let h=X;if(!A(q,d,h))break;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],c);for(let r=1;r<t.length;r++){let i=b(Y,t[r],c),o=le(O(e,i,U),h);if(o!=null&&o<u*u){let t=v(N.get(),e,i);x(t,t,.5);let r=s(N.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){let t=this._stage;if(!t)return;let n=e.manipulator3D;n.engineLayerId==null?(this._engineLayer=new V(t,{pickable:!1,updatePolicy:1}),n.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(n.engineLayerId)),n.engineLayerReferences=(n.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),oe(this._location.spatialReference,this.view.spatialReference)||(this.location=new T({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){let t=e.manipulator3D;t.engineLayerReferences--;let n=t.engineLayerReferences===0;this._removeResourcesFromStage(),n&&(t.engineLayerId=null,r(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){se(this.location,$,e.spatialReference)&&D(e.extent,$)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(this.elevationInfo==null)return;let e=null,t=0,n=I(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case`on-the-ground`:e=L(this.view.elevationProvider,this.location,`ground`)??0;break;case`relative-to-ground`:t=(L(this.view.elevationProvider,this.location,`ground`)??0)+n;break;case`relative-to-scene`:t=(L(this.view.elevationProvider,this.location,`scene`)??0)+n;break;case`absolute-height`:t=n}(t!==this._elevation.offset||e!==this._elevation.override)&&(this._elevation.offset=t,this._elevation.override=e)}_updateEngineObject(){if(!this._attached)return;if(!this.available){this._removeResourcesFromStage();return}let e=this._getWorldToScreenObjectScale(),t=K;if(this.autoScaleRenderObjects===!0){let n=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(n,t)}else this._calculateObjectTransform(e,t);let{objectsByState:n}=this._ensureEngineResources(),r=(this.focused?2:1)|(this.selected?8:4),i=this._noDisplayCount>0;for(let{stateMask:e,objects:a}of n){if(i){for(let e of a)e.visible=!1;continue}let n=!!(e&15),o=!!(e&65520),s=!n||(r&e)===(e&15),c=!o||(this.state&e)===(e&65520);if(s&&c)for(let e of a)e.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(e,t):f(e.transformation,t)||(e.transformation=t);else for(let e of a)e.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){let n=p(Q,t);if(e.geometries.every(({localOrigin:e})=>e!=null&&ne(e.vec3,n))&&f(e.transformation,t))return;let r=z(n[0],n[1],n[2],`manipulator-${c()}`);for(let t of e.geometries)t.localOrigin=r;e.transformation=t}_ensureEngineResources(){if(this._engineResources==null){let e=this._engineLayer,t=[],n=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{n.has(e)||(t.push(e),n.add(e))});let r=new Map;this._renderObjects.forEach(e=>{let t=new B({castShadow:!1,geometries:[e.geometry]}),n=r.get(e.stateMask)||[];n.push(t),r.set(e.stateMask,n)});let i=[];r.forEach((e,t)=>i.push({stateMask:t,objects:e})),this._engineResources={objectsByState:i,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){let e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){let e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e===`touch`?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){let t=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(t,he);return re(e,n[12],n[13],n[14])}_calculateModelTransformOffset(e){let t=this._calculateModelTransformPosition(e);return ie(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return m(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&h(t,t,this._worldFrame),h(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform!=null&&this._applyObjectTransform(t),t}get test(){}}function H(e){return e[12]!==0||e[13]!==0||e[14]!==0}function pe(e,t,r){switch(e.viewingMode){case`local`:return ee(r),!0;case`global`:{let i=w(e.renderCoordsHelper.spatialReference);return E(t,0,J,0,i.radius),ce(n(J[0]),n(J[1]),r),!0}}}const me=a(),U=de(),W=M(),G=u(),he=g(),K=g(),q=j(),J=C(),Y=C(),X=C(),Z=C(),Q=C(),ge=C(),$=new T({x:0,y:0,z:0,spatialReference:null}),_e=()=>{};export{fe as Manipulator3D};
2
+ import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as n}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as a,screenPointObjectToArray as o,castRenderScreenPointArray as s}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,exactEquals as f,getTranslation as p,set as m,multiply as h,identity as ee}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as _}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as v,transformMat3 as y,transformMat4 as b,scale as x,copy as S,squaredDistance as te,exactEquals as C,set as w,subtract as ne}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as re}from"../../../geometry/ellipsoidUtils.js";import D from"../../../geometry/Point.js";import{canProjectWithoutEngine as O,projectPoint as ie}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as ae}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as oe}from"../../../geometry/projection/projectors.js";import{distance2 as se,fromPoints as k,closestRayDistance2 as ce,create as le}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as A,intersectRay as j,create as ue}from"../../../geometry/support/plane.js";import{create as de}from"../../../geometry/support/ray.js";import{sv3d as M}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N}from"../../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as P}from"../../../layers/graphics/hydratedSpatialReference.js";import{getElevationOffset as F}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as I}from"../support/ElevationProvider.js";import{containsElevationUpdatePoint as L}from"../support/elevationUpdateExtentUtils.js";import{fromScreen as R}from"../support/geometryUtils/ray.js";import{fromValues as z}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as B}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as V}from"../webgl-engine/lib/WebGLLayer.js";class fe{constructor(t){this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:`point`},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=g(),this._worldFrame=null,this._renderLocation=T(),this._renderLocationDirty=!0,this._location=new D({x:0,y:0,z:0}),this._elevationAlignedLocation=new D,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:a(),renderScreenPointArray:i(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t)}destroy(){this._applyObjectTransform=_e,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){H(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||=g(),pe(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&=null),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty&&(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation()),this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit(`location-update`,{location:this._location})}_updateElevationAlignedLocation(){let e=this._elevation.override==null?this.location.z||0:this._elevation.override;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=P(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit(`select-changed`,{action:e?`select`:`deselect`}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit(`focus-changed`,{action:e===!0?`focus`:`unfocus`}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;let e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t=H(this._modelTransform),n;if(t){let e=this._calculateModelTransformOffset(ge);n=v(e,e,this.renderLocation)}else n=this.renderLocation;e.projectToRenderScreen(n,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;let n=this.view.state.camera,r=o(e,me),i=this._getCollisionRadius(t),a=this.collisionPriority*-1;switch(this.collisionType.type){case`point`:if(_(this.screenLocation.screenPointArray,r)<i*i)return this.screenLocation.renderScreenPointArray[2]+a;break;case`line`:{let e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),o=this._calculateObjectTransform(t,K),c=i*this.screenLocation.pixelSize,l=R(n,r,W);if(l==null)return null;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],o);for(let r=1;r<t.length;r++){let i=b(Y,t[r],o),u=ce(k(e,i,U),l);if(u!=null&&u<c*c){let t=v(M.get(),e,i);x(t,t,.5);let r=s(M.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}case`disc`:{let e=this.collisionType.direction,t=this.collisionType.offset??E,o=this._getWorldToScreenObjectScale(),s=this._calculateObjectTransform(o,K),c=i*this.screenLocation.pixelSize,u=R(n,r,W);if(u==null)return null;let d=l(G,s),f=y(Z,e,d),p=b(Q,t,s);A(p,f,q);let m=X;if(j(q,u,m)&&te(m,p)<c*c)return this.screenLocation.renderScreenPointArray[2]+a;break}case`ribbon`:{let{paths:e,direction:t}=this.collisionType,o=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(o,K),u=i*n.computeScreenPixelSizeAt(this.renderLocation),d=R(n,r,W);if(d==null)return null;let f=l(G,c),p=y(Z,t,f),m=this._calculateModelTransformPosition(Q);A(m,p,q);let h=X;if(!j(q,d,h))break;for(let t of e){if(t.length===0)continue;let e=b(J,t[0],c);for(let r=1;r<t.length;r++){let i=b(Y,t[r],c),o=se(k(e,i,U),h);if(o!=null&&o<u*u){let t=v(M.get(),e,i);x(t,t,.5);let r=s(M.get());if(n.projectToRenderScreen(t,r))return r[2]+a}S(e,i)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){let t=this._stage;if(!t)return;let n=e.manipulator3D;n.engineLayerId==null?(this._engineLayer=new V(t,{pickable:!1,updatePolicy:1}),n.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(n.engineLayerId)),n.engineLayerReferences=(n.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),O(this._location.spatialReference,this.view.spatialReference)||(this.location=new D({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){let t=e.manipulator3D;t.engineLayerReferences--;let n=t.engineLayerReferences===0;this._removeResourcesFromStage(),n&&(t.engineLayerId=null,r(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){ie(this.location,$,e.spatialReference)&&L(e.extent,$.x,$.y,e.spatialReference)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(this.elevationInfo==null)return;let e=null,t=0,n=F(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case`on-the-ground`:e=I(this.view.elevationProvider,this.location,`ground`)??0;break;case`relative-to-ground`:t=(I(this.view.elevationProvider,this.location,`ground`)??0)+n;break;case`relative-to-scene`:t=(I(this.view.elevationProvider,this.location,`scene`)??0)+n;break;case`absolute-height`:t=n}(t!==this._elevation.offset||e!==this._elevation.override)&&(this._elevation.offset=t,this._elevation.override=e)}_updateEngineObject(){if(!this._attached)return;if(!this.available){this._removeResourcesFromStage();return}let e=this._getWorldToScreenObjectScale(),t=K;if(this.autoScaleRenderObjects===!0){let n=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(n,t)}else this._calculateObjectTransform(e,t);let{objectsByState:n}=this._ensureEngineResources(),r=(this.focused?2:1)|(this.selected?8:4),i=this._noDisplayCount>0;for(let{stateMask:e,objects:a}of n){if(i){for(let e of a)e.visible=!1;continue}let n=!!(e&15),o=!!(e&65520),s=!n||(r&e)===(e&15),c=!o||(this.state&e)===(e&65520);if(s&&c)for(let e of a)e.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(e,t):f(e.transformation,t)||(e.transformation=t);else for(let e of a)e.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){let n=p(Q,t);if(e.geometries.every(({localOrigin:e})=>e!=null&&C(e.vec3,n))&&f(e.transformation,t))return;let r=z(n[0],n[1],n[2],`manipulator-${c()}`);for(let t of e.geometries)t.localOrigin=r;e.transformation=t}_ensureEngineResources(){if(this._engineResources==null){let e=this._engineLayer,t=[],n=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{n.has(e)||(t.push(e),n.add(e))});let r=new Map;this._renderObjects.forEach(e=>{let t=new B({castShadow:!1,geometries:[e.geometry]}),n=r.get(e.stateMask)||[];n.push(t),r.set(e.stateMask,n)});let i=[];r.forEach((e,t)=>i.push({stateMask:t,objects:e})),this._engineResources={objectsByState:i,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){let e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){let e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;let{objectsByState:t,layer:n}=this._engineResources;t.forEach(({objects:e})=>n.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e===`touch`?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){let t=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(t,he);return w(e,n[12],n[13],n[14])}_calculateModelTransformOffset(e){let t=this._calculateModelTransformPosition(e);return ne(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return m(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&h(t,t,this._worldFrame),h(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform!=null&&this._applyObjectTransform(t),t}get test(){}}function H(e){return e[12]!==0||e[13]!==0||e[14]!==0}function pe(e,t,r){switch(e.viewingMode){case`local`:return ee(r),!0;case`global`:{let i=re(e.renderCoordsHelper.spatialReference);return oe(t,0,J,0,i.radius),ae(n(J[0]),n(J[1]),r),!0}}}const me=a(),U=le(),W=de(),G=u(),he=g(),K=g(),q=ue(),J=T(),Y=T(),X=T(),Z=T(),Q=T(),ge=T(),$=new D({x:0,y:0,z:0,spatialReference:null}),_e=()=>{};export{fe as Manipulator3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o,initial as s,when as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as p,getEffectiveElevationMode as m}from"../../../../../support/elevationInfoUtils.js";import h from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as g}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as _}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as v}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as b}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as S}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as C}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as w}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as E,geometryTypeToDrawOperationGeometryType as D}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as O}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as k,SceneDrawSurface as A}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as j}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as M}from"../../../../../core/accessorSupport/trackingUtils.js";let N=class extends E{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type=`draw-3d`}initialize(){let{mode:e,offset:t,unit:n,featureExpressionInfo:r}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new h({mode:e,offset:t,unit:n,featureExpressionInfo:r})}normalizeCtorArgs(e){if(!e.elevationInfo){let t=e.hasZ??!0;return{...e,elevationInfo:p(t)}}return e}initializeGraphic(e){let{view:n}=this,r=this._createGraphicState=new T({graphic:e});return t([n.maskOccludee(e),n.trackGraphicState(r),a(()=>({element:this._outlineVisualElement,isDraped:r.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},o),M(()=>{j(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(r),...v(r)])}makeDrawOperation(){let{geometryType:e}=this,t=e!==`circle`&&e!==`rectangle`;return new O({view:this.view,manipulators:this.manipulators,geometryType:D(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new A(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new k(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new _,segmentLabels:t?new g:null,labelOptions:this.toolOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,this.elevationInfo)===`on-the-ground`,cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){let{view:i}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),n();let a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=c;let l=a.visualElements.zVerticalLine,u=new b({view:i,extensionType:l.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=u;let d=t([this._updatingHandles.add(()=>a.visualElements.zVerticalLine,e=>e.apply(u),s),this._updatingHandles.add(()=>({selectedColor:a.colors.selected.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)})]);return c.attached=!0,this._updateVerticalLineVisualElement(e),d}_updateVerticalLineVisualElement(e){let t=this._verticalLineVisualElement;if(!t)return;let{renderCoordsHelper:n,elevationProvider:r}=this.view;d(F,e[0],e[1],e[2]),P.setFromElevationInfo(this.elevationInfo),F[2]=C(F,r,P,n),n.toRenderCoords(F,this.view.spatialReference,F)?(t.setStartEndFromWorldDownAtLocation(F),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,n();let i=this.internalGraphicsLayer.elevationInfo,{view:a}=this,o=this._settings,c=new x({view:a,geometry:e,elevationInfo:i,isDraped:this._createGraphicState?this._createGraphicState.isDraped:m(this.hasZ,i)===`on-the-ground`,attached:!1,isDecoration:!0});this._outlineVisualElement=c;let l=t([this._updatingHandles.add(()=>o.visualElements.lineObjects.outline,e=>e.apply(c),s),this._updatingHandles.add(()=>o.visualElements.lineObjects.shadowStyle,e=>e.apply(c),s),n(()=>{this._outlineVisualElement=r(this._outlineVisualElement)})]);return c.attached=!0,c.laserlineEnabled=!0,l}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,n();let{view:i}=this,a=this._settings,o=a.manipulators.vertex,c=new S({view:i,spatialReference:i.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0}),l=t([this._updatingHandles.add(()=>({color:a.manipulators.vertex.color.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._verticesVisualElement=r(this._verticesVisualElement)})]);return c.attached=!0,this._verticesVisualElement=c,l}updateGraphicGeometry(e){if(this.geometryType===`mesh`&&e?.type===`point`){let t=this.geometryToPlace;t?.centerAt(e),j(this.tooltipInfos.mesh,t);let n=this._graphic;t&&n.geometry===t||(n.geometry=t)}else super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){let{drawOperation:r}=this;if(!this.geometryToPlace||e.displaying)return r.loading=!1,null;r.loading=!0;let a=n(()=>{r.loading=!1}),s,l=()=>{s&&cancelAnimationFrame(s)},u=()=>{l(),s=requestAnimationFrame(()=>a.remove())},d=null;return d=e.on(`changed`,()=>{d=i(d),u()}),t([d,c(()=>e.displaying,u,{...o,once:!0}),n(l),a])}};e([l({constructOnly:!0})],N.prototype,`elevationInfo`,void 0),e([l({constructOnly:!0})],N.prototype,`geometryType`,void 0),e([l()],N.prototype,`type`,void 0),e([l({constructOnly:!0})],N.prototype,`view`,void 0),N=e([u(`esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D`)],N);const P=new w,F=f();export{N as DrawGraphicTool3D};
2
+ import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o,initial as s,when as c}from"../../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import p from"../../../../../geometry/Point.js";import{getEffectiveElevationInfo as m,getEffectiveElevationMode as h}from"../../../../../support/elevationInfoUtils.js";import g from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as _}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as y}from"../meshFastUpdateUtils.js";import{Settings as b}from"../settings.js";import{ExtendedLineVisualElement as x}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as S}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as C}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as w}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as T}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as E}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as D,geometryTypeToDrawOperationGeometryType as O}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as k}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as A,SceneDrawSurface as j}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as M}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as N}from"../../../../../core/accessorSupport/trackingUtils.js";let P=class extends D{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new b({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type=`draw-3d`}initialize(){let{mode:e,offset:t,unit:n,featureExpressionInfo:r}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new g({mode:e,offset:t,unit:n,featureExpressionInfo:r})}normalizeCtorArgs(e){if(!e.elevationInfo){let t=e.hasZ??!0;return{...e,elevationInfo:m(t)}}return e}initializeGraphic(e){let{view:n}=this,r=this._createGraphicState=new E({graphic:e});return t([n.maskOccludee(e),n.trackGraphicState(r),a(()=>({element:this._outlineVisualElement,isDraped:r.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},o),N(()=>{M(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(r),...y(r)])}makeDrawOperation(){let{geometryType:e}=this,t=e!==`circle`&&e!==`rectangle`;return new k({view:this.view,manipulators:this.manipulators,geometryType:O(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new j(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new A(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new v,segmentLabels:t?new _:null,labelOptions:this.toolOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:h(this.hasZ,this.elevationInfo)===`on-the-ground`,cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){let{view:i}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),n();let a=this._settings,o=a.manipulators.vertex,c=new C({view:i,spatialReference:i.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=c;let l=a.visualElements.zVerticalLine,u=new x({view:i,extensionType:l.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=u;let d=t([this._updatingHandles.add(()=>a.visualElements.zVerticalLine,e=>e.apply(u),s),this._updatingHandles.add(()=>({selectedColor:a.colors.selected.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)})]);return c.attached=!0,this._updateVerticalLineVisualElement(e),d}_updateVerticalLineVisualElement(e){let t=this._verticalLineVisualElement;if(!t)return;let{renderCoordsHelper:n,elevationProvider:r}=this.view;d(I,e[0],e[1],e[2]),F.setFromElevationInfo(this.elevationInfo),L.x=I[0],L.y=I[1],L.z=I[2],L.spatialReference=this.view.spatialReference,I[2]=w(L,r,F,n),n.toRenderCoords(I,this.view.spatialReference,I)?(t.setStartEndFromWorldDownAtLocation(I),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,n();let i=this.internalGraphicsLayer.elevationInfo,{view:a}=this,o=this._settings,c=new S({view:a,geometry:e,elevationInfo:i,isDraped:this._createGraphicState?this._createGraphicState.isDraped:h(this.hasZ,i)===`on-the-ground`,attached:!1,isDecoration:!0});this._outlineVisualElement=c;let l=t([this._updatingHandles.add(()=>o.visualElements.lineObjects.outline,e=>e.apply(c),s),this._updatingHandles.add(()=>o.visualElements.lineObjects.shadowStyle,e=>e.apply(c),s),n(()=>{this._outlineVisualElement=r(this._outlineVisualElement)})]);return c.attached=!0,c.laserlineEnabled=!0,l}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,n();let{view:i}=this,a=this._settings,o=a.manipulators.vertex,c=new C({view:i,spatialReference:i.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0}),l=t([this._updatingHandles.add(()=>({color:a.manipulators.vertex.color.toUnitRGBA(),outlineColor:a.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{c.color=e,c.outlineColor=t},s),n(()=>{this._verticesVisualElement=r(this._verticesVisualElement)})]);return c.attached=!0,this._verticesVisualElement=c,l}updateGraphicGeometry(e){if(this.geometryType===`mesh`&&e?.type===`point`){let t=this.geometryToPlace;t?.centerAt(e),M(this.tooltipInfos.mesh,t);let n=this._graphic;t&&n.geometry===t||(n.geometry=t)}else super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){let{drawOperation:r}=this;if(!this.geometryToPlace||e.displaying)return r.loading=!1,null;r.loading=!0;let a=n(()=>{r.loading=!1}),s,l=()=>{s&&cancelAnimationFrame(s)},u=()=>{l(),s=requestAnimationFrame(()=>a.remove())},d=null;return d=e.on(`changed`,()=>{d=i(d),u()}),t([d,c(()=>e.displaying,u,{...o,once:!0}),n(l),a])}};e([l({constructOnly:!0})],P.prototype,`elevationInfo`,void 0),e([l({constructOnly:!0})],P.prototype,`geometryType`,void 0),e([l()],P.prototype,`type`,void 0),e([l({constructOnly:!0})],P.prototype,`view`,void 0),P=e([u(`esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D`)],P);const F=new T,I=f(),L=new p;export{P as DrawGraphicTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{empty as d,getMin as f,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as m}from"../../../../geometry/support/aaBoundingRect.js";import{featureExpressionInfoIsZero as h}from"../../../../support/elevationInfoUtils.js";import{manipulatedObjectGeometry as g}from"./manipulatedObjectUtils.js";import{ManipulatorState as _}from"./ManipulatorState.js";import{Settings as v}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as b}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as x}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as S}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as C}from"../../layers/graphics/ElevationContext.js";function w(t){let n=[],r=E(t,n);return T(t,n,r),{visualElement:r,remove:()=>e(n)}}function T(e,n,c){let{view:l,object:p}=e,m=new v({getTheme:()=>l.effectiveTheme}),x=new y({view:l,extensionType:m.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});n.push(i(()=>m.visualElements.zVerticalLine,e=>e.apply(x),a));let w=new b({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),T=r(m.visualElements.heightPlaneAngleCutoff),E=new b({view:l,attached:!1,angleCutoff:T,isDecoration:!0}),O=p.elevationInfo,k=C.fromElevationInfo(O),A=O.mode===`on-the-ground`||!O.offset&&O.mode!==`absolute-height`,N=new _,P=o(1);n.push(i(()=>({heightPlane:m.visualElements.heightPlane,alpha:P.value}),({heightPlane:e,alpha:t})=>e.apply(E,t),a));let F=o(1);n.push(i(()=>({shadowStyle:m.visualElements.pointObjects.shadowStyle,alpha:F.value}),({shadowStyle:e,alpha:t})=>e.apply(w,t),a));let I=()=>{N.update(e);let t=D(g(p)),n=A&&(p.isDraped||t==null||!t.hasZ),r=!0;if(!n&&t!=null){h(p.elevationInfo)&&(t=t.clone(),t.z=0);let e=S(t,l.elevationProvider,k,l.renderCoordsHelper);s(j,t.x,t.y,e),u(j,t.spatialReference,j,l.renderCoordsHelper.spatialReference),x.setStartEndFromWorldDownAtLocation(j),w.intersectsWorldUpAtLocation=j}else r=!1;let i=N.grabbingState&2?m.visualElements.laserlineAlphaMultiplier:1;P.value=i;let a=d(M);!n&&p.visible&&c.calculateMapBounds(a)&&u(f(a,j),l.spatialReference,j,l.renderCoordsHelper.spatialReference)?(E.heightManifoldTarget=j,E.attached=!0):E.attached=!1;let o=N.grabbingState&4?m.visualElements.laserlineAlphaMultiplier:1;F.value=o;let _=r&&p.visible&&!n;w.attached=_,x.attached=_};n.push(i(()=>[p.visible,p.isDraped],I),p.on(`committed`,I),l.elevationProvider.on(`elevation-change`,I)),e.forEachManipulator(e=>{n.push(e.events.on(`grab-changed`,I))}),n.push(t(w)),n.push(t(x)),n.push(t(E)),I()}function E(e,n){let{view:r,object:i}=e,a=new x({view:r,geometry:D(g(i)),elevationInfo:i.elevationInfo,isDecoration:!0});return O(e,a,n),n.push(t(a)),a}function D(e){return e==null?null:e.type===`point`?e:e.type===`mesh`?e.origin.clone():null}function O(e,t,n){let{view:r,object:o}=e,s=()=>{t.attached=o.visible},c=new v({getTheme:()=>r.effectiveTheme});k(e,t,n),c.visualElements.pointObjects.outline.apply(t),n.push(i(()=>o.visible,s,a))}function k(e,t,r){let{view:i,object:a}=e,o=null,s=e=>{o!=null&&(o.remove(),o=null),a.isDraped&&e!=null&&(o=A(i,e,()=>{t.geometry=e}))},c=()=>{let e=D(g(a));e!=null&&h(a.elevationInfo)&&(e.z=0),s(e),t.geometry=e};r.push(a.on(`committed`,c),n(()=>o)),c()}function A(e,t,n){let r=e.elevationProvider.spatialReference;l(t,j,r);let i=j[0],a=j[1];return e.elevationProvider.on(`elevation-change`,e=>{m(e.extent,i,a)&&n()})}const j=c(),M=p();export{w as createVisualElements};
2
+ import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import{signal as o}from"../../../../core/signal.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{empty as d,getMin as f,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{featureExpressionInfoIsZero as m}from"../../../../support/elevationInfoUtils.js";import{manipulatedObjectGeometry as h}from"./manipulatedObjectUtils.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{Settings as _}from"./settings.js";import{ExtendedLineVisualElement as v}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as y}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as b}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as x}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as S}from"../../layers/graphics/ElevationContext.js";import{containsElevationUpdatePoint as C}from"../../support/elevationUpdateExtentUtils.js";function w(t){let n=[],r=E(t,n);return T(t,n,r),{visualElement:r,remove:()=>e(n)}}function T(e,n,c){let{view:l,object:p}=e,b=new _({getTheme:()=>l.effectiveTheme}),C=new v({view:l,extensionType:b.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});n.push(i(()=>b.visualElements.zVerticalLine,e=>e.apply(C),a));let w=new y({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),T=r(b.visualElements.heightPlaneAngleCutoff),E=new y({view:l,attached:!1,angleCutoff:T,isDecoration:!0}),O=p.elevationInfo,k=S.fromElevationInfo(O),A=O.mode===`on-the-ground`||!O.offset&&O.mode!==`absolute-height`,N=new g,P=o(1);n.push(i(()=>({heightPlane:b.visualElements.heightPlane,alpha:P.value}),({heightPlane:e,alpha:t})=>e.apply(E,t),a));let F=o(1);n.push(i(()=>({shadowStyle:b.visualElements.pointObjects.shadowStyle,alpha:F.value}),({shadowStyle:e,alpha:t})=>e.apply(w,t),a));let I=()=>{N.update(e);let t=D(h(p)),n=A&&(p.isDraped||t==null||!t.hasZ),r=!0;if(!n&&t!=null){m(p.elevationInfo)&&(t=t.clone(),t.z=0);let e=x(t,l.elevationProvider,k,l.renderCoordsHelper);s(j,t.x,t.y,e),u(j,t.spatialReference,j,l.renderCoordsHelper.spatialReference),C.setStartEndFromWorldDownAtLocation(j),w.intersectsWorldUpAtLocation=j}else r=!1;let i=N.grabbingState&2?b.visualElements.laserlineAlphaMultiplier:1;P.value=i;let a=d(M);!n&&p.visible&&c.calculateMapBounds(a)&&u(f(a,j),l.spatialReference,j,l.renderCoordsHelper.spatialReference)?(E.heightManifoldTarget=j,E.attached=!0):E.attached=!1;let o=N.grabbingState&4?b.visualElements.laserlineAlphaMultiplier:1;F.value=o;let g=r&&p.visible&&!n;w.attached=g,C.attached=g};n.push(i(()=>[p.visible,p.isDraped],I),p.on(`committed`,I),l.elevationProvider.on(`elevation-change`,I)),e.forEachManipulator(e=>{n.push(e.events.on(`grab-changed`,I))}),n.push(t(w)),n.push(t(C)),n.push(t(E)),I()}function E(e,n){let{view:r,object:i}=e,a=new b({view:r,geometry:D(h(i)),elevationInfo:i.elevationInfo,isDecoration:!0});return O(e,a,n),n.push(t(a)),a}function D(e){return e==null?null:e.type===`point`?e:e.type===`mesh`?e.origin.clone():null}function O(e,t,n){let{view:r,object:o}=e,s=()=>{t.attached=o.visible},c=new _({getTheme:()=>r.effectiveTheme});k(e,t,n),c.visualElements.pointObjects.outline.apply(t),n.push(i(()=>o.visible,s,a))}function k(e,t,r){let{view:i,object:a}=e,o=null,s=e=>{o!=null&&(o.remove(),o=null),a.isDraped&&e!=null&&(o=A(i,e,()=>{t.geometry=e}))},c=()=>{let e=D(h(a));e!=null&&m(a.elevationInfo)&&(e.z=0),s(e),t.geometry=e};r.push(a.on(`committed`,c),n(()=>o)),c()}function A(e,t,n){return e.elevationProvider.on(`elevation-change`,e=>{(!l(t,j,e.spatialReference)||C(e.extent,j[0],j[1],e.spatialReference))&&n()})}const j=c(),M=p();export{w as createVisualElements};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{isUint32Array as u}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as d,convertUnit as f}from"../../../core/units.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import _ from"../../../geometry/HeightModelInfo.js";import{create as v}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as y}from"../../../geometry/support/heightModelInfoUtils.js";import{isInEffectiveScaleRange as b}from"../../../geometry/support/scaleUtils.js";import{isPlateCarree as x,isWebMercator as S,equals as C,isGeographic as w}from"../../../geometry/support/spatialReferenceUtils.js";import T from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as E,makeCacheKey as D,getHeightModelInfoFromVCS as O}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as k}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as A}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as j}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as M}from"./LayerView3D.js";import{addLayerViewToWasm as N,getLyr3DWasm as P,removeLayerViewFromWasm as F}from"./Lyr3DWasm.js";import{LayerElevationProvider as I}from"./i3s/LayerElevationProvider.js";import{ElevationRange as L}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as z}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as B,gaussiansPerPage as V,packedGaussianSizeInU32 as H,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as W}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as G}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as K}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as q}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as J}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as Y}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as X}from"../webgl-engine/lib/GaussianSplatShadows.js";import Z from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ee}from"../../support/layerViewUtils.js";import{TaskPriority as te}from"../../support/Scheduler.js";var Q;const ne=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`),re=(()=>{let e=new Int16Array(256);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/255));return e})();let $=class extends M(Z){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(B*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Set,this._pendingTileFadeOuts=new Map,this._pendingFadeDuration=l(0),this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(te.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=v();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw ee(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await N(this,t),a(t),this._renderer=new Y({view:e,layerView:this}),this.data=new W(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new X({view:e,layerView:this}),this.fadeHelper=new G(this),this._prepassDepthRenderer=new J({view:e,layerView:this});let n=new K(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new I({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return P(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return k(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new L(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return b(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!E(t))throw Error(`entity3D not valid`);let n=t.desc.geometry.prims[t.validPrimitiveIndices[0]];if(n.atrbs.length<1||n.atrbs[0].sem!==`GSplatPacked`)throw Error(`entity3D not valid`);let r=n.atrbs[0],i=t.assets[r.assetId];if(!i)throw Error(`entity3D not valid`);let a=i.count;if(a===0)return ne().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let o=null;if(i.dataType===`U32`&&u(i.data))o=i.data;else throw Error(`unexpected GaussianSplat Entity3D asset.data format`);let s=this.extractHeader(o),c=2.048,l=s.tileOrigin.x*c,d=s.tileOrigin.y*c,f=s.tileOrigin.z*c,p=t.desc,m=p.obb.quaternion,_=new z(p.obb.center,p.obb.halfSize,h(...m)),v=this.view.state.isGlobal,y=v?g(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:o,totalGaussians:a,packedHeader:s.packedHeader,tileOrigin:{x:l,y:d,z:f},invPosScale:s.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:v,ellipsoidRadius:y};this._renderablesBeingCreated.add(e.handle);let x;try{x=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal)}catch(t){throw this._renderablesBeingCreated.delete(e.handle),t}return this._renderablesBeingCreated.delete(e.handle),()=>x}*_createRenderableTask(e,t){let{handle:n,bufferView:r,totalGaussians:i,packedHeader:a,tileOrigin:o,invPosScale:s,obb:c,origin:l,isGlobal:u,ellipsoidRadius:d}=e,f=o.x,p=o.y,m=o.z,h=l.x,g=l.y,_=l.z,v=new Float32Array(i*3),y=new Uint32Array(i),b=new Uint32Array(i),x=[],S=Math.ceil(i/V),C=1/0,w=-1/0,T=1/0,E=-1/0,D=0,O=-1,k=0,A=0;for(let e=0;e<i;e++){let n=e*H,i=r[n],a=r[n+1],o=r[n+2],c=r[n+3],l=a&16383,d=a>>>14&16383,x=a>>>28&15|(o&1023)<<4,S=c>>>24,j=re[S],M=(o>>>10&255)+j,N=(o>>>18&255)+j,P=(o>>>26&63|(c&3)<<6)+j,F=M>0?M:0,I=N>0?N:0,L=P>0?P:0,R=F|I<<8|L<<16,z=Math.max(F,I,L),B=l*s+f,V=d*s+p,U=x*s+m;if(v[D]=B-h,v[D+1]=V-g,v[D+2]=U-_,u){let e=B*B+V*V+U*U;T=Math.min(T,e),E=Math.max(E,e)}else C=Math.min(C,U),w=Math.max(w,U);y[e]=i,b[e]=R,z>O&&(O=z),S>k&&(k=S),D+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),u&&(C=Math.sqrt(T)-d,w=Math.sqrt(E)-d);let j=this._extractGaussianSplatMbsRadiusSquared(O),{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(C=Math.max(C,M.zmin),w=Math.min(w,M.zmax));let N=new L(C,w),P=this.data.textureAtlas,F=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){let n=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<n;t++){let e=P.allocatePage();if(e===null&&(this._freeInvisibleTiles(),e=P.allocatePage()),e===null)throw Error(`ran out of gaussian splat memory`);x.push(e)}for(let t=e;t<n;){let e=x[t],o=t+1;for(;o<n&&x[o]===x[o-1]+1;)o++;let s=o-t,c=i-t*V,l=Math.min(c,s*V),u=t*B,d=l*H;this._pageBuffer.set(r.subarray(u,u+d));let f=e*V,p=f%U,m=Math.floor(f/U);P.update(p,m,this._pageBuffer,s),F.update(e,a,s),t=o}t.madeProgress()&&(t=yield)}}catch(e){throw P.freePages(x),e}let I=new q(n,c,x,v,y,b,i,j,k/255,N);return this._tileHandles.set(n,I),this._cacheTileMemory+=I.usedMemory,this._memCache.put(`${I.handle}`,I),{memUsageBytes:I.usedMemory,numGaussians:i}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*9}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._pendingTileFadeOuts.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);if(r){let i=!1;for(let t of this._pendingTileFadeOuts.values())t.incomingTileHandles.has(e)&&(t.visibilityChange=this._currentLyr3dVisibilityChange+1,i=!0);i&&(this._currentLyr3dVisibilityChange++,n=!0),r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this.freeObject(r),this._tileHandles.delete(e)}n&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this.fadeHelper.updateFadeDuration(),i=new ie(this._currentLyr3dVisibilityChange+1),a=new Set,o=!1;for(let s=0;s<n;s++){let n=this._tileHandles.get(e[s]);if(!n)continue;let c=t[s]?this._prepareTileFadeIn(n,r):this._prepareTileFadeOut(n,i);t[s]&&i.incomingTileHandles.add(n.handle),c&&a.add(n.handle),o||=c}if(o){if(this._currentLyr3dVisibilityChange++,this._pendingFadeDuration=r,this._updatePendingTileHandoffs(a,i),i.incomingTileHandles.size===0)for(let e of this._tileFadeInsAwaitingInitialSort)i.incomingTileHandles.add(e);this.updateGaussians()}}_updatePendingTileHandoffs(e,t){for(let n of new Set(this._pendingTileFadeOuts.values())){if(n===t)continue;let r=!1;for(let i of e)n.incomingTileHandles.has(i)&&(r=!0,t.incomingTileHandles.size>0&&n.incomingTileHandles.delete(i));if(r){n.visibilityChange=t.visibilityChange;for(let e of t.incomingTileHandles)n.incomingTileHandles.add(e)}}}_prepareTileFadeIn(e,t){let n=this._pendingTileFadeOuts.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,t),!1):this._tileFadeInsAwaitingInitialSort.has(e.handle)?n:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.add(e.handle),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._pendingTileFadeOuts.has(e.handle)?n:(this._pendingTileFadeOuts.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0,this._triggerFadeIns(e,n);let r=this._triggerFadeOuts(t,n);n.length>0&&this.notifyTileObbsChanged(n),r&&this.updateGaussians()}_triggerFadeIns(e,t){for(let n of e)this._tileHandles.get(n.handle)===n&&this._tileFadeInsAwaitingInitialSort.delete(n.handle)&&(n.lifecycleState=2,t.push(n),this.fadeHelper.fadeTile(n,0,this._pendingFadeDuration))}_triggerFadeOuts(e,t){let n=!1;for(let t of this._pendingTileFadeOuts.values())if(e>=t.visibilityChange){n=!0;break}if(!n)return!1;let r=this._pendingFadeDuration,i=this._pendingFadeDuration;for(let e of this._tileHandles.values()){let{fadeDirection:t,fadeDuration:n,fadeProgress:a}=e;if(t!==0||n==null||a==null)continue;let o=n*(1-a);r=l(Math.max(r,o)),i=l(Math.max(i,n))}let a=!1;for(let[n,o]of this._pendingTileFadeOuts){if(e<o.visibilityChange)continue;this._pendingTileFadeOuts.delete(n);let s=this._tileHandles.get(n);if(s){let e=s.lifecycleState===2,n=s.opacityModifier===1?r:i;this.fadeHelper.fadeTile(s,1,n),e&&s.lifecycleState===0&&(t.push(s),a=!0)}}return a}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(D(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(D(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),F(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||x(this.view.renderSpatialReference)||S(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&C(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=O(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=w(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=d(T.units[T[t.wkid]])),r&&(e=new _({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=y(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=f(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,k(e));else{let t=A(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}extractHeader(e){let t=e.length-4,n=this.reinterpretU32AsFloat(e[t]),r=this.reinterpretU32AsFloat(e[t+1]),i=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(e[t+3]&255));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:n,y:r,z:i},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new j(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([p()],$.prototype,`layer`,void 0),e([p({readOnly:!0})],$.prototype,`_clippingBox`,null),e([p()],$.prototype,`elevationOffset`,null),e([p({readOnly:!0})],$.prototype,`visibleAtCurrentScale`,null),e([p()],$.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([p()],$.prototype,`maximumGaussianCount`,null),$=Q=e([m(`esri.views.3d.layers.GaussianSplatLayerView3D`)],$);class ie{constructor(e){this.visibilityChange=e,this.incomingTileHandles=new Set}}const ae=$;export{ae as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{unitFromRESTJSON as u,convertUnit as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/HeightModelInfo.js";import{create as g}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as _}from"../../../geometry/support/heightModelInfoUtils.js";import{isInEffectiveScaleRange as v}from"../../../geometry/support/scaleUtils.js";import{isPlateCarree as y,isWebMercator as b,equals as x,isGeographic as S}from"../../../geometry/support/spatialReferenceUtils.js";import C from"../../../geometry/support/WKIDUnitConversion.js";import{makeCacheKey as w,getHeightModelInfoFromVCS as T}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as E}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as D}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as O}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as k}from"./LayerView3D.js";import{addLayerViewToWasm as A,getLyr3DWasm as j,removeLayerViewFromWasm as M}from"./Lyr3DWasm.js";import{LayerElevationProvider as N}from"./i3s/LayerElevationProvider.js";import{projectToBoundingBox as P}from"../support/extentUtils.js";import{GaussianSplatDataStore as F}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as I}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTileBuilder as R}from"../support/gaussianSplatting/GaussianTileBuilder.js";import{GaussianSplatDepthRenderer as z}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as B}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as V}from"../webgl-engine/lib/GaussianSplatShadows.js";import H from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as U}from"../../support/layerViewUtils.js";import{TaskPriority as W}from"../../support/Scheduler.js";const G=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`);let K=class extends k(H){constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Set,this._pendingTileFadeOuts=new Map,this._pendingFadeDuration=l(0),this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null;let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(W.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=g();return P(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw U(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await A(this,t),a(t),this._renderer=new B({view:e,layerView:this}),this.data=new F(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._tileBuilder=new R(this.data.textureAtlas,this.data.headerTexture,()=>this._freeInvisibleTiles()),this._shadows=new V({view:e,layerView:this}),this.fadeHelper=new I(this),this._prepassDepthRenderer=new z({view:e,layerView:this});let n=new L(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new N({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return j(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return E(this.layer.elevationInfo)}get elevationRange(){return this._intersectionHandler?.elevationRange}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return v(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let t=this._tileBuilder.prepare(e);if(!t)return G().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let n=this.view.state.isGlobal,r=n?m(this.view.spatialReference).radius:0,i={...t,isGlobal:n,ellipsoidRadius:r};this._renderablesBeingCreated.add(e.handle);let a;try{a=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(i,e),this._createRenderableAbortController.signal)}finally{this._renderablesBeingCreated.delete(e.handle)}return()=>a}*_createRenderableTask(e,t){let n=yield*this._tileBuilder.build(e,t);return this._tileHandles.set(n.handle,n),this._cacheTileMemory+=n.usedMemory,this._memCache.put(`${n.handle}`,n),{memUsageBytes:n.usedMemory,numGaussians:n.gaussianCount}}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._pendingTileFadeOuts.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);if(r){let i=!1;for(let t of this._pendingTileFadeOuts.values())t.incomingTileHandles.has(e)&&(t.visibilityChange=this._currentLyr3dVisibilityChange+1,i=!0);i&&(this._currentLyr3dVisibilityChange++,n=!0),r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this._removeTileCacheEntry(r),this._tileHandles.delete(e)}n&&this.updateActiveTileVisibility()}_removeTileCacheEntry(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this.fadeHelper.updateFadeDuration(),i=new q(this._currentLyr3dVisibilityChange+1),a=new Set,o=!1;for(let s=0;s<n;s++){let n=this._tileHandles.get(e[s]);if(!n)continue;let c=t[s]?this._prepareTileFadeIn(n,r):this._prepareTileFadeOut(n,i);t[s]&&i.incomingTileHandles.add(n.handle),c&&a.add(n.handle),o||=c}if(o){if(this._currentLyr3dVisibilityChange++,this._pendingFadeDuration=r,this._updatePendingTileHandoffs(a,i),i.incomingTileHandles.size===0)for(let e of this._tileFadeInsAwaitingInitialSort)i.incomingTileHandles.add(e);this.updateActiveTileVisibility()}}_updatePendingTileHandoffs(e,t){for(let n of new Set(this._pendingTileFadeOuts.values())){if(n===t)continue;let r=!1;for(let i of e)n.incomingTileHandles.has(i)&&(r=!0,t.incomingTileHandles.size>0&&n.incomingTileHandles.delete(i));if(r){n.visibilityChange=t.visibilityChange;for(let e of t.incomingTileHandles)n.incomingTileHandles.add(e)}}}_prepareTileFadeIn(e,t){let n=this._pendingTileFadeOuts.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,t),!1):this._tileFadeInsAwaitingInitialSort.has(e.handle)?n:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.add(e.handle),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._pendingTileFadeOuts.has(e.handle)?n:(this._pendingTileFadeOuts.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0,this._triggerFadeIns(e,n);let r=this._triggerFadeOuts(t,n);n.length>0&&this.notifyTileObbsChanged(n),r&&this.updateActiveTileVisibility()}_triggerFadeIns(e,t){for(let n of e)this._tileHandles.get(n.handle)===n&&this._tileFadeInsAwaitingInitialSort.delete(n.handle)&&(n.lifecycleState=2,t.push(n),this.fadeHelper.fadeTile(n,0,this._pendingFadeDuration))}_triggerFadeOuts(e,t){let n=!1;for(let t of this._pendingTileFadeOuts.values())if(e>=t.visibilityChange){n=!0;break}if(!n)return!1;let r=this._pendingFadeDuration,i=this._pendingFadeDuration;for(let e of this._tileHandles.values()){let{fadeDirection:t,fadeDuration:n,fadeProgress:a}=e;if(t!==0||n==null||a==null)continue;let o=n*(1-a);r=l(Math.max(r,o)),i=l(Math.max(i,n))}let a=!1;for(let[n,o]of this._pendingTileFadeOuts){if(e<o.visibilityChange)continue;this._pendingTileFadeOuts.delete(n);let s=this._tileHandles.get(n);if(s){let e=s.lifecycleState===2,n=s.opacityModifier===1?r:i;this.fadeHelper.fadeTile(s,1,n),e&&s.lifecycleState===0&&(t.push(s),a=!0)}}return a}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(w(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(w(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),M(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._tileBuilder=null,this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||y(this.view.renderSpatialReference)||b(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&x(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=T(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=S(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=u(C.units[C[t.wkid]])),r&&(e=new h({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=_(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=d(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,E(e));else{let t=D(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateActiveTileVisibility(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new O(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([f()],K.prototype,`layer`,void 0),e([f({readOnly:!0})],K.prototype,`_clippingBox`,null),e([f()],K.prototype,`elevationOffset`,null),e([f({readOnly:!0})],K.prototype,`visibleAtCurrentScale`,null),e([f()],K.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([f()],K.prototype,`maximumGaussianCount`,null),K=e([p(`esri.views.3d.layers.GaussianSplatLayerView3D`)],K);class q{constructor(e){this.visibilityChange=e,this.incomingTileHandles=new Set}}const J=K;export{J as default};