@arcgis/core 5.0.0-next.15 → 5.0.0-next.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/analysis/ElevationProfile/ElevationProfileLineInput.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/234b52b2a391631ceff6.js +1 -0
  4. package/assets/esri/core/workers/chunks/{8f3503b2fb6cd38757b9.js → 458e87902abc24b375da.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{57b410198d83bf0ab708.js → 4a89e120be142ab58a27.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{a410dcf80d17a2383337.js → 65a4099bdbe31834d0cc.js} +1 -1
  7. package/assets/esri/core/workers/chunks/71d9e9b0a7f8c0edd32d.js +1 -0
  8. package/assets/esri/core/workers/chunks/722da7a39a0ad9300752.js +1 -0
  9. package/assets/esri/core/workers/chunks/{cdb4664fd59860ddeb5a.js → 888f188541f8bd68e33e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{319c3f46f2afb8f3e5a9.js → 89c9cf7f799858d14c76.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{e19cd07df8ce87e18832.js → 8b33732e3c2924c1f60d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/98739414c107ad78e4d8.js +1 -0
  13. package/assets/esri/core/workers/chunks/{bc318b6fef192cee2a72.js → a4518f25b9f8fe704286.js} +17 -17
  14. package/assets/esri/core/workers/chunks/{8b73db0f4d6714396eb0.js → a6fa90eab77ac0e1cdfc.js} +1 -1
  15. package/assets/esri/core/workers/chunks/ac366221e8636b60aee5.js +1 -0
  16. package/assets/esri/core/workers/chunks/{23e17b745adf71a5efc7.js → aca72ca7f43f70eb8077.js} +1 -1
  17. package/assets/esri/core/workers/chunks/ad0c7225941437d18408.js +1 -0
  18. package/assets/esri/core/workers/chunks/b30897952494a3e5b9fe.js +1 -0
  19. package/assets/esri/core/workers/chunks/bfd3d81e8e148be99686.js +1 -0
  20. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  21. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  22. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  23. package/assets/esri/themes/base/widgets/_FeatureForm.scss +1 -1
  24. package/assets/esri/themes/dark/main.css +1 -1
  25. package/assets/esri/themes/light/main.css +1 -1
  26. package/assets/esri/themes/light/view.css +1 -1
  27. package/chunks/GaussianSplat.glsl.js +2 -2
  28. package/chunks/lyr3DMain.js +1 -1
  29. package/config.js +1 -1
  30. package/core/accessorSupport/ensureType.js +1 -1
  31. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  32. package/graphic/graphicOriginUtils.js +1 -1
  33. package/interfaces.d.ts +68 -28
  34. package/kernel.js +1 -1
  35. package/layers/BingMapsLayer.js +1 -1
  36. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  37. package/layers/support/attributionUtils.js +5 -0
  38. package/layers/support/fieldConfigUtils.js +1 -1
  39. package/layers/support/fieldFormatUtils.js +1 -1
  40. package/layers/video/VideoController.js +1 -1
  41. package/libs/parquet/parquet.js +1 -1
  42. package/package.json +1 -1
  43. package/support/revision.js +1 -1
  44. package/symbols/cim/SDFHelper.js +1 -1
  45. package/symbols/cim/cimAnalyzer.js +1 -1
  46. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  47. package/views/2d/engine/flow/dataUtils.js +1 -1
  48. package/views/2d/engine/webgl/TextureManager.js +1 -1
  49. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedPolyShader.js +1 -1
  50. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  55. package/views/2d/layers/features/Processor.js +1 -1
  56. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  57. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  58. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  59. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  60. package/views/3d/analysis/ElevationProfile/ElevationProfileGeometryVisualization3D.js +1 -1
  61. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  62. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  63. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  64. package/views/3d/environment/CloudsCompositionTechnique.js +1 -1
  65. package/views/3d/environment/CloudsTechnique.js +1 -1
  66. package/views/3d/environment/FogTechnique.js +1 -1
  67. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  68. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  69. package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
  70. package/views/3d/layers/FlowSubView3D.js +1 -1
  71. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  72. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  73. package/views/3d/layers/TiledLayerView3D.js +1 -1
  74. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  75. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  76. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  77. package/views/3d/support/DisplayQualityProfile.js +1 -1
  78. package/views/3d/support/QualitySettings.js +1 -1
  79. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  80. package/views/3d/support/flow/FlowWorker.js +1 -1
  81. package/views/3d/support/flow/FlowWorkerHandle.js +1 -1
  82. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  83. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  84. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  85. package/views/3d/support/flow/constants.js +1 -1
  86. package/views/3d/support/flow/loadUtils.js +1 -1
  87. package/views/3d/support/popupHitTest.js +1 -1
  88. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  89. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  90. package/views/3d/terrain/TerrainSurface.js +1 -1
  91. package/views/3d/terrain/TileAgent.js +1 -1
  92. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  93. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  94. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  95. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  96. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -32
  97. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +17 -0
  98. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +10 -0
  99. package/views/3d/webgl-engine/core/shaderTechnique/{ReloadableShaderModule.js → ReloadableShader.js} +1 -1
  100. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  101. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  102. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  103. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  104. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  105. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  106. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  107. package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  110. package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
  111. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightTechnique.js +1 -1
  112. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
  113. package/views/3d/webgl-engine/effects/laserlines/LaserlineTechnique.js +1 -1
  114. package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
  115. package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
  116. package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
  117. package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
  118. package/views/3d/webgl-engine/effects/ssao/SSAOBlurTechnique.js +1 -1
  119. package/views/3d/webgl-engine/effects/ssao/SSAOTechnique.js +1 -1
  120. package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
  121. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  122. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  123. package/views/3d/webgl-engine/lib/Program.js +1 -1
  124. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  125. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  126. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  127. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  128. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +5 -0
  129. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +5 -0
  130. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  131. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  132. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  133. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  134. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  135. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  136. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  137. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  138. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  139. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +1 -1
  140. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  141. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +1 -1
  142. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  143. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  144. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  145. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechnique.js +1 -1
  146. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  147. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +1 -1
  148. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  149. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  150. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +1 -1
  151. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  152. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  153. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  154. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  155. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  156. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  157. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  158. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  159. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +1 -1
  160. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  161. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  162. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  163. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  164. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  166. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +1 -1
  167. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  168. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  169. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  170. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  171. package/views/SceneView.js +1 -1
  172. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  173. package/views/analysis/ElevationProfile/types.d.ts +5 -0
  174. package/views/analysis/ElevationProfile/types.js +5 -0
  175. package/views/input/gamepad/GamepadInputDevice.js +1 -1
  176. package/views/input/gamepad/GamepadSource.js +1 -1
  177. package/views/navigation/gamepad/GamepadSettings.js +1 -1
  178. package/views/webgl/VertexAttributeLocations.js +1 -1
  179. package/widgets/Attribution/AttributionViewModel.js +1 -1
  180. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  181. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  182. package/widgets/Editor/UpdateWorkflow.js +1 -1
  183. package/widgets/Editor/Workflow.js +1 -1
  184. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  185. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  186. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  187. package/widgets/Editor.js +1 -1
  188. package/widgets/Feature/support/featureUtils.js +1 -1
  189. package/widgets/FeatureTable/FieldColumn.js +1 -1
  190. package/widgets/FeatureTable/Grid/Column.js +1 -1
  191. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  192. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  193. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  194. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  195. package/assets/esri/core/workers/chunks/097e5deb51ee7e25e654.js +0 -1
  196. package/assets/esri/core/workers/chunks/38ee69125da60464d5a1.js +0 -1
  197. package/assets/esri/core/workers/chunks/4f0016111fd84c612f41.js +0 -1
  198. package/assets/esri/core/workers/chunks/8208dfa8f7fae7e616b9.js +0 -1
  199. package/assets/esri/core/workers/chunks/847f4fc39100fac1df01.js +0 -1
  200. package/assets/esri/core/workers/chunks/ab005fe84952f0676020.js +0 -1
  201. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +0 -1
  202. package/assets/esri/core/workers/chunks/c3dcfe26c2c3c829762d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import n from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as c}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as h}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as u}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as g}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as p}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as y}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as d}from"./processor/BinningStrategy.js";import{ClusterStrategy as _}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as l}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as m}from"./processor/TrackStrategy.js";import{AttributeStore as f}from"./support/AttributeStore.js";import{ComputedAttributeStorage as b}from"./support/ComputedAttributeStorage.js";class w{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new g,this._proxy=new u({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new f({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(e,s,r,i,o){const c=e.processor,u=t(this._schema?.storage,c.storage),g=t(this._schema?.mesh.properties,c.mesh.properties),y=t(this._schema?.mesh.factory,c.mesh.factory),d=t(this._schema?.mesh.strategy,c.mesh.strategy),_=S(this._schema?.expressionProperties,c.expressionProperties),l=_.some(e=>this._attributeStore.hasArcadeDependency(e)),m=_.some(e=>this._factory?.hasArcadeDependency(e)??!1),f=_.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&l,w=m||f,I=g||y||d;if(!(u||I||(m||l||f))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,c),schema:c}),this._schema=c;const x=n.fromJSON(this._source.metadata.outSpatialReference),v=new b({fields:this._source.metadata.fieldsIndex,spatialReference:x}),M={currentUser:c.mesh.properties.currentUser};if((u||I||l)&&(await this._attributeStore.update(c.storage,v,this._source.metadata,s),this._strategy?.invalidateAttributeData(j(c))),!i&&!I&&!w)return!1;(d||g||w)&&await this._updateStrategy(c.mesh.strategy,x,o,j(c),M),this._updateSortKey(v,"sortKey"in c.mesh.properties?c.mesh.properties.sortKey:null);const k="dictionary"===c.mesh.factory.symbology.type?c.mesh.factory.symbology.fieldMap:null,U=new p(v,this._proxy,r,this._registry,k);return(y||"dictionary"===c.mesh.factory.symbology.type)&&(this._factory=await h.create(U,c.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e){if(!this._strategy)return;const t=this._strategy.applyOverrideUpdate(e);for await(const r of t)try{await this._process(r)}catch(s){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const e=this._strategy.updateChunks(),t=[],r=new Map;for await(const a of e){let e=r.get(a.id);null==e&&(e=new y({concurrency:16,process:e=>this._process(e)}),r.set(a.id,e));const i=e.push(a).catch(e=>s(e));t.push(i)}try{await Promise.all(t)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r,i){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new l(this._source,this._attributeStore,r,i);break;case"binning":this._strategy=await d.create(e,t,this._source,this._attributeStore,r,i);break;case"cluster":this._strategy=await _.create(this._connection,e,t,this._source,this._attributeStore,r,i);break;case"track":this._strategy=await m.create(e,t,this._source,this._attributeStore,r,i)}for(const a of s)this._strategy.onSubscribe(a)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e){const t=e.subscription;if(has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,s),r(t.signal);const i=await this._write(e,t.tile.createArcadeEvaluationOptions(j(this._schema)),s),a=t.tile.tileInfoView.getLODInfoAt(t.tile.key);r(t.signal);const{message:o,transferList:n}=i.serialize(a),c={objectIdMap:null,inner:e.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)c.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(t.signal),await this._connection.container.onMessage(c,{signal:t.signal,transferList:n}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(j(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s){const a=e.subscription.tile,o=e.reader?.getCursor(),n=o?.getSize()??0,h=a.tileInfoView.tileInfo.isWrappable,u=a.tileInfoView.tileInfo.spatialReference.isWGS84,g=new c(a.key,this._strategy.enablePixelBuffering,h,u,n);if(!o)return g;const p=a.createArcadeEvaluationOptions(j(this._schema));let y=0;for(;o.next();){++y%1e3||(await i(0),r(e.subscription));const n=this._getSortKeyValue(o,t);g.entityStart(o.getDisplayId(),n),this._factory.write(g,this._proxy,o,p,s,a.level),g.entityEnd()}return g}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function S(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function j(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}export{w as default};
5
+ import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{notDeepEqual as e}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as u}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as g}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as p}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as y}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as _}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as l}from"./processor/TrackStrategy.js";import{AttributeStore as m}from"./support/AttributeStore.js";import{ComputedAttributeStorage as f}from"./support/ComputedAttributeStorage.js";class b{constructor(t,e){this._connection=t,this._source=e,this._version=1,this._registry=new u,this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new m({isLocal:!1,update:t=>o(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let t=0;return t+=this._attributeStore.usedMemory,this._strategy&&(t+=this._strategy.usedMemory),t}get version(){return this._version}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[],tracks:[]}}getDisplayIds(t){const e={};return this._strategy?(this._strategy.displayMap(t,t=>t,(t,s,r)=>{e[r]=t}),e):e}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(t,s,r,i,o){const n=t.processor,h=e(this._schema?.storage,n.storage),u=e(this._schema?.mesh.properties,n.mesh.properties),p=e(this._schema?.mesh.factory,n.mesh.factory),y=e(this._schema?.mesh.strategy,n.mesh.strategy),d=w(this._schema?.expressionProperties,n.expressionProperties),_=d.some(t=>this._attributeStore.hasArcadeDependency(t)),l=d.some(t=>this._factory?.hasArcadeDependency(t)??!1),m=d.some(t=>this._strategy?.hasArcadeDependency(t))||this._strategy?.isAggregate&&_,b=l||m,I=u||p||y;if(!(h||I||(l||_||m))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,n),schema:n}),this._schema=n;const j=new f({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),x={currentUser:n.mesh.properties.currentUser};if((h||I||_)&&(await this._attributeStore.update(n.storage,j,this._source.metadata,s),this._strategy?.invalidateAttributeData(S(n))),!i&&!I&&!b)return!1;(y||u||b)&&await this._updateStrategy(n.mesh.strategy,o,S(n),x),this._updateSortKey(j,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const v="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,M=new g(j,this._proxy,r,this._registry,v);return(p||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await c.create(M,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(t){if(!this._strategy)return;const e=this._strategy.applyOverrideUpdate(t);for await(const r of e)try{await this._process(r)}catch(s){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(t.map(({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1})),t);const e=this._strategy.displayMap(t,({objectId:t})=>t,(t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e}));this._attributeStore.setHighlight(e,t)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],r=new Map;for await(const a of t){let t=r.get(a.id);null==t&&(t=new p({concurrency:16,process:t=>this._process(t)}),r.set(a.id,t));const i=t.push(a).catch(t=>s(t));e.push(i)}try{await Promise.all(e)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new _(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await y.create(t,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await d.create(this._connection,t,this._source,this._attributeStore,s,r);break;case"track":this._strategy=await l.create(t,this._source,this._attributeStore,s,r)}for(const i of e)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(t,s),r(e.signal);const i=await this._write(t,e.tile.createArcadeEvaluationOptions(S(this._schema)),s),a=e.tile.tileInfoView.getLODInfoAt(e.tile.key);r(e.signal);const{message:o,transferList:n}=i.serialize(a),c={objectIdMap:null,inner:t.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const e=t.reader?.getCursor();if(e)for(;e.next();)c.objectIdMap[e.getDisplayId()]=e.getObjectId()}if(r(e.signal),await this._connection.container.onMessage(c,{signal:e.signal,transferList:n}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t,e){await this._fetchMatcherResources(t),await this._fetchWriterResources(t,e)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t,e){if(!t.reader)return;const s=t.reader.getCursor(),r=t.subscription.tile.createArcadeEvaluationOptions(S(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,e);await this._proxy.fetchEnqueuedResources()}async _write(t,e,s){const a=t.subscription.tile,o=t.reader?.getCursor(),c=o?.getSize()??0,h=a.tileInfoView.tileInfo.isWrappable,u=a.tileInfoView.tileInfo.spatialReference.isWGS84,g=new n(a.key,this._strategy.enablePixelBuffering,h,u,c);if(!o)return g;const p=a.createArcadeEvaluationOptions(S(this._schema));let y=0;for(;o.next();){++y%1e3||(await i(0),r(t.subscription));const n=this._getSortKeyValue(o,e);g.entityStart(o.getDisplayId(),n),this._factory.write(g,this._proxy,o,p,s,a.level),g.entityEnd()}return g}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function w(t,e){const s=[];return t?.timeExtent?.start===e.timeExtent?.start&&t?.timeExtent?.end===e.timeExtent?.end||s.push("timeProperties"),s}function S(t){const{timeZone:e}=t?.mesh.properties??{},{timeExtent:s}=t?.expressionProperties??{};return{timeZone:e,timeExtent:s}}export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../geometry/SpatialReference.js";import{convertToFeature as t,unquantizeOptimizedGeometryInPlace as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as a}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as r}from"../../../../../layers/graphics/data/projectionSupport.js";import i from"../../../../../layers/support/FieldsIndex.js";import{ComputedAggregateField as o}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as d,FeatureTileUpdateMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as u}from"../support/ComputedAttributeStorage.js";import f from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as h}from"../support/FeatureSetReaderJSON.js";import m from"../../../tiling/TileKey.js";class g extends l{constructor(e,t){super(e),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.done=!1}destroy(){const e=this.subscription.tile.key.level;for(const t of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${t}.${e}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const e of this.featureCache.values()){const t=e.clone();t.geometry&&s(t.geometry,this.subscription.tile.transform),yield t}}}class y extends n{static async create(t,s,a,i,n,l){const d=new u({spatialReference:s}),c=await Promise.all(t.fields.map(async e=>o.create(d,e))),p=t.featureFilter?await f.create({geometryType:a.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:a.metadata.timeInfo,fieldsIndex:a.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null;return"geohash"===t.index.type&&await r(s,e.WGS84),new y(t,p,n,c,s,a,i,l)}constructor(e,t,s,a,r,o,n,l){super(o,n,r,a,l),this._schema=e,this._featureFilter=t,this._arcadeContextInfo=s,this._metadata=p.createFeature({geometryType:"esriGeometryPolygon",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new i(e.fields).toJSON(),globalIdField:null,spatialReference:o.metadata.spatialReference,outSpatialReference:o.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}createState(e){return new g(e,this._attributeStore)}async*applyOverrideUpdate(e){for(const t of this._sendStates.values()){t.reset();const e=new d(t.subscription,h.empty(this._source.metadata),!0,!1,{});yield e}}displayMap(e,t,s){const a=new Map(e.map(e=>[t(e),e])),r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace()){const{objectId:t,displayId:i}=e,o=a.get(t);if(null!=o){const e=s(i,o,t);r.push(e),a.delete(t)}}return r}getDisplayFeatures(e){const s=new Set(e),a=new Set,r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace())s.has(e.displayId)&&!a.has(e.objectId)&&(e.geometry&&r.push({...t(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),a.add(e.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.containedObjectIds);return[]}async*updateChunks(){for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._sendStates.values())for(const a of s.featuresWorldSpace())t.has(a.objectId)||(e(a),t.add(a.objectId))}_createIndexOptions(e){switch(this._schema.index.type){case"geohash":return{type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:e.scale,sqlOptions:this._sqlOptions};case"grid":{const t=this._schema.index.fixedBinLevel,s=null!=t?e.tileInfoView.getLODInfoAt(t).scale:e.scale;return{type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:s,sqlOptions:this._sqlOptions}}}}async*_update(e,t){const{handledChunks:s,subscription:r,bins:i,featureCache:o}=e,n=r.tile;if(e.done)return;for(const a of t.chunks()){if(s.has(a.chunkId))continue;s.add(a.chunkId);const t=a.queryInfo;if("tileId"in t){const e=new m(t.tileId);if(e.level!==n.level||e.world!==n.key.world)continue}a.getAggregateIndex(this._createIndexOptions(e.tile)).putBounded(i,e.tile.extent,e.tile.resolution)}const l=[],d=r.tile.transform,u=r.tile.key.level;for(const c of i.values()){let e=o.get(c.id);if(e)e.attributes=c.getAttributes();else{const t=c.getGeometry(this.spatialReference,d);e=new a(t,c.getAttributes(),null,c.id),t||(e.centroid=c.getGeometricCentroid(this.spatialReference,d)),e.displayId=this._attributeStore.createDisplayIdForObjectId(`${e.objectId}.${u}`),o.set(c.id,e)}l.push(e)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const f=h.fromOptimizedFeatures(l,this._metadata,d),p=f.getCursor(),g=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;p.next();)this._attributeStore.setAttributeData(p.getDisplayId(),p,g,this._sqlOptions);const y=new c(e.subscription,f,[],e.done,{});yield y}}export{g as BinningState,y as BinningStrategy};
5
+ import e from"../../../../../geometry/SpatialReference.js";import{convertToFeature as t,unquantizeOptimizedGeometryInPlace as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as a}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as r}from"../../../../../layers/graphics/data/projectionSupport.js";import i from"../../../../../layers/support/FieldsIndex.js";import{ComputedAggregateField as o}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as d,FeatureTileUpdateMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as u}from"../support/ComputedAttributeStorage.js";import f from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as h}from"../support/FeatureSetReaderJSON.js";import m from"../../../tiling/TileKey.js";class g extends l{constructor(e,t){super(e),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.done=!1}destroy(){const e=this.subscription.tile.key.level;for(const t of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${t}.${e}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const e of this.featureCache.values()){const t=e.clone();t.geometry&&s(t.geometry,this.subscription.tile.transform),yield t}}}class y extends n{static async create(t,s,a,i,n){const l=s.metadata.outSpatialReference,d=new u({spatialReference:l}),c=await Promise.all(t.fields.map(async e=>o.create(d,e))),p=t.featureFilter?await f.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:l,filterJSON:t.featureFilter}):null;return"geohash"===t.index.type&&await r(l,e.WGS84),new y(t,p,i,c,l,s,a,n)}constructor(e,t,s,a,r,o,n,l){super(o,n,r,a,l),this._schema=e,this._featureFilter=t,this._arcadeContextInfo=s,this._metadata=p.createFeature({geometryType:"esriGeometryPolygon",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new i(e.fields).toJSON(),globalIdField:null,spatialReference:o.metadata.spatialReference,outSpatialReference:o.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}createState(e){return new g(e,this._attributeStore)}async*applyOverrideUpdate(e){for(const t of this._sendStates.values()){t.reset();const e=new d(t.subscription,h.empty(this._source.metadata),!0,!1,{});yield e}}displayMap(e,t,s){const a=new Map(e.map(e=>[t(e),e])),r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace()){const{objectId:t,displayId:i}=e,o=a.get(t);if(null!=o){const e=s(i,o,t);r.push(e),a.delete(t)}}return r}getDisplayFeatures(e){const s=new Set(e),a=new Set,r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace())s.has(e.displayId)&&!a.has(e.objectId)&&(e.geometry&&r.push({...t(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),a.add(e.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.containedObjectIds);return[]}async*updateChunks(){for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._sendStates.values())for(const a of s.featuresWorldSpace())t.has(a.objectId)||(e(a),t.add(a.objectId))}_createIndexOptions(e){switch(this._schema.index.type){case"geohash":return{type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:e.scale,sqlOptions:this._sqlOptions};case"grid":{const t=this._schema.index.fixedBinLevel,s=null!=t?e.tileInfoView.getLODInfoAt(t).scale:e.scale;return{type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:s,sqlOptions:this._sqlOptions}}}}async*_update(e,t){const{handledChunks:s,subscription:r,bins:i,featureCache:o}=e,n=r.tile;if(e.done)return;for(const a of t.chunks()){if(s.has(a.chunkId))continue;s.add(a.chunkId);const t=a.queryInfo;if("tileId"in t){const e=new m(t.tileId);if(e.level!==n.level||e.world!==n.key.world)continue}a.getAggregateIndex(this._createIndexOptions(e.tile)).putBounded(i,e.tile.extent,e.tile.resolution)}const l=[],d=r.tile.transform,u=r.tile.key.level;for(const c of i.values()){let e=o.get(c.id);if(e)e.attributes=c.getAttributes();else{const t=c.getGeometry(this.spatialReference,d);e=new a(t,c.getAttributes(),null,c.id),t||(e.centroid=c.getGeometricCentroid(this.spatialReference,d)),e.displayId=this._attributeStore.createDisplayIdForObjectId(`${e.objectId}.${u}`),o.set(c.id,e)}l.push(e)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const f=h.fromOptimizedFeatures(l,this._metadata,d),p=f.getCursor(),g=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;p.next();)this._attributeStore.setAttributeData(p.getDisplayId(),p,g,this._sqlOptions);const y=new c(e.subscription,f,[],e.done,{});yield y}}export{g as BinningState,y as BinningStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-256&&(e+=u*r);if(e<r+m&&e>=-m&&i<r+m&&i>=-m){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort((e,t)=>t.count-e.count);const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a,l){const o=new h({spatialReference:s}),d={type:"grid",fields:await Promise.all(t.fields.map(async e=>n.create(o,e))),spatialReference:s,featureFilter:t.featureFilter?await p.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:a,sqlOptions:l};return new x(e,t.clusterRadius,d,t.fields,i,r,l)}constructor(e,t,s,r,n,a,l){super(n,a,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null!=e){const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id);continue}if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n,tracks:[]}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter(e=>e.subscription.tile.level===this._requiredLevel);if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter(e=>e.done).map(e=>e.subscription.tile.key),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some(e=>e.containsChild(n.subscription.tile.key)))continue;if(n.subscription.tile.key.getChildKeys().every(e=>r.has(e)))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n,this._sqlOptions);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
5
+ import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-256&&(e+=u*r);if(e<r+m&&e>=-m&&i<r+m&&i>=-m){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort((e,t)=>t.count-e.count);const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a){const l=s.metadata.outSpatialReference,o=new h({spatialReference:l}),d={type:"grid",fields:await Promise.all(t.fields.map(async e=>n.create(o,e))),spatialReference:l,featureFilter:t.featureFilter?await p.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:l,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:r,sqlOptions:a};return new x(e,t.clusterRadius,d,t.fields,s,i,a)}constructor(e,t,s,r,n,a,l){super(n,a,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null!=e){const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id);continue}if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n,tracks:[]}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter(e=>e.subscription.tile.level===this._requiredLevel);if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter(e=>e.done).map(e=>e.subscription.tile.key),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some(e=>e.containsChild(n.subscription.tile.key)))continue;if(n.subscription.tile.key.getChildKeys().every(e=>r.has(e)))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n,this._sqlOptions);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromPolyline as b}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as T}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as S}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as R}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as L}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as A}from"../support/FeatureSetReaderJSON.js";let G;const C=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),P=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return I+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new _}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new g(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=q(this._trackLinePath,this._spatialReference),this._bounds=N(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,P))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=m(r,this._metadata.geometryType,t.subscription.tile.transform)??new _,o=l(1/0,1/0,-1/0,-1/0);E(a,(t,e)=>u(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new g(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=m(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new _;return new g(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new g(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class M extends x{constructor(t){super(t),this.done=!1}}class U extends j{static async create(t,e,s,a,o,n){const l=new R({spatialReference:e}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),d=t.featureFilter?await D.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then(([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new U(t,s,a,e,c,d,o,n)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return!0}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new M(t)}async*applyOverrideUpdate(t){C().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,S(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=A.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=A.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=L.from(i,s[r]);return a.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a}).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new T(e.subscription,a,!1,!1,{});for(const t of o)yield new T(e.subscription,t,!1,!1,{});yield new T(e.subscription,i,!1,e.done,{})}}function q(t,e){if(t.length<2)return b({paths:[t]},!1,!1);if(e.isWrappable){let s=!1;for(let r=1;r<t.length;r++){const i=t[r][0],a=h(i,t[r-1][0],e);i!==a&&(t[r][0]=a,s=!0)}if(s){const s=p({paths:[t],spatialReference:e});if(null!=s)return b({paths:s.paths},!1,!1)}return b({paths:[t]},!1,!1)}const s=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[t]}),r=G.fromSpatialReference(e);if(null!=r){const t=a(s,1e6,r,o.geodesic);if(null!=t){const e=G.toGeometry(t,r);if(null!=e&&"paths"in e)return b({paths:e.paths},!1,!1)}}return b({paths:[t]},!1,!1)}function E(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function N(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{U as TrackStrategy};
5
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromPolyline as b}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as T}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as R}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as L}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as A}from"../support/FeatureSetReaderJSON.js";let G;const C=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),P=32;class W{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class z{static getOid(t){return I+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new _}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new g(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=q(this._trackLinePath,this._spatialReference),this._bounds=N(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,P))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=m(r,this._metadata.geometryType,t.subscription.tile.transform)??new _,o=l(1/0,1/0,-1/0,-1/0);E(a,(t,e)=>u(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new g(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=m(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new _;return new g(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new g(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class M extends x{constructor(t){super(t),this.done=!1}}class U extends j{static async create(t,e,s,a,o){const n=e.metadata.outSpatialReference,l=new R({spatialReference:n}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),d=t.featureFilter?await D.create({geometryType:e.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:e.metadata.timeInfo,fieldsIndex:e.metadata.fieldsIndex,spatialReference:n,filterJSON:t.featureFilter}):null;return n.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then(([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new U(t,e,s,n,c,d,a,o)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return!0}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new M(t)}async*applyOverrideUpdate(t){C().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.readAttribute(e),i=a.getObjectId();if(null!=t&&null!=i&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(a.getDisplayId()||a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(i)),!this._tracks.has(t)){const e=z.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),r=new z(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,r)}this._tracks.get(t).stageObservation(r,a),s.add(t)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,T(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=A.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=A.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=L.from(i,s[r]);return a.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a}).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,!1,{});for(const t of o)yield new S(e.subscription,t,!1,!1,{});yield new S(e.subscription,i,!1,e.done,{})}}function q(t,e){if(t.length<2)return b({paths:[t]},!1,!1);if(e.isWrappable){let s=!1;for(let r=1;r<t.length;r++){const i=t[r][0],a=h(i,t[r-1][0],e);i!==a&&(t[r][0]=a,s=!0)}if(s){const s=p({paths:[t],spatialReference:e});if(null!=s)return b({paths:s.paths},!1,!1)}return b({paths:[t]},!1,!1)}const s=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[t]}),r=G.fromSpatialReference(e);if(null!=r){const t=a(s,1e6,r,o.geodesic);if(null!=t){const e=G.toGeometry(t,r);if(null!=e&&"paths"in e)return b({paths:e.paths},!1,!1)}}return b({paths:[t]},!1,!1)}function E(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function N(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{U as TrackStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{static minimal(e,n,l=[]){return new i({geometryType:e,fieldsIndex:new t(l).toJSON(),featureIdInfo:{type:"object-id",fieldName:n},subtypes:null,subtypeField:null,types:null,globalIdField:null,spatialReference:null,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null})}static createFeature(e){return new i(e)}constructor(i){let n;this._options=i,this._fieldsIndex=t.fromJSON(i.fieldsIndex),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),i.outSpatialReference&&(this._outSpatialReference=e.fromJSON(i.outSpatialReference)),"object-id"===i.featureIdInfo.type&&(n=i.featureIdInfo.fieldName),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:n,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0,datesInUnknownTimezone:this._options.timeReferenceUnknownClient??void 0,dateFieldsTimeZone:this._options.dateFieldsTimeZone??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return"esriGeometryMultiPatch"===this._options.geometryType?"esriGeometryPolygon":this._options.geometryType}get serviceGeometryType(){return this._options.geometryType}get subtypeField(){return this._options.subtypeField}get timeInfo(){return this._options.timeInfo}get featureIdInfo(){return this._options.featureIdInfo}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get outSpatialReference(){return this._outSpatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}weakCloneWithAdditionalFields(e){return new i({fieldsIndex:{fields:[...this._fieldsIndex.fields,...e],timeZoneByFieldName:null},geometryType:this.geometryType,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.spatialReference,outSpatialReference:this.outSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types})}}class n extends i{static createGraphics(e){return new n({fieldsIndex:(new t).toJSON(),featureIdInfo:{type:"object-id",fieldName:"uid"},geometryType:null,spatialReference:e,outSpatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null})}}export{i as FeatureMetadata,n as GraphicsMetadata};
5
+ import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{static minimal(e,n,l=[]){return new i({geometryType:e,fieldsIndex:new t(l).toJSON(),featureIdInfo:{type:"object-id",fieldName:n},subtypes:null,subtypeField:null,types:null,globalIdField:null,spatialReference:null,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null})}static createFeature(e){return new i(e)}constructor(i){let n;this._options=i,this._fieldsIndex=t.fromJSON(i.fieldsIndex),i.spatialReference&&(i.spatialReference instanceof e?this._spatialReference=i.spatialReference:this._spatialReference=e.fromJSON(i.spatialReference)),i.outSpatialReference&&(i.outSpatialReference instanceof e?this._outSpatialReference=i.outSpatialReference:this._outSpatialReference=e.fromJSON(i.outSpatialReference)),"object-id"===i.featureIdInfo.type&&(n=i.featureIdInfo.fieldName),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:n,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0,datesInUnknownTimezone:this._options.timeReferenceUnknownClient??void 0,dateFieldsTimeZone:this._options.dateFieldsTimeZone??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return"esriGeometryMultiPatch"===this._options.geometryType?"esriGeometryPolygon":this._options.geometryType}get serviceGeometryType(){return this._options.geometryType}get subtypeField(){return this._options.subtypeField}get timeInfo(){return this._options.timeInfo}get featureIdInfo(){return this._options.featureIdInfo}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get outSpatialReference(){return this._outSpatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}weakCloneWithAdditionalFields(e){return new i({fieldsIndex:{fields:[...this._fieldsIndex.fields,...e],timeZoneByFieldName:null},geometryType:this.geometryType,globalIdField:this.globalIdField,featureIdInfo:this.featureIdInfo,spatialReference:this.spatialReference,outSpatialReference:this.outSpatialReference,subtypeField:this.subtypeField,subtypes:this._options.subtypes,timeInfo:this.timeInfo,timeReferenceUnknownClient:this.timeReferenceUnknownClient,dateFieldsTimeZone:this._options.dateFieldsTimeZone,typeIdField:this._options.typeIdField,types:this._options.types})}}class n extends i{static createGraphics(e){return new n({fieldsIndex:(new t).toJSON(),featureIdInfo:{type:"object-id",fieldName:"uid"},geometryType:null,spatialReference:e,outSpatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null})}}export{i as FeatureMetadata,n as GraphicsMetadata};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as i,handlesGroup as o}from"../../../../core/handleUtils.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{Settings as m}from"../../interactive/editingTools/settings.js";import{OutlineVisualElement as c}from"../../interactive/visualElements/OutlineVisualElement.js";import{GraphicState as p}from"../../layers/graphics/GraphicState.js";import{isValidInputPath as d}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{connectVisualization as v}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";let h=class extends t{constructor(e){super(e),this._visualElementHandle=null}initialize(){this._settings=new m({getTheme:()=>this.view.effectiveTheme}),this.addHandles(v({analysisViewData:this.analysisViewData,remove:()=>this._remove(),show:e=>this._show(e)}))}destroy(){this._remove()}get updating(){return!1}_remove(){this._visualElementHandle=s(this._visualElementHandle)}_show(e){this._remove();const{view:t}=this,s=new c({view:t,geometry:u(e),attached:!1,renderOccluded:8,isDecoration:!0}),n=new p({graphic:e}),l=[r(()=>({draped:n.isDraped,elevationInfo:this.analysisViewData.analysis.elevationInfo}),({draped:e,elevationInfo:t})=>{s.elevationInfo=t,s.isDraped=e},a),n.on("changed",()=>s.geometry=u(e)),t.trackGraphicState(n),t.maskOccludee(e),i(s)];this._settings.visualElements.lineObjects.outline.apply(s),s.attached=!0,this._visualElementHandle=o(l)}};function u({geometry:e}){return d(e)?e:null}e([n({constructOnly:!0})],h.prototype,"view",void 0),e([n({constructOnly:!0})],h.prototype,"analysisViewData",void 0),e([n()],h.prototype,"updating",null),h=e([l("esri.views.3d.analysis.ElevationProfile.ElevationProfileGeometryVisualization3D")],h);export{h as ElevationProfileGeometryVisualization3D};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyHandle as i,handlesGroup as s}from"../../../../core/handleUtils.js";import{removeMaybe as o}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEffectiveElevationMode as m}from"../../../../support/elevationInfoUtils.js";import{Settings as c}from"../../interactive/editingTools/settings.js";import{OutlineVisualElement as p}from"../../interactive/visualElements/OutlineVisualElement.js";import{connectVisualization as v}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";let u=class extends t{constructor(e){super(e),this._visualElementHandle=null}initialize(){this._settings=new c({getTheme:()=>this.view.effectiveTheme}),this.addHandles(v({analysisViewData:this.analysisViewData,remove:()=>this._remove(),show:e=>this._show(e)}))}destroy(){this._remove()}get updating(){return!1}_remove(){this._visualElementHandle=o(this._visualElementHandle)}_show(e){this._remove();const{view:t}=this,o=new p({view:t,geometry:this.analysisViewData.analysis.geometry,attached:!1,renderOccluded:8,isDecoration:!0}),l=[a(()=>this.analysisViewData.analysis.elevationInfo,e=>{o.elevationInfo=e,o.isDraped="on-the-ground"===m(!0,e)},r),a(()=>this.analysisViewData.analysis.geometry,e=>{o.geometry=e}),t.maskOccludee(e),i(o)];this._settings.visualElements.lineObjects.outline.apply(o),o.attached=!0,this._visualElementHandle=s(l)}};e([l({constructOnly:!0})],u.prototype,"view",void 0),e([l({constructOnly:!0})],u.prototype,"analysisViewData",void 0),e([l()],u.prototype,"updating",null),u=e([n("esri.views.3d.analysis.ElevationProfile.ElevationProfileGeometryVisualization3D")],u);export{u as ElevationProfileGeometryVisualization3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as r}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import t from"../../../../core/Accessor.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as s}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,fromExtent as c,width as p,height as d,expand as l}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as m}from"../../../../geometry/support/coordinateSystem.js";let u=class extends t{constructor(e){super(e),this.rawResult=null}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i(),o=1/r.unitInMeters;return r.setAltitude(t,R*o,e),t}get boundingRect(){const{extent:e,renderCoordsHelper:r}=this,t=a();return 2===r.viewingMode?c(e,t):(this._expandBoundingRect(e.xmin,e.ymin,t),this._expandBoundingRect(e.xmax,e.ymin,t),this._expandBoundingRect(e.xmin,e.ymax,t),this._expandBoundingRect(e.xmax,e.ymax,t)),t}get cameraDimensions(){const{boundingRect:e}=this;return{width:p(e),height:d(e)}}get cameraNearFar(){const{renderCoordsHelper:{unitInMeters:e}}=this,r=1/e;return{near:x*r,far:y*r}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,i())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,i())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,i())}_expandBoundingRect(e,r,t){const{extent:o,eastVector:n,northVector:i,upVector:a,renderCoordsHelper:c}=this,p=o.center.z??0;s(g,e,r,p),c.toRenderCoords(g,o.spatialReference,g),m(g,n,i,a,h),l(t,h,t)}};e([o()],u.prototype,"renderCoordsHelper",void 0),e([o()],u.prototype,"extent",void 0),e([o()],u.prototype,"localOrigin",void 0),e([o()],u.prototype,"localOriginRenderSpace",null),e([o()],u.prototype,"cameraPositionRenderSpace",null),e([o()],u.prototype,"boundingRect",null),e([o()],u.prototype,"cameraDimensions",null),e([o()],u.prototype,"upVector",null),e([o()],u.prototype,"northVector",null),e([o()],u.prototype,"eastVector",null),e([o()],u.prototype,"rawResult",void 0),u=e([n("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],u);const g=i(),h=i(),R=r.maxTargetElevation,x=0,y=r.targetElevationRange;export{u as VolumeMeasurementCutFillComputation};
5
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as r}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import t from"../../../../core/Accessor.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as s}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,fromExtent as c,width as p,height as d,expand as l}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as m}from"../../../../geometry/support/coordinateSystem.js";let u=class extends t{constructor(e){super(e),this.rawResult=null}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i(),o=1/r.unitInMeters;return r.setAltitude(t,x*o,e),t}get boundingRect(){const{extent:e,renderCoordsHelper:r}=this,t=a();return 2===r.viewingMode?c(e,t):(this._expandBoundingRect(e.xmin,e.ymin,t),this._expandBoundingRect(e.xmax,e.ymin,t),this._expandBoundingRect(e.xmin,e.ymax,t),this._expandBoundingRect(e.xmax,e.ymax,t)),t}get cameraDimensions(){const{boundingRect:e}=this;return{width:p(e),height:d(e)}}get cameraNearFar(){const{renderCoordsHelper:{unitInMeters:e}}=this,r=1/e;return{near:y*r,far:f*r}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,i())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,i())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,i())}_expandBoundingRect(e,r,t){const{extent:o,eastVector:n,northVector:i,upVector:a,renderCoordsHelper:c}=this,p=o.center.z??0;s(g,e,r,p),c.toRenderCoords(g,o.spatialReference,g),m(g,n,i,a,h),l(t,h,t)}};e([o()],u.prototype,"renderCoordsHelper",void 0),e([o()],u.prototype,"extent",void 0),e([o()],u.prototype,"localOrigin",void 0),e([o()],u.prototype,"localOriginRenderSpace",null),e([o()],u.prototype,"cameraPositionRenderSpace",null),e([o()],u.prototype,"boundingRect",null),e([o()],u.prototype,"cameraDimensions",null),e([o()],u.prototype,"upVector",null),e([o()],u.prototype,"northVector",null),e([o()],u.prototype,"eastVector",null),e([o()],u.prototype,"rawResult",void 0),u=e([n("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],u);const g=i(),h=i(),R=100,x=r.maxTargetElevation,y=0,f=r.targetElevationRange+R;export{u as VolumeMeasurementCutFillComputation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import s from"../../../../core/Accessor.js";import"../../../../core/has.js";import{makeHandle as i}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as a,isAborted as o}from"../../../../core/promiseUtils.js";import{watch as r,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../../core/support/UpdatingHandles.js";import l from"../../../../layers/GraphicsLayer.js";import d from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as m,isPolygonGraphic as y}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as u}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as g}from"../../../analysis/ExclusiveOperationManager.js";import{makeAllLayerSnappingOptions as _}from"../../../interactive/snapping/allLayerSnapping.js";import k from"../../../../widgets/Sketch/SketchViewModel.js";let G=class extends s{constructor(e){super(e),this._updatingHandles=new p,this._operationManager=new g,this._onUndoRedo=()=>{this._updateGeometryFromSketchGraphic()}}initialize(){const{analysis:e,analysisViewData:t,view:s}=this;this._graphicsLayer=new l({listMode:"hide",internal:!0,elevationInfo:{mode:"on-the-ground"}});const i=_(s,{selfEnabled:!0,excludeInternal:!0});this._sketchViewModel=new k({layer:this._graphicsLayer,view:s,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polygonSymbol:this._polygonSymbol,snappingOptions:i.options}),this.addHandles([this._sketchViewModel.on(["undo","redo"],this._onUndoRedo),r(()=>({map:s.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:e,internalGraphicsLayer:t,state:s})=>{switch(w(e,t),s){case"idle":case"reshaping-disabled":this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case"reshaping":a(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},h),i]),this._shiftTool=new u({analysis:e,view:s,analysisViewData:t}),this.addHandles(this._shiftTool.on("record-undo",e=>{const t=this._sketchViewModel.activeComponent;"reshape-3d"===t?.type&&t.recordUndo(e.apply,e.undo)})),s.tools.add(this._shiftTool),this.addHandles({remove:()=>s.tools.remove(this._shiftTool)})}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),this._updateGeometryFromSketchGraphic())}get state(){const{geometry:e}=this.analysis,{interactive:t,visible:s}=this.analysisViewData;return s?this._sketchViewModel.createGraphic?this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch":e?t?"reshaping":"reshaping-disabled":"idle":"idle"}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _polygonSymbol(){return new d({color:[0,0,0,0],outline:{color:[0,0,0,0]}})}place(e){return this._operationManager.start("place",async t=>{const s=this.analysis.clone();this._ensureUpdatedSketchGraphic();const a=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic;break;case"active":this._updateGeometryFromSketchGraphic();break;case"complete":this._updateGeometryFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(a,i(()=>(a.remove(),this._sketchViewModel.cancel(),this._updateGeometryFromSketchGraphic(),this.analysis.valid?o(e)||s.equals(this.analysis)?t.reject():void t.resolve({}):(this._clearGeometry(),t.reject())))),await this._updatingHandles.addPromise(this._sketchViewModel.create("polygon"))},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(this._graphicsLayer.add(e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateGeometryFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?a(t()):e.resolve())});e.handles.push(s,i(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this.analysis;return m(e)?(this.sketchGraphic??=new t({geometry:e,symbol:this._polygonSymbol}),this.sketchGraphic.geometry=e,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearGeometry(){this.sketchGraphic=null,this.analysis.geometry=null}_updateGeometryFromSketchGraphic(){const e=this.sketchGraphic;this.analysis.geometry=y(e)?e.geometry:null}get test(){}};function w(e,t){t&&(t.removeFromParent(),e?.add(t))}e([n({constructOnly:!0})],G.prototype,"analysisViewData",void 0),e([n({constructOnly:!0})],G.prototype,"view",void 0),e([n({constructOnly:!0})],G.prototype,"analysis",void 0),e([n()],G.prototype,"sketchGraphic",null),e([n({nonNullable:!0})],G.prototype,"state",null),e([n()],G.prototype,"updating",null),e([n()],G.prototype,"_polygonSymbol",null),G=e([c("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementTool")],G);export{G as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import s from"../../../../core/Accessor.js";import"../../../../core/has.js";import{makeHandle as i}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as a,isAborted as o}from"../../../../core/promiseUtils.js";import{watch as r,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import d from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as m,isPolygonGraphic as y}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as u}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as g}from"../../../analysis/ExclusiveOperationManager.js";import{makeAllLayerSnappingOptions as _}from"../../../interactive/snapping/allLayerSnapping.js";import k from"../../../../widgets/Sketch/SketchViewModel.js";let G=class extends s{constructor(e){super(e),this._updatingHandles=new l,this._operationManager=new g,this._onUndoRedo=()=>{this._updateGeometryFromSketchGraphic()}}initialize(){const{analysis:e,analysisViewData:t,view:s}=this;this._graphicsLayer=new p({listMode:"hide",internal:!0,elevationInfo:{mode:"on-the-ground"}});const i=_(s,{selfEnabled:!0,excludeInternal:!0});this._sketchViewModel=new k({layer:this._graphicsLayer,view:s,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polygonSymbol:this._polygonSymbol,snappingOptions:i.options}),this.addHandles([this._sketchViewModel.on(["undo","redo"],this._onUndoRedo),r(()=>({map:s.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:e,internalGraphicsLayer:t,state:s})=>{switch(w(e,t),s){case"idle":case"reshaping-disabled":this._operationManager.stop(),this._graphicsLayer.removeAll(),this._ensureUpdatedSketchGraphic();break;case"reshaping":a(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},h),i]),this._shiftTool=new u({analysis:e,view:s,analysisViewData:t}),this.addHandles(this._shiftTool.on("record-undo",e=>{const t=this._sketchViewModel.activeComponent;"reshape-3d"===t?.type&&t.recordUndo(e.apply,e.undo)})),s.tools.add(this._shiftTool),this.addHandles({remove:()=>s.tools.remove(this._shiftTool)})}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),this._updateGeometryFromSketchGraphic())}get state(){const{geometry:e}=this.analysis,{interactive:t,visible:s}=this.analysisViewData;return s?this._sketchViewModel.createGraphic?this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch":e?t?"reshaping":"reshaping-disabled":"idle":"idle"}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _polygonSymbol(){return new d({color:[0,0,0,0],outline:{color:[0,0,0,0]}})}place(e){return this._operationManager.start("place",async t=>{const s=this.analysis.clone();this._ensureUpdatedSketchGraphic();const a=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic;break;case"active":this._updateGeometryFromSketchGraphic();break;case"complete":this._updateGeometryFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(a,i(()=>(a.remove(),this._sketchViewModel.cancel(),this._updateGeometryFromSketchGraphic(),this.analysis.valid?o(e)||s.equals(this.analysis)?t.reject():void t.resolve({}):(this._clearGeometry(),t.reject())))),await this._updatingHandles.addPromise(this._sketchViewModel.create("polygon"))},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(this._graphicsLayer.removeAll(),this._graphicsLayer.add(e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateGeometryFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?a(t()):e.resolve())});e.handles.push(s,i(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this.analysis;return m(e)?(this.sketchGraphic??=new t({geometry:e,symbol:this._polygonSymbol}),this.sketchGraphic.geometry=e,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearGeometry(){this.sketchGraphic=null,this.analysis.geometry=null}_updateGeometryFromSketchGraphic(){const e=this.sketchGraphic;this.analysis.geometry=y(e)?e.geometry:null}get test(){}};function w(e,t){t&&(t.removeFromParent(),e?.add(t))}e([n({constructOnly:!0})],G.prototype,"analysisViewData",void 0),e([n({constructOnly:!0})],G.prototype,"view",void 0),e([n({constructOnly:!0})],G.prototype,"analysis",void 0),e([n()],G.prototype,"sketchGraphic",null),e([n({nonNullable:!0})],G.prototype,"state",null),e([n()],G.prototype,"updating",null),e([n()],G.prototype,"_polygonSymbol",null),G=e([c("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementTool")],G);export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ChapmanApproximationParameters as r}from"./ChapmanApproximation.glsl.js";import{C as t}from"../../../chunks/ChapmanAtmosphere.glsl.js";import{ReloadableShaderModule as o}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2TexF16 as s}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as n,defaultColorWrite as a,copySource as l,simpleBlendingParams as m}from"../../webgl/renderState.js";import{fromLayout as c}from"../../webgl/VertexAttributeLocations.js";class p extends r{constructor(){super(...arguments),this.innerFadeDistance=0,this.altitudeFade=0,this.backgroundColor=e()}}class d extends i{constructor(e,r){super(e,r,new o(t,()=>import("./ChapmanAtmosphere.glsl.js")),c(s))}initializePipeline(e){return n({blending:e.reduced?l:m(770,771),depthTest:{func:e.reduced?519:515},colorWrite:a})}}export{p as ChapmanAtmospherePassParameters,d as ChapmanAtmosphereTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ChapmanApproximationParameters as s}from"./ChapmanApproximation.glsl.js";import{C as t}from"../../../chunks/ChapmanAtmosphere.glsl.js";import{ReloadableShader as i}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2TexF16 as a}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as m,defaultColorWrite as c,copySource as p,simpleBlendingParams as l}from"../../webgl/renderState.js";import{fromLayout as h}from"../../webgl/VertexAttributeLocations.js";class d extends s{constructor(){super(...arguments),this.innerFadeDistance=0,this.altitudeFade=0,this.backgroundColor=o()}}let u=class extends n{constructor(e,r){super(e,r,h(a)),this.shader=new i(t,()=>import("./ChapmanAtmosphere.glsl.js"))}initializePipeline(e){return m({blending:e.reduced?p:l(770,771),depthTest:{func:e.reduced?519:515},colorWrite:c})}};u=e([r("esri.views.3d.environment.ChapmanAtmosphereTechnique")],u);export{d as ChapmanAtmospherePassParameters,u as ChapmanAtmosphereTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{C as e}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShaderModule as o}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as i}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as s,defaultColorWrite as n,separateBlendingParams as t}from"../../webgl/renderState.js";class l extends r{constructor(r,s){super(r,s,new o(e,()=>import("./CloudsComposition.glsl.js")),i)}initializePipeline(){return s({blending:t(1,0,770,1),depthTest:{func:515},colorWrite:n})}}export{l as CloudsCompositionTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{C as r}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{PrimitiveType as t}from"../../webgl/enums.js";import{makePipelineState as n,defaultColorWrite as m,separateBlendingParams as p}from"../../webgl/renderState.js";let c=class extends i{constructor(){super(...arguments),this.primitiveType=t.TRIANGLE_STRIP,this.shader=new s(r,()=>import("./CloudsComposition.glsl.js"))}initializePipeline(){return n({blending:p(1,0,770,1),depthTest:{func:515},colorWrite:m})}};c=e([o("esri.views.3d.environment.CloudsCompositionTechnique")],c);export{c as CloudsCompositionTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/Clouds.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as i}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as n,defaultColorWrite as s,simpleBlendingParams as t}from"../../webgl/renderState.js";class l extends o{constructor(o,n){super(o,n,new r(e,()=>import("./Clouds.glsl.js")),i)}initializePipeline(e){return n({blending:t(32769,32770,32774,0===e.writeTextureChannels?[1,1,0,0]:[0,0,1,1]),depthTest:{func:515},colorWrite:s})}}export{l as CloudsTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../chunks/Clouds.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as t,defaultColorWrite as n,simpleBlendingParams as c}from"../../webgl/renderState.js";let l=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./Clouds.glsl.js"))}initializePipeline(e){return t({blending:c(32769,32770,32774,0===e.writeTextureChannels?[1,1,0,0]:[0,0,1,1]),depthTest:{func:515},colorWrite:n})}};l=e([r("esri.views.3d.environment.CloudsTechnique")],l);export{l as CloudsTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/Fog.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as i}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as n,defaultColorWrite as l,separateBlendingParams as s}from"../../webgl/renderState.js";class t extends o{constructor(o,n){super(o,n,new r(e,()=>import("./Fog.glsl.js")),i)}initializePipeline(){return n({blending:s(770,0,771,1),colorWrite:l})}}export{t as FogTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../chunks/Fog.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as t,defaultColorWrite as n,separateBlendingParams as c}from"../../webgl/renderState.js";let m=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./Fog.glsl.js"))}initializePipeline(){return t({blending:c(770,0,771,1),colorWrite:n})}};m=e([r("esri.views.3d.environment.FogTechnique")],m);export{m as FogTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/NoiseTextureAtlas.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Pos2Locations as t}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{makePipelineState as i,defaultColorWrite as s,copySource as l,separateBlendingParams as n}from"../../webgl/renderState.js";class a extends o{constructor(o,i){super(o,i,new r(e,()=>import("./NoiseTextureAtlas.glsl.js")),t)}initializePipeline(e){return i({blending:0===e.mode?l:n(0,1,1,0),depthTest:{func:519},colorWrite:s})}}export{a as NoiseTextureAtlasTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../chunks/NoiseTextureAtlas.glsl.js";import{ReloadableShader as s}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as t}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as i,defaultColorWrite as n,copySource as c,separateBlendingParams as a}from"../../webgl/renderState.js";let l=class extends t{constructor(){super(...arguments),this.shader=new s(o,()=>import("./NoiseTextureAtlas.glsl.js"))}initializePipeline(e){return i({blending:0===e.mode?c:a(0,1,1,0),depthTest:{func:519},colorWrite:n})}};l=e([r("esri.views.3d.environment.NoiseTextureAtlasTechnique")],l);export{l as NoiseTextureAtlasTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{P as e}from"../../../chunks/Precipitation.glsl.js";import{ReloadableShaderModule as t}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{NoParameters as r}from"../../webgl/NoParameters.js";import{makePipelineState as s,defaultColorWrite as o,premultipliedAlpha as n}from"../../webgl/renderState.js";class a extends r{constructor(){super(...arguments),this.time=0,this.radius=1,this.width=500,this.opacity=0}}class c extends i{constructor(i,r){super(i,r,new t(e,()=>import("./Precipitation.glsl.js")),new Map([["position",0],["instanceFeatureAttribute",1]]))}initializePipeline(){return s({blending:n,depthTest:{func:515},colorWrite:o})}}export{a as PrecipitationPassParameters,c as PrecipitationTechnique};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{P as i}from"../../../chunks/Precipitation.glsl.js";import{ReloadableShader as t}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{NoParameters as s}from"../../webgl/NoParameters.js";import{makePipelineState as n,defaultColorWrite as c,premultipliedAlpha as a}from"../../webgl/renderState.js";class p extends s{constructor(){super(...arguments),this.time=0,this.radius=1,this.width=500,this.opacity=0}}let m=class extends o{constructor(e,r){super(e,r,new Map([["position",0],["instanceFeatureAttribute",1]])),this.shader=new t(i,()=>import("./Precipitation.glsl.js"))}initializePipeline(){return n({blending:a,depthTest:{func:515},colorWrite:c})}};m=e([r("esri.views.3d.environment.PrecipitationTechnique")],m);export{p as PrecipitationPassParameters,m as PrecipitationTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/SimpleAtmosphere.glsl.js";import{newLayout as r}from"../support/buffer/InterleavedLayout.js";import{ReloadableShaderModule as o}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as i,defaultColorWrite as s,backFaceCullingParams as n,unpremultipliedAlphaToPremultipliedAlpha as l}from"../../webgl/renderState.js";class p extends t{constructor(r,t){super(r,t,new o(e,()=>import("./SimpleAtmosphere.glsl.js")),c.locations)}initializePipeline(e){const r=1===e.geometry;return i({blending:l,culling:r?n:void 0,depthTest:{func:515},colorWrite:s})}}const c=r().vec3f("position").freeze();export{p as SimpleAtmosphereTechnique,c as layout};
5
+ import{__decorate as e}from"tslib";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{a as o}from"../../../chunks/SimpleAtmosphere.glsl.js";import{newLayout as s}from"../support/buffer/InterleavedLayout.js";import{ReloadableShader as t}from"../webgl-engine/core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{makePipelineState as n,defaultColorWrite as m,backFaceCullingParams as p,unpremultipliedAlphaToPremultipliedAlpha as c}from"../../webgl/renderState.js";let l=class extends i{constructor(e,r){super(e,r,a.locations),this.shader=new t(o,()=>import("./SimpleAtmosphere.glsl.js"))}initializePipeline(e){const r=1===e.geometry;return n({blending:c,culling:r?p:void 0,depthTest:{func:515},colorWrite:m})}};l=e([r("esri.views.3d.environment.SimpleAtmosphereTechnique")],l);const a=s().vec3f("position").freeze();export{l as SimpleAtmosphereTechnique,a as layout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as l,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as v,intersection as w,toExtent as T,intersects as S}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as j,getPositions as A,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as x}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as P,fadeOutTime as E,fadeInTime as I,defaultTransitionDuration as M,transitionDurationFactor as q,seamlessTransitionEnabled as F,averageLoadingTimeSmoothingFactor as V}from"../support/flow/constants.js";import{isFullExtent as k,FlowQuery3D as B,wrappedWidth as C}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as W}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as G}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as O}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as N}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as Q}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as J}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as K,hasLayerBasedScaleVisibility as X}from"../../support/layerViewUtils.js";import{TaskPriority as Y}from"../../support/Scheduler.js";let Z=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=h(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._overrideTransitionEnabled=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this.frameTask.scheduleGenerator(r),this.renderedTiles=i})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new W(x(i)),this.frameTask=i.scheduler.registerTask(Y.FLOW_GENERATOR),this._updateTask=p({update:e=>this._update(e)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&j(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()}),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()})]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return f(this.view.spatialReference).radius}get loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=P}get loadByTileTreesAllowed(){return!this.loadAllTiles||!this.loadRequirementsMet}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:I,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&Q(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return h(0===e?M:this._averageLoadingTime*q)}get _seamlessTransitionEnabled(){return null!=this._overrideTransitionEnabled?this._overrideTransitionEnabled:F}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??$}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:A(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get layer(){return this.layerView.layer}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&this.renderedTiles.size>0}getUpdating(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this.getUpdating()}get visibleAtCurrentScale(){return!X()||K(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&k(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this._loadingState="ready-to-load"}_update(e){const t=c(e.time);this._lastResources?.hasFadedOut(t)&&this._lastResources.detach();const i=this._nextStateForTransition(t);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==i||!this.loadRequirementsMet)return void(this._loadingState=i);this._loadingState="loading";const r=async()=>{const e=performance.now(),i=this._seamlessTransitionEnabled&&null!=this._resources?h(t+this._seamlessTransitionWaitingTime):t;await this._load(this.renderedTiles,i);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=V;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t){if(!this._visible)return this.clear(),void(this._loadingState="ready-to-load");const i=this._computeExtent(e);if(0===e.size||null==i)return void(this._loadingState="ready-to-load");const r=new B(i,this.layerView.timeExtent,this._viewSizeWithEqualRatio(i),this.view.state.contentPixelRatio,t);null==this._abortController&&(this._abortController=new AbortController);const s=this._abortController,o=await this._loadStreamlines(r,s.signal);if(a(s.signal),this._visible&&null!=o){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=o;const e=performance.now()/1e3,i=e>t?e:t;null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,await o.attach(),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.layerView):new O(e,i,s,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new J(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:a}=this;function*l(l){for(let n=0;n<t.length;++n)r.push(G(a,e,t[n],s,i,o)),l.madeProgress(),l.done&&(l=yield)}return await this.frameTask.scheduleGenerator(l),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=H(e,this.spatialReferenceInfo);return null==i?null:(w(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this.loadAllTiles)return t=>t.leaf&&ee(e,t.extent);const s=t=>t.rendered&&t.visible&&ee(e,t.extent),{featureTiles:o}=i;if(!o)return s;const a=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&ee(r,e.extent)&&a.some(({lij:i})=>t(i,e.lij)||N(i,e.lij))}_viewSizeWithEqualRatio(e){const t=C(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+E?"transitioning":"ready-to-load"}get test(){}};e([g()],Z.prototype,"type",void 0),e([g()],Z.prototype,"renderedTiles",void 0),e([g()],Z.prototype,"_resources",void 0),e([g()],Z.prototype,"_lastResources",void 0),e([g()],Z.prototype,"requireLoad",void 0),e([g()],Z.prototype,"_averageLoadingTime",void 0),e([g()],Z.prototype,"_loadingState",void 0),e([g()],Z.prototype,"emissiveStrength",void 0),e([g()],Z.prototype,"_clippingArea",null),e([g()],Z.prototype,"_dataBounds",null),e([g()],Z.prototype,"_draped",null),e([g()],Z.prototype,"_ellipsoidRadius",null),e([g()],Z.prototype,"loadAllTiles",null),e([g()],Z.prototype,"_featureTilesBounds",null),e([g()],Z.prototype,"_flowRenderer",null),e([g()],Z.prototype,"_materialParameters",null),e([g()],Z.prototype,"_opacity",null),e([g()],Z.prototype,"_seamlessTransitionWaitingTime",null),e([g()],Z.prototype,"_seamlessTransitionEnabled",null),e([g()],Z.prototype,"_visible",null),e([g()],Z.prototype,"elevationInfo",null),e([g()],Z.prototype,"needsMagnitude",null),e([g()],Z.prototype,"spatialReferenceInfo",null),e([g()],Z.prototype,"layer",null),e([g()],Z.prototype,"loadingState",null),e([g()],Z.prototype,"updating",null),e([g()],Z.prototype,"visibleAtCurrentScale",null),e([g()],Z.prototype,"_overrideMaterialParameters",void 0),e([g()],Z.prototype,"_overrideSimulationSettings",void 0),e([g()],Z.prototype,"_overrideTransitionEnabled",void 0),e([g()],Z.prototype,"_simulationSettings",null),e([g()],Z.prototype,"surface",null),Z=e([_("esri.views.3d.layers.FlowSubView3D")],Z);const $=new R({mode:"on-the-ground"});function ee(e,t){return null==e||null==t||S(e,t)}export{Z as default};
5
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as n,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as l,when as a,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../core/scheduling.js";import{Seconds as p,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as v,intersection as w,toExtent as T,contains as S,area as b,intersects as R}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as j}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as A,getPositions as L,getFlowSimulationSettings as M}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{tileFilterDistance as E,thresholdForLoadingAllTiles as I,fadeOutTime as q,fadeInTime as F,defaultTransitionDuration as V,transitionDurationFactor as k,seamlessTransitionEnabled as C,averageLoadingTimeSmoothingFactor as D,minimumTracingResolution as B}from"../support/flow/constants.js";import{wrappedWidth as W,isFullExtent as z,FlowQuery3D as G}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as H}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as O,createStreamlineGeometry as N}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as Q}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as J}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as K}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as X}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as Y}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as Z}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as $,hasLayerBasedScaleVisibility as ee}from"../../support/layerViewUtils.js";import{TaskPriority as te}from"../../support/Scheduler.js";let ie=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=p(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._overrideTransitionEnabled=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const n=e.at(s);t(n)&&i.add(n),r.madeProgress(),r.done&&(r=yield)}}await this.frameTask.scheduleGenerator(r),this.renderedTiles=i})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new H(P(i)),this.frameTask=i.scheduler.registerTask(te.FLOW_GENERATOR),this._updateTask=h({update:e=>this._update(e)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&A(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()}),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),a(()=>!t.featureTiles?.updating,()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()})]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return f(this.view.spatialReference).radius}get extent(){const{spatialReference:e}=this.surface;let t=this.renderedTiles;if(null==e||null==t)return null;const i=this.view.terrainLevel;if(null!=i){const e=new Set;t.forEach(t=>{Math.abs(i-t.level)<E&&e.add(t)}),t=e}const r=Q(t,this.spatialReferenceInfo);return null==r?null:(w(r,this._clippingArea,r),T(r,e))}get loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=I}get loadByTileTreesAllowed(){return!this.loadAllTiles||!this.loadRequirementsMet}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...O(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:F,fadeOutTime:q,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&Y(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return p(0===e?V:this._averageLoadingTime*k)}get _seamlessTransitionEnabled(){return null!=this._overrideTransitionEnabled?this._overrideTransitionEnabled:C}get _tracingResolution(){const{extent:e}=this;if(!e)return[0,0];const t=W(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;let s,n;i<r?(s=i,n=i/t):(s=r*t,n=r);const o=B,l=this.view.qualitySettings.flow3D.maxTracingResolution,a=Math.max(1,o/Math.min(s,n)),u=a*Math.min(1,l/Math.max(s*a,n*a));return[Math.round(s*u),Math.round(n*u)]}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get _estimatedStreamlines(){const{extent:e,_simulationSettings:t,renderedTiles:i}=this;if(null==t||null==i)return 0;const r=this._tracingResolution[0]*this._tracingResolution[1]/t.lineSpacing**2*t.density,s=null==e?null:v(e);if(null==s)return 0;let n=0;for(const a of i)S(s,a.extent)&&(n+=b(a.extent));const o=b(s),l=0===o?0:n/o;return 2*Math.round(r*l)}get _effectiveDensity(){const{_estimatedStreamlines:e,_simulationSettings:t}=this,{qualitySettings:i,quality:r}=this.view;if(null==t)return 0;const s=i.flow3D.maxTotalNumberOfStreamlines,n=e>=s?s/e:1,o=t.density*n*r;return t.lineSpacing/Math.sqrt(o)<t.lineCollisionWidth?4*t.lineSpacing:o}get elevationInfo(){return this.layer.elevationInfo??re}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:L(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return j(this.surface.spatialReference)}get layer(){return this.layerView.layer}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&this.renderedTiles.size>0}getUpdating(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this.getUpdating()}get visibleAtCurrentScale(){return!ee()||$(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=M(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&z(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this._loadingState="ready-to-load"}_update(e){const t=c(e.time);this._lastResources?.hasFadedOut(t)&&this._lastResources.detach();const i=this._nextStateForTransition(t);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==i||!this.loadRequirementsMet)return void(this._loadingState=i);this._loadingState="loading";const r=async()=>{const e=performance.now(),i=this._seamlessTransitionEnabled&&null!=this._resources?p(t+this._seamlessTransitionWaitingTime):t;await this._load(i);const r=p((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(n(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=D;this._averageLoadingTime=p(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e){const{extent:t,view:i}=this;if(!this._visible)return this.clear(),void(this._loadingState="ready-to-load");if(null==t)return void(this._loadingState="ready-to-load");const r=new G(t,this.layerView.timeExtent,this._tracingResolution,i.state.contentPixelRatio,e);null==this._abortController&&(this._abortController=new AbortController);const s=this._abortController,n=await this._loadStreamlines(r,s.signal);if(o(s.signal),this._visible&&null!=n){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=n;const t=performance.now()/1e3,i=t>e?t:e;null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,await n.attach(),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new J(e,i,s,r,this.layerView):new K(e,i,s,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new Z(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:n,view:o}=this;function*l(l){for(let a=0;a<t.length;++a)r.push(N(o,e,t[a],s,i,n)),l.madeProgress(),l.done&&(l=yield)}return await this.frameTask.scheduleGenerator(l),{geometries:r,material:i}}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(n(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this.loadAllTiles)return t=>t.leaf&&se(e,t.extent);const s=t=>t.rendered&&t.visible&&se(e,t.extent),{featureTiles:n}=i;if(!n)return s;const o=n.tiles.filter(e=>e.measures.visible);return e=>s(e)&&se(r,e.extent)&&o.some(({lij:i})=>t(i,e.lij)||X(i,e.lij))}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+q?"transitioning":"ready-to-load"}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([g()],ie.prototype,"type",void 0),e([g()],ie.prototype,"renderedTiles",void 0),e([g()],ie.prototype,"_resources",void 0),e([g()],ie.prototype,"_lastResources",void 0),e([g()],ie.prototype,"requireLoad",void 0),e([g()],ie.prototype,"_averageLoadingTime",void 0),e([g()],ie.prototype,"_loadingState",void 0),e([g()],ie.prototype,"emissiveStrength",void 0),e([g()],ie.prototype,"_clippingArea",null),e([g()],ie.prototype,"_dataBounds",null),e([g()],ie.prototype,"_draped",null),e([g()],ie.prototype,"_ellipsoidRadius",null),e([g()],ie.prototype,"extent",null),e([g()],ie.prototype,"loadAllTiles",null),e([g()],ie.prototype,"_featureTilesBounds",null),e([g()],ie.prototype,"_flowRenderer",null),e([g()],ie.prototype,"_materialParameters",null),e([g()],ie.prototype,"_opacity",null),e([g()],ie.prototype,"_seamlessTransitionWaitingTime",null),e([g()],ie.prototype,"_seamlessTransitionEnabled",null),e([g()],ie.prototype,"_tracingResolution",null),e([g()],ie.prototype,"_visible",null),e([g()],ie.prototype,"_estimatedStreamlines",null),e([g()],ie.prototype,"_effectiveDensity",null),e([g()],ie.prototype,"elevationInfo",null),e([g()],ie.prototype,"needsMagnitude",null),e([g()],ie.prototype,"spatialReferenceInfo",null),e([g()],ie.prototype,"layer",null),e([g()],ie.prototype,"loadingState",null),e([g()],ie.prototype,"updating",null),e([g()],ie.prototype,"visibleAtCurrentScale",null),e([g()],ie.prototype,"_overrideMaterialParameters",void 0),e([g()],ie.prototype,"_overrideSimulationSettings",void 0),e([g()],ie.prototype,"_overrideTransitionEnabled",void 0),e([g()],ie.prototype,"_simulationSettings",null),e([g()],ie.prototype,"surface",null),ie=e([_("esri.views.3d.layers.FlowSubView3D")],ie);const re=new x({mode:"on-the-ground"});function se(e,t){return null==e||null==t||R(e,t)}export{ie as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as r,watch as i,sync as s,initial as a}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{projectDatasetExtent as o}from"../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{LayerView3D as m}from"./LayerView3D.js";import{TiledLayerView3D as h}from"./TiledLayerView3D.js";import p from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import c from"../../layers/ImageryTileLayerView.js";import u from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as f}from"../../support/drapedUtils.js";import{getWebGLCapabilities as g}from"../../webgl/capabilities.js";let b=class extends(c(y(h(m(u))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=r(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this.addHandles(i(()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s))});this.addResolvingPromise(e),this.addHandles(i(()=>this.layer.renderer,e=>this._setSubView(e),a))}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,r=this._flowSubView;t&&null!=r||(r?.destroy(),this._flowSubView=t?new p({layerView:this}):null)}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[r,i]=this.tileInfo.size;return e.width=r,e.height=i,t.clearRect(0,0,r,i),t.getImageData(0,0,r,i)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,r=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,r)}get fetchLevelRange(){if(this._hasFlow){const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange;return this.levelRangeFromScaleRange(e,t)}return this.dataLevelRange}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??super.visibleAtCurrentScale}_getFullExtent(){return o(this.layer.serviceRasterInfo,this.view.basemapTerrain?.spatialReference??this.view.spatialReference)}async fetchTile(e,t){const r=this.tileInfo,i=this._canSymbolizeInWebGL(),s={tileInfo:r,requestRawData:i,signal:t.signal,timeExtent:this.timeExtent,requestAsImageElement:this._isAlignedMapTile,requestProjectedLocalDirections:this._hasFlow,noClip:!1},{layer:a}=this,[l,n,o]=e,m=await a.fetchTile(l,n,o,s);if(m instanceof HTMLImageElement)return m;let h=m?.pixelBlock;if(null==h)return this._blankTile;if(!i&&!this._hasFlow&&(h=await a.applyRenderer(m),null==h))return this._blankTile;const p=new d([l,n,o],h,r.size[0],r.size[1]);return i?(p.symbolizerRenderer=a.symbolizer.rendererJSON,p.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(l)),p.transformGrid=m.transformGrid,p.bandIds=a.bandIds):(p.isRendereredSource=!0,p.bandIds=null),p.interpolation=a.interpolation,p}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.basemapTerrain?.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return f(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=g(),{symbolizer:t}=this.layer,r=t.lookup.colormapLut?.indexedColormap,i=!!this.layer.rasterFunction?.hasClipFunction,s=r&&r.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!i}get test(){}};e([l({readOnly:!0})],b.prototype,"_blankTile",null),e([l()],b.prototype,"_hasFlow",null),e([l({readOnly:!0})],b.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],b.prototype,"hasMixedImageFormats",null),e([l()],b.prototype,"_flowSubView",void 0),e([l({readOnly:!0})],b.prototype,"dataLevelRange",null),e([l({readOnly:!0})],b.prototype,"fetchLevelRange",null),e([l({readOnly:!0})],b.prototype,"visibleAtCurrentScale",null),b=e([n("esri.views.3d.layers.ImageryTileLayerView3D")],b);const w=b;export{w as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import"../../../core/has.js";import{whenOnce as i,watch as r,sync as s,initial as a}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{projectDatasetExtent as n}from"../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{LayerView3D as m}from"./LayerView3D.js";import{TiledLayerView3D as h}from"./TiledLayerView3D.js";import p from"../support/flow/FlowSubViewTiles3D.js";import{RasterTile as d}from"../terrain/RasterTile.js";import u from"../../layers/ImageryTileLayerView.js";import c from"../../layers/LayerView.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as f}from"../../support/drapedUtils.js";import{getWebGLCapabilities as b}from"../../webgl/capabilities.js";let g=class extends(u(y(h(m(c))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this._isAlignedMapTile=!0,this._flowSubView=null,this.ignoresMemoryFactor=!1,this.unloadedMemory=0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=i(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo;this._isAlignedMapTile=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t),this.tileInfo=this._isAlignedMapTile?t:e.toTileInfo(),this.addHandles(r(()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this._updatingHandles.addPromise(this.doRefresh()),s))});this.addResolvingPromise(e),this.addHandles(r(()=>this.layer.renderer,e=>this._setSubView(e),a))}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this._flowSubView?.destroy()}_setSubView(e){if("wcs"===this.layer.type)return;const t="flow"===e?.type,i=this._flowSubView;t&&null!=i||(i?.destroy(),this._flowSubView=t?new p({layerView:this}):null)}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[i,r]=this.tileInfo.size;return e.width=i,e.height=r,t.clearRect(0,0,i,r),t.getImageData(0,0,i,r)}get _hasFlow(){return null!=this._flowSubView}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.layer.tileInfo,t=this.tileInfo.lodAt(0)?.scale,i=e.lodAt(e.lods.length-1)?.scale;return this.levelRangeFromScaleRange(t,i)}get visibleAtCurrentScale(){return this._flowSubView?.visibleAtCurrentScale??this.tilesVisibleAtCurrentScale()}_getFullExtent(){return n(this.layer.serviceRasterInfo,this.view.basemapTerrain?.spatialReference??this.view.spatialReference)}async fetchTile(e,t){const i=this.tileInfo,r=this._canSymbolizeInWebGL(),s={tileInfo:i,requestRawData:r,signal:t.signal,timeExtent:this.timeExtent,requestAsImageElement:this._isAlignedMapTile,requestProjectedLocalDirections:this._hasFlow,noClip:!1},{layer:a}=this,[l,o,n]=e,m=await a.fetchTile(l,o,n,s);if(m instanceof HTMLImageElement)return m;let h=m?.pixelBlock;if(null==h)return this._blankTile;if(!r&&!this._hasFlow&&(h=await a.applyRenderer(m),null==h))return this._blankTile;const p=new d([l,o,n],h,i.size[0],i.size[1]);return r?(p.symbolizerRenderer=a.symbolizer.rendererJSON,p.symbolizerParameters=a.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(l)),p.transformGrid=m.transformGrid,p.bandIds=a.bandIds):(p.isRendereredSource=!0,p.bandIds=null),p.interpolation=a.interpolation,p}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:null!=this.view.basemapTerrain?.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return f(e,t,this.view)}async doRefresh(){this.suspended||(this._flowSubView?.doRefresh(),this.emit("data-changed"))}isUpdating(){return this._flowSubView?.updating??!1}_canSymbolizeInWebGL(){const e=b(),{symbolizer:t}=this.layer,i=t.lookup.colormapLut?.indexedColormap,r=!!this.layer.rasterFunction?.hasClipFunction,s=i&&i.length>4*(e.maxTextureSize||4096);return t.canRenderInWebGL&&!s&&!r}get usedMemory(){return this._flowSubView?.usedMemory??0}get test(){}};e([l({readOnly:!0})],g.prototype,"_blankTile",null),e([l()],g.prototype,"_hasFlow",null),e([l({readOnly:!0})],g.prototype,"imageFormatIsOpaque",null),e([l({readOnly:!0})],g.prototype,"hasMixedImageFormats",null),e([l()],g.prototype,"_flowSubView",void 0),e([l({readOnly:!0})],g.prototype,"dataLevelRange",null),e([l({readOnly:!0})],g.prototype,"visibleAtCurrentScale",null),g=e([o("esri.views.3d.layers.ImageryTileLayerView3D")],g);const w=g;export{w as default};