@arcgis/core 4.29.4 → 4.29.6

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 (55) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{863d14c98737482f6788.js → 0700231efdaf7ce06d19.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{9f0c5822e9f2761054ea.js → 07ef6a6c4f3fce7508eb.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{2146f7e55911da806aec.js → 2ca0fc695c66640a57dd.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{90b36361651839b1e3f0.js → 326aa2951f7e4da6d6b0.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{1251638c842dcf895ffe.js → 37133cf60bc9039a7407.js} +1 -1
  7. package/assets/esri/core/workers/chunks/47504e296bf82357f6bb.js +1 -0
  8. package/assets/esri/core/workers/chunks/{de6d54df7ae32694fd70.js → 534abb4408b15ac778dd.js} +1 -1
  9. package/assets/esri/core/workers/chunks/a068f0c8c1c632e8b2cb.js +1 -0
  10. package/assets/esri/core/workers/chunks/{2621b755fa5403bd8a4c.js → e232f6fca5629ae66dcc.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{0e56ff6978ba8d9cf0c0.js → f74eec62bcf3264e2d90.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{8a9387483b19a5ec5b86.js → fc5ac713872766571e07.js} +1 -1
  13. package/assets/esri/themes/base/widgets/_LayerList.scss +2 -0
  14. package/assets/esri/themes/dark/main.css +1 -1
  15. package/assets/esri/themes/light/main.css +1 -1
  16. package/assets/esri/themes/light/view.css +1 -1
  17. package/core/workers/InvokeHandler.js +1 -1
  18. package/core/workers/RemoteClient.js +1 -1
  19. package/core/workers/utils.js +1 -1
  20. package/interfaces.d.ts +47 -35
  21. package/kernel.js +1 -1
  22. package/layers/support/Sublayer.js +1 -1
  23. package/package.json +1 -1
  24. package/support/revision.js +1 -1
  25. package/symbols/support/urlUtils.js +1 -1
  26. package/views/2d/engine/Stage.js +1 -1
  27. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  28. package/views/2d/engine/webgl/shaderGraph/techniques/Technique.js +1 -1
  29. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js +1 -1
  30. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  31. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
  32. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +5 -0
  33. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  34. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  35. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
  36. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  37. package/views/2d/layers/StreamLayerView2D.js +1 -1
  38. package/views/2d/layers/features/FeatureContainer.js +1 -1
  39. package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
  40. package/views/2d/layers/features/Processor.js +1 -1
  41. package/views/2d/layers/features/RenderState.js +1 -1
  42. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  43. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  44. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  45. package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
  46. package/views/2d/layers/support/handleNoEngineError.js +5 -0
  47. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  48. package/views/MapView.js +1 -1
  49. package/widgets/BasemapLayerList.js +1 -1
  50. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  51. package/widgets/LayerList/support/layerListUtils.js +1 -1
  52. package/widgets/LayerList.js +1 -1
  53. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  54. package/assets/esri/core/workers/chunks/686a76adc741eef369ee.js +0 -1
  55. package/assets/esri/core/workers/chunks/a48201b109e9e9aab2d6.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isHighlight as r,isHittest as i,getFeatureUniforms as s,getSelectionDefines as a}from"../featureTechniqueUtils.js";import{Technique as u}from"../Technique.js";import{meshWriterRegistry as o}from"../mesh/MeshWriterRegistry.js";import{HeatmapAccumulateShader as n}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as l}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as h,StencilOperation as c,ClearBufferBit as m,TextureWrapMode as d,RenderbufferFormat as f,TextureSamplingMode as p,PixelType as _}from"../../../../../../webgl/enums.js";import{FramebufferObject as b}from"../../../../../../webgl/FramebufferObject.js";import{loadHeatmapTextureConfiguration as w}from"../../../../../../webgl/heatmapTextureUtils.js";import{RenderbufferDescriptor as F}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as v}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as g}from"../../../../../../webgl/TextureDescriptor.js";const x=()=>e.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.heatmap.HeatmapTechnique");class T extends u{constructor(){super(...arguments),this.meshWriter=o.HeatmapMeshWriter,this.shaders={accumulate:new n,resolve:new l},this.postProcessingEnabled=!0,this._isBound=!1,this.overrideStencilRef=P}shutdown(){super.shutdown(),this._prevFBO=null,this._accumulateFramebuffer=t(this._accumulateFramebuffer),this._resolveGradientTexture=t(this._resolveGradientTexture),this._prevGradientHash=null,this._qualityProfile=null,this._unbind()}render(e,t){const{context:u,painter:o,state:n}=e,l=t.instance.getInput(),{isFieldActive:h}=l,c=this._loadQualityProfile(u);if(r(e))return;i(e)||this._ensureBound(e,l),o.setShader({shader:this.shaders.accumulate,uniforms:{...s(e,t.target),kernelControls:{radius:R(l,n),isFieldActive:h?1:0}},defines:{...a(e),...c.defines},optionalAttributes:t.instance.optionalAttributes,useComputeBuffer:i(e)});const m=i(e)?y:E;o.setPipelineState(m),o.submitDraw(u,t)}postProcess(e,t){if(i(e)||r(e))return;if(null==this._prevFBO||null==this._prevViewport||null==this._accumulateFramebuffer||null==this._resolveGradientTexture)return;const{context:s,painter:a}=e,{defines:u}=this._loadQualityProfile(s),{minDensity:o,maxDensity:n,radius:l}=t.getInput(),h=8,c=9;a.setShader({shader:this.shaders.resolve,uniforms:{accumulatedDensity:{texture:{unit:h,texture:this._accumulateFramebuffer.colorTexture},minAndInvRange:[o,1/(n-o)],normalization:3/(l*l*Math.PI)},gradient:{texture:{unit:c,texture:this._resolveGradientTexture}}},defines:u,optionalAttributes:{},useComputeBuffer:!1}),s.bindFramebuffer(this._prevFBO),s.setViewport(0,0,this._prevViewport.width,this._prevViewport.height),s.bindTexture(this._accumulateFramebuffer.colorTexture,h),s.bindTexture(this._resolveGradientTexture,c),a.setPipelineState(G),a.submitDrawQuad(s),this._unbind()}_unbind(){this._prevFBO=null,this._prevViewport=null,this._isBound=!1}_ensureBound(e,t){if(this._isBound)return;const{context:r}=e;this._prevFBO=r.getBoundFramebufferObject(),this._prevViewport=r.getViewport(),this._ensureResources(e,t),this._updateResources(e,t),r.bindFramebuffer(this._accumulateFramebuffer),r.setViewport(0,0,this._accumulateFramebuffer.width,this._accumulateFramebuffer.height),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.clear(m.COLOR_BUFFER_BIT),this._isBound=!0}_ensureResources({context:e,state:t,pixelRatio:r},i){if(null==this._accumulateFramebuffer){const{dataType:s,samplingMode:a,pixelFormat:u,internalFormat:o}=this._loadQualityProfile(e),{width:n,height:l}=this._prevViewport,h=B(R(i,t),r),c=n*h,m=l*h,p=new g(c,m);p.pixelFormat=u,p.internalFormat=o,p.dataType=s,p.samplingMode=a,p.wrapMode=d.CLAMP_TO_EDGE;const _=new F(f.DEPTH_STENCIL,c,m);this._accumulateFramebuffer=new b(e,p,_)}if(null==this._resolveGradientTexture){const t=new g;t.wrapMode=d.CLAMP_TO_EDGE,this._resolveGradientTexture=new v(e,t)}}_updateResources({context:e,state:t,pixelRatio:r},i){const{gradient:s,gradientHash:a}=i;this._prevGradientHash!==a&&(this._resolveGradientTexture.resize(s.length/4,1),this._resolveGradientTexture.setData(s),this._prevGradientHash=a);const u=B(R(i,t),r),{width:o,height:n}=this._prevViewport,l=o*u,h=n*u,{width:c,height:d}=this._accumulateFramebuffer;c===l&&d===h||this._accumulateFramebuffer.resize(l,h),e.blitFramebuffer(this._prevFBO,this._accumulateFramebuffer,0,0,this._prevFBO.width,this._prevFBO.height,0,0,this._accumulateFramebuffer.width,this._accumulateFramebuffer.height,m.STENCIL_BUFFER_BIT,p.NEAREST)}_loadQualityProfile(e){if(null==this._qualityProfile){const t=w(e,x());this._qualityProfile={...t,defines:{usesHalfFloatPrecision:t.dataType!==_.FLOAT}}}return this._qualityProfile}}function B(e,t){const r=t>1.5?.25:.5;return e<1/(2*r)?1:r}function P(e){return e.key.level+1}const E={color:{write:[!0,!0,!0,!0],blendMode:"additive"},depth:!1,stencil:{write:!1,test:{ref:P,compare:h.GEQUAL,mask:255,op:{fail:c.KEEP,zFail:c.KEEP,zPass:c.REPLACE}}}},y={...E,stencil:!1},G={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1};function R(e,t){const{referenceScale:r,radius:i}=e;return i*(0!==r?r/t.scale:1)}export{T as HeatmapTechnique};
5
+ import{isHighlight as e,isHittest as t,getFeatureUniforms as r,getSelectionDefines as s}from"../featureTechniqueUtils.js";import{Technique as i}from"../Technique.js";import{HeatmapResources as n}from"./HeatmapResources.js";import{meshWriterRegistry as o}from"../mesh/MeshWriterRegistry.js";import{HeatmapAccumulateShader as u}from"../shaders/HeatmapAccumulateShader.js";import{HeatmapResolveShader as a}from"../shaders/HeatmapResolveShader.js";import{CompareFunction as d,StencilOperation as h,ClearBufferBit as l,TextureSamplingMode as c}from"../../../../../../webgl/enums.js";class p extends i{constructor(){super(...arguments),this.meshWriter=o.HeatmapMeshWriter,this.shaders={accumulate:new u,resolve:new a},this.postProcessingEnabled=!0,this._isBound=!1,this._resources=new Map,this.overrideStencilRef=f}shutdown(e){super.shutdown(e),this._resources.get(e)?.destroy(),this._resources.delete(e),this._prevFBO=null,this._unbind()}render(i,n){const{context:o,painter:u,state:a}=i,d=n.instance.getInput(),{isFieldActive:h}=d,l=this._getOrCreateResourcesRecord(o),c=l.loadQualityProfile(o);if(e(i))return;t(i)||this._bind(i,l,d),u.setShader({shader:this.shaders.accumulate,uniforms:{...r(i,n.target),kernelControls:{radius:g(d,a),isFieldActive:h?1:0}},defines:{...s(i),...c.defines},optionalAttributes:n.instance.optionalAttributes,useComputeBuffer:t(i)});const p=t(i)?b:_;u.setPipelineState(p),u.submitDraw(o,n)}postProcess(r,s){if(t(r)||e(r))return;const{context:i,painter:n}=r,o=this._resources.get(i);if(null==this._prevFBO||null==this._prevViewport||!o?.initialized)return;const{defines:u}=o.loadQualityProfile(i),{minDensity:a,maxDensity:d,radius:h}=s.getInput(),l=8,c=9,p=o.accumulateFramebuffer,m=o.resolveGradientTexture;n.setShader({shader:this.shaders.resolve,uniforms:{accumulatedDensity:{texture:{unit:l,texture:p.colorTexture},minAndInvRange:[a,1/(d-a)],normalization:3/(h*h*Math.PI)},gradient:{texture:{unit:c,texture:m}}},defines:u,optionalAttributes:{},useComputeBuffer:!1}),i.bindFramebuffer(this._prevFBO),i.setViewport(0,0,this._prevViewport.width,this._prevViewport.height),i.bindTexture(p.colorTexture,l),i.bindTexture(m,c),n.setPipelineState(w),n.submitDrawQuad(i),this._unbind()}_getOrCreateResourcesRecord(e){let t=this._resources.get(e);return null==t&&(t=new n,this._resources.set(e,t)),t}_unbind(){this._prevFBO=null,this._prevViewport=null,this._isBound=!1}_bind(e,t,r){if(this._isBound)return;const{context:s,state:i,pixelRatio:n}=e,o=s.getBoundFramebufferObject(),u=s.getViewport();this._prevFBO=o,this._prevViewport=u;const{gradient:a,gradientHash:d}=r;t.ensureResolveGradientTexture(s,d,a);const{width:h,height:p}=u,f=m(g(r,i),n),_=h*f,b=p*f,w=t.ensureAccumulateFBO(s,_,b);s.blitFramebuffer(o,w,0,0,o.width,o.height,0,0,w.width,w.height,l.STENCIL_BUFFER_BIT,c.NEAREST),s.bindFramebuffer(w),s.setViewport(0,0,w.width,w.height),s.setColorMask(!0,!0,!0,!0),s.setClearColor(0,0,0,0),s.clear(l.COLOR_BUFFER_BIT),this._isBound=!0}}function m(e,t){const r=t>1.5?.25:.5;return e<1/(2*r)?1:r}function f(e){return e.key.level+1}const _={color:{write:[!0,!0,!0,!0],blendMode:"additive"},depth:!1,stencil:{write:!1,test:{ref:f,compare:d.GEQUAL,mask:255,op:{fail:h.KEEP,zFail:h.KEEP,zPass:h.REPLACE}}}},b={..._,stencil:!1},w={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:!1,stencil:!1};function g(e,t){const{referenceScale:r,radius:s}=e;return s*(0!==r?r/t.scale:1)}export{p as HeatmapTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{minMaxZoomPrecisionFactor as s,thinLineHalfWidthThreshold as i}from"../../../definitions.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as o}from"../../../mesh/templates/templateUtils.js";import{getMinMaxZoom as n,processColorInput as a,packRounded as c,packCeil as h,processLineCapInput as l,processLineJoinInput as m}from"../fill/meshWriterUtils.js";import{MeshWriter as u}from"../mesh/MeshWriter.js";import{DataType as p}from"../../../../../../webgl/enums.js";class d{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0}}const f={createComputedParams:t=>t,attributes:{id:{type:p.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:p.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:p.UNSIGNED_BYTE,count:1},zoomRange:{type:p.SHORT,count:2,packPrecisionFactor:s,pack:({scaleInfo:t},{tileInfo:e})=>n(t,e)},color:{type:p.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>a(t)},offset:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[c(t,16),c(e,16)]},normal:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[c(t,16),c(e,16)]},halfWidth:{type:p.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({width:e})=>h(t(.5*e),16)},referenceHalfWidth:{type:p.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({referenceWidth:e})=>h(t(.5*e),16)}}};class _{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0}}const x=65535;class T extends u{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=f,this._currentWrite=new _,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:x,textured:!1},this._tessParams=new d,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new r(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,s,i){const r=i??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){const e=this.hasEffects;return o(t,e?256:16)}_writeVertices(e,s,r){const{_currentWrite:o,_tessellationOptions:n,evaluatedMeshParams:a}=this,{width:c,capType:h,joinType:u,miterLimit:p,hasSizeVV:d}=a,f=t(.5*c);n.halfWidth=f,n.capType=l(h),n.joinType=m(u),n.miterLimit=p;const _=!d;o.out=e,o.id=s.getDisplayId(),o.vertexCount=0,o.indexCount=0,o.vertexFrom=e.vertexCount(),o.vertexBounds=_&&f<i?0:1;for(const{line:t,start:i}of r)n.initialDistance=i%x,this._lineTessellator.tessellate(t,n,_)}_writeTesselatedVertex(t,e,s,i,r,o,n,a,c,h,l){const{out:m,id:u,vertexBounds:p}=this._currentWrite;return this.hasEffects&&m.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=n,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=h,this._tessParams.directionX=r,this._tessParams.directionY=o,this._tessParams.distance=l,this._writeVertex(m,u,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{T as LineMeshWriter,d as LineTessellationParams,f as LineVertexSpec};
5
+ import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{minMaxZoomPrecisionFactor as s,thinLineHalfWidthThreshold as i}from"../../../definitions.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as o}from"../../../mesh/templates/templateUtils.js";import{getMinMaxZoom as n,processColorInput as a,packRounded as c,packCeil as h,processLineCapInput as l,processLineJoinInput as m}from"../fill/meshWriterUtils.js";import{MeshWriter as u}from"../mesh/MeshWriter.js";import{getLineClippingMargin as p}from"../mesh/utils.js";import{DataType as d}from"../../../../../../webgl/enums.js";class f{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0}}const _={createComputedParams:t=>t,attributes:{id:{type:d.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:d.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:d.UNSIGNED_BYTE,count:1},zoomRange:{type:d.SHORT,count:2,packPrecisionFactor:s,pack:({scaleInfo:t},{tileInfo:e})=>n(t,e)},color:{type:d.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>a(t)},offset:{type:d.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[c(t,16),c(e,16)]},normal:{type:d.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[c(t,16),c(e,16)]},halfWidth:{type:d.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({width:e})=>h(t(.5*e),16)},referenceHalfWidth:{type:d.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({referenceWidth:e})=>h(t(.5*e),16)}}};class x{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0}}const T=65535;class w extends u{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=_,this._currentWrite=new x,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:T,textured:!1},this._tessParams=new f,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new r(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,s,i){const r=i??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return o(t,p(this.evaluatedMeshParams))}_writeVertices(e,s,r){const{_currentWrite:o,_tessellationOptions:n,evaluatedMeshParams:a}=this,{width:c,capType:h,joinType:u,miterLimit:p,hasSizeVV:d}=a,f=t(.5*c);n.halfWidth=f,n.capType=l(h),n.joinType=m(u),n.miterLimit=p;const _=!d;o.out=e,o.id=s.getDisplayId(),o.vertexCount=0,o.indexCount=0,o.vertexFrom=e.vertexCount(),o.vertexBounds=_&&f<i?0:1;for(const{line:t,start:i}of r)n.initialDistance=i%T,this._lineTessellator.tessellate(t,n,_)}_writeTesselatedVertex(t,e,s,i,r,o,n,a,c,h,l){const{out:m,id:u,vertexBounds:p}=this._currentWrite;return this.hasEffects&&m.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=n,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=h,this._tessParams.directionX=r,this._tessParams.directionY=o,this._tessParams.distance=l,this._writeVertex(m,u,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{w as LineMeshWriter,f as LineTessellationParams,_ as LineVertexSpec};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{numericHash as e}from"../../../../../../../core/string.js";function o(o){const r=o.map((({name:e,count:o,type:r})=>`${e}.${o}.${r}`)).join(",");return e(r)}function r(e,o,t,i,a,n,c){if(e.primitiveName===o)for(const r in e)if(r===t){let o=i?.readWithDefault(a,n,e[r]&&c);return"text"===e.type&&(o=o.toString()),void(e[r]=o)}if("type"in e&&null!=e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const l of e.symbolLayers)r(l,o,t,i,a,n,c);break;case"CIMHatchFill":e.lineSymbol&&r(e.lineSymbol,o,t,i,a,n,c);break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const l of e.markerGraphics)r(l,o,t,i,a,n,c),r(l.symbol,o,t,i,a,n,c)}}export{r as applyComputedValue,o as vertexLayoutHash};
5
+ import{numericHash as e}from"../../../../../../../core/string.js";function t(t){const o=t.map((({name:e,count:t,type:o})=>`${e}.${t}.${o}`)).join(",");return e(o)}function o(e,t,r,i,n,a,c){if(e.primitiveName===t)for(const o in e)if(o===r){let t=i?.readWithDefault(n,a,e[o]&&c);return"text"===e.type&&(t=t.toString()),void(e[o]=t)}if("type"in e&&null!=e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const l of e.symbolLayers)o(l,t,r,i,n,a,c);break;case"CIMHatchFill":e.lineSymbol&&o(e.lineSymbol,t,r,i,n,a,c);break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const l of e.markerGraphics)o(l,t,r,i,n,a,c),o(l.symbol,t,r,i,n,a,c)}}function r(e){const t=e.width;return null!=e.effects?256:Math.max(1.25*t,8)}export{o as applyComputedValue,r as getLineClippingMargin,t as vertexLayoutHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function Z(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let K=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),i=E(r);e.push({objectId:t,highlightFlags:i})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:i,filter:s,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(i),l=a?.toJSON(),h=s?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(s),n=this.featureContainer.getSortKeys(s),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return Z(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r),{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r),{})}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await Z(r,{features:[]}),s=F.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await Z(r,{features:[]}),s=S.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}queryAggregateIds(e,t){return Z(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return Z(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return Z(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return Z(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return Z(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return Z(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Z(r,{count:0,extent:null});return{count:i.count,extent:G.fromJSON(i.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this.layerAdapter.createServiceOptions(this.view),s=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(i,s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(i.source)&&(u=i.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new w,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(i)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(z)],K);const X=K;export{X as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as j}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as R}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as U}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import N from"./support/FeatureCommandQueue.js";import{handleNoEngineError as D}from"./support/handleNoEngineError.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as T}from"../tiling/FeatureTileSubscriptionManager.js";import M from"../../layers/FeatureLayerView.js";import $ from"../../layers/LayerView.js";import G from"../../layers/RefreshableLayerView.js";import P from"../../../geometry/Extent.js";function z(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const B="esri.views.2d.layers.FeatureLayerView2D",Z=4294967294;let K=class extends(M(G(V($)))){constructor(){super(...arguments),this._commandsQueue=new N({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new R,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await j(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new U(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return D(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return D(i,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return D(i,{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return D(i,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return D(i,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return D(i,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return D(i,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return D(i,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale},i=this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return D(i,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await D(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await D(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){const r=this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return D(r,[])}queryAggregateCount(e,t){const r=this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return D(r,0)}queryAggregateJSON(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return D(r,{features:[]})}async queryFeaturesJSON(e,t){const r=this._worker.features.executeQuery(this._cleanUpQuery(e),t);return D(r,{features:[]})}queryObjectIds(e,t){const r=this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t);return D(r,[])}queryFeatureCount(e,t){const r=this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t);return D(r,0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await D(r,{count:0,extent:null});return{count:s.count,extent:P.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new T({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%Z+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%Z+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=z(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(B)],K);const X=K;export{X as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as o}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 i}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import l from"../../layers/StreamLayerView.js";let h=class extends(l(c)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null}initialize(){this.addHandles([o((()=>this.layer.customParameters),(e=>this._worker.streamMessenger.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._worker.streamMessenger.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>{this._worker.streamMessenger.sendMessageToClient(e),this._isUserPaused&&"type"in e&&"clear"===e.type&&this.incrementSourceRefreshVersion()})),o((()=>this.layer.purgeOptions),(()=>this._update())),o((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor"),this._doResume()}destroy(){this._doPause()}get connectionError(){return this.pipelineErrorString?new r("stream-controller",this.pipelineErrorString):null}on(e,r){if(Array.isArray(e))return t(e.map((e=>this.on(e,r))));const o=["data-received","message-received"].includes(e);o&&this._worker.streamMessenger.enableEvent(e,!0);const n=super.on(e,r),i=this;return s((()=>{n.remove(),o&&(i._worker.closed||i.hasEventListener(e)||i._worker.streamMessenger.enableEvent(e,!1))}))}queryLatestObservations(e,t){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new r("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._worker.features.executeQueryForLatestObservations(this._cleanUpQuery(e),t).then((e=>{const r=a.fromJSON(e);return r.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),r}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){null!=this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=null)}_doResume(){this._refreshInterval=setInterval((()=>this.incrementSourceRefreshVersion()),this.layer.updateInterval)}_doDisconnect(){this._worker.streamMessenger.disconnect(),this._doPause()}_doConnect(){this._worker.streamMessenger.connect(),this.resume()}_doClear(){this._worker.streamMessenger.clear(),null==this._refreshInterval&&this.incrementSourceRefreshVersion()}_createClientOptions(){const e=super._createClientOptions(),r=this;return{...e,get container(){return r.featureContainer},setProperty:e=>{this.set(e.propertyName,e.value)}}}};e([n()],h.prototype,"pipelineConnectionStatus",void 0),e([n()],h.prototype,"pipelineErrorString",void 0),e([n({readOnly:!0})],h.prototype,"connectionError",null),e([n({readOnly:!0})],h.prototype,"_streamConnectionStatus",null),h=e([i("esri.views.2d.layers.StreamLayerView2D")],h);const p=h;export{p as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as o}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 i}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../rest/support/FeatureSet.js";import c from"./FeatureLayerView2D.js";import{handleNoEngineError as l}from"./support/handleNoEngineError.js";import h from"../../layers/StreamLayerView.js";let p=class extends(h(c)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null}initialize(){this.addHandles([o((()=>this.layer.customParameters),(e=>this._worker.streamMessenger.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._worker.streamMessenger.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>{this._worker.streamMessenger.sendMessageToClient(e),this._isUserPaused&&"type"in e&&"clear"===e.type&&this.incrementSourceRefreshVersion()})),o((()=>this.layer.purgeOptions),(()=>this._update())),o((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor"),this._doResume()}destroy(){this._doPause()}get connectionError(){return this.pipelineErrorString?new r("stream-controller",this.pipelineErrorString):null}on(e,r){if(Array.isArray(e))return t(e.map((e=>this.on(e,r))));const o=["data-received","message-received"].includes(e);o&&this._worker.streamMessenger.enableEvent(e,!0);const n=super.on(e,r),i=this;return s((()=>{n.remove(),o&&(i._worker.closed||i.hasEventListener(e)||i._worker.streamMessenger.enableEvent(e,!1))}))}queryLatestObservations(e,t){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new r("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return l(this._worker.features.executeQueryForLatestObservations(this._cleanUpQuery(e),t).then((e=>{const r=a.fromJSON(e);return r.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),r})),new a({features:[]}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){null!=this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=null)}_doResume(){this._refreshInterval=setInterval((()=>this.incrementSourceRefreshVersion()),this.layer.updateInterval)}_doDisconnect(){this._worker.streamMessenger.disconnect(),this._doPause()}_doConnect(){this._worker.streamMessenger.connect(),this.resume()}_doClear(){this._worker.streamMessenger.clear(),null==this._refreshInterval&&this.incrementSourceRefreshVersion()}_createClientOptions(){const e=super._createClientOptions(),r=this;return{...e,get container(){return r.featureContainer},setProperty:e=>{this.set(e.propertyName,e.value)}}}};e([n()],p.prototype,"pipelineConnectionStatus",void 0),e([n()],p.prototype,"pipelineErrorString",void 0),e([n({readOnly:!0})],p.prototype,"connectionError",null),e([n({readOnly:!0})],p.prototype,"_streamConnectionStatus",null),p=e([i("esri.views.2d.layers.StreamLayerView2D")],p);const u=p;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import"../../../../core/Logger.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as r,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/InstanceStore.js";import{RenderState as h}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";class l{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class u extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._layerView=e}renderChildren(e){if(this.attributeView.update(),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())}for(const t of this.children)t.setTransform(e.state);if(super.renderChildren(e),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}switch(e.drawPhase){case r.MAP:return this._renderMapPhase(e);case r.HIGHLIGHT:return this._renderHighlightPhase(e);case r.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight()}get _layer(){return this._layerView.layer}_getExclusivePostprocessingInstance({drawPhase:e}){if(null==this._instanceStore)return null;let t=0,s=null;for(const i of this._instanceStore.values())i.techniqueRef.drawPhase&e&&(t++,i.techniqueRef.postProcessingEnabled&&(s=i));return t>1?null:s}_getOverrideStencilRef({drawPhase:e}){if(null==this._instanceStore)return null;let t=null;for(const s of this._instanceStore.values()){if(!(s.techniqueRef.drawPhase&e))continue;const{overrideStencilRef:i}=s.techniqueRef;if(null==t)t=i;else if(t!==i){t=null;break}}return t}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}async updateAttributeView(e){this.requestRender(),await this.updatingHandles.addPromise(this.attributeView.requestUpdate(e)),this.hasLabels&&this._layerView.view.labelManager.requestUpdate()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new l(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new h(this._stage,e,this._tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const i of t)s.set(i.fieldName,{minValue:i.minValue,maxValue:i.maxValue})}editStart(){this._renderState?.lockUploads(),this.attributeView.lockTextureUploads(),this._lockStatisticUpdates=!0}editEnd(){this._renderState?.unlockUploads(),this.attributeView.unlockTextureUploads(),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this.requestRender()}swapRenderState(){if(this._renderStateNext&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`),this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderStateNext=null),this._renderState)for(const e of this._renderState.tiles())e.upload();this.requestRender()}setVisibleTiles(e){this._visibleTiles=e}async onMessage(t,s){if(e(s),!this._subscriptions.has(t.id))return;const i=this._subscriptions.get(t.id);if(i.version!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}const r=this._renderStateNext??this._renderState;if(!r)throw new Error("InternalError: No renderState defined");if(r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.updateTile(t),t.end){this._subscriptions.get(t.id).end()}this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const i=t();return s?s.resolvers.push(i):(s={x:e.x,y:e.y,resolvers:[i]},this._hitTestsRequests.push(s)),this.requestRender(),i.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const i of this.children)if(i.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){const t=this._getOverrideStencilRef(e);if(null==t)super.setStencilReference(e);else for(const s of this.children)s.stencilRef=t(s)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&d(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,i=t.getBoundFramebufferObject(),r=t.getViewport(),a=e.passOptions;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),this._renderFeatures(e,n.All),s.draw(e),s.unbind(),t.bindFramebuffer(i),t.restoreViewport(r),e.passOptions=a}_renderFeatures(e,t){for(const i of this.children){if(!i.visible)continue;const s=has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,r=i.getDisplayList(e.drawPhase,this._instanceStore,s);e.selection=t,r?.render(e)}const s=this._getExclusivePostprocessingInstance(e);null!=s&&s.techniqueRef.postProcess(e,s)}}export{u as FeatureContainer};
5
+ import has from"../../../../core/has.js";import"../../../../core/Logger.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as r,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/InstanceStore.js";import{RenderState as h}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";class l{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class u extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._layerView=e}renderChildren(e){if(this.attributeView.update(),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())}for(const t of this.children)t.setTransform(e.state);if(super.renderChildren(e),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}switch(e.drawPhase){case r.MAP:return this._renderMapPhase(e);case r.HIGHLIGHT:return this._renderHighlightPhase(e);case r.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight()}get _layer(){return this._layerView.layer}_getExclusivePostprocessingInstance({drawPhase:e}){if(null==this._instanceStore)return null;let t=0,s=null;for(const i of this._instanceStore.values())i.techniqueRef.drawPhase&e&&(t++,i.techniqueRef.postProcessingEnabled&&(s=i));return t>1?null:s}_getOverrideStencilRef({drawPhase:e}){if(null==this._instanceStore)return null;let t=null;for(const s of this._instanceStore.values()){if(!(s.techniqueRef.drawPhase&e))continue;const{overrideStencilRef:i}=s.techniqueRef;if(null==t)t=i;else if(t!==i){t=null;break}}return t}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}async updateAttributeView(e){this.requestRender(),await this.updatingHandles.addPromise(this.attributeView.requestUpdate(e)),this.hasLabels&&this._layerView.view.labelManager.requestUpdate()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new l(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new h((()=>this._stage),e,this._tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const i of t)s.set(i.fieldName,{minValue:i.minValue,maxValue:i.maxValue})}editStart(){this._renderState?.lockUploads(),this.attributeView.lockTextureUploads(),this._lockStatisticUpdates=!0}editEnd(){this._renderState?.unlockUploads(),this.attributeView.unlockTextureUploads(),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this.requestRender()}swapRenderState(){if(this._renderStateNext&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`),this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderStateNext=null),this._renderState)for(const e of this._renderState.tiles())e.upload();this.requestRender()}setVisibleTiles(e){this._visibleTiles=e}async onMessage(t,s){if(e(s),!this._subscriptions.has(t.id))return;const i=this._subscriptions.get(t.id);if(i.version!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}const r=this._renderStateNext??this._renderState;if(!r)throw new Error("InternalError: No renderState defined");if(r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.updateTile(t),t.end){this._subscriptions.get(t.id).end()}this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const i=t();return s?s.resolvers.push(i):(s={x:e.x,y:e.y,resolvers:[i]},this._hitTestsRequests.push(s)),this.requestRender(),i.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const i of this.children)if(i.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){const t=this._getOverrideStencilRef(e);if(null==t)super.setStencilReference(e);else for(const s of this.children)s.stencilRef=t(s)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&d(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,i=t.getBoundFramebufferObject(),r=t.getViewport(),a=e.passOptions;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),this._renderFeatures(e,n.All),s.draw(e),s.unbind(),t.bindFramebuffer(i),t.restoreViewport(r),e.passOptions=a}_renderFeatures(e,t){for(const i of this.children){if(!i.visible)continue;const s=has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,r=i.getDisplayList(e.drawPhase,this._instanceStore,s);e.selection=t,r?.render(e)}const s=this._getExclusivePostprocessingInstance(e);null!=s&&s.techniqueRef.postProcess(e,s)}}export{u as FeatureContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){this._client=e,this.layerView=this._client.createInvokeProxy(),this.container=this._client.createInvokeProxy("container"),this.eventLog=this._client.createInvokeProxy("eventLog")}}export{e as PipelineConnectionHandlers};
5
+ class e{constructor(e){this._client=e,this.layerView=this._client.createInvokeProxy("",{ignoreConnectionErrors:!0}),this.container=this._client.createInvokeProxy("container",{ignoreConnectionErrors:!0}),this.eventLog=this._client.createInvokeProxy("eventLog",{ignoreConnectionErrors:!0})}}export{e as PipelineConnectionHandlers};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.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{ProcessorTileMessageQueue as u}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as g}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as y}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as p}from"./support/ComputedAttributeStorage.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,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 _({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new p({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)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)}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 u({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"),await 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 y(this._source,this._attributeStore,r);break;case"binning":this._strategy=await g.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await d.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)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}}}_invalidate(){this._strategy&&this._strategy.invalidate()}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`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),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){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_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)}}export{l as default};
5
+ import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.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{ProcessorTileMessageQueue as u}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as g}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as y}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as p}from"./support/ComputedAttributeStorage.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,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 _({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new p({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)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)}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 u({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"),await 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 y(this._source,this._attributeStore,r);break;case"binning":this._strategy=await g.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await d.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)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}}}_invalidate(){this._strategy&&this._strategy.invalidate()}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`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),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){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_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)}}export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import t from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as i}from"../../engine/webgl/FeatureTile.js";import{getPow2NeighborKey as s}from"./support/tileUtils.js";class o{constructor(e,t,i){this.stage=e,this.version=t,this._tileInfoView=i,this._tiles=new Map,this._pendingUpdates=[],this._locked=!1}destroy(){}tiles(){return this._tiles.values()}size(){return this._tiles.size}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1;for(const e of this._pendingUpdates)this.updateTile(e);this._pendingUpdates=[]}updateTile(e){if(this._locked)return void this._pendingUpdates.push(e);if(has("esri-2d-update-debug")){const t=e.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${e.version}] Tile[${e.id}] Chunk[${t}] RenderState.updateTile [${e.type}]`,e)}const t=this._ensureTile(e.id);if("update"===e.type){const[i,...s]=e.modify;t.onMessage({type:"update",modify:i,remove:e.remove,end:e.end,attributeEpoch:e.attributeEpoch});for(const t of s){const i=this._tiles.get(t.tileId);i&&i.onMessage({type:"update",modify:t,remove:e.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null})}return}if(null==e.append)return void t.onMessage({type:"append",clear:e.clear,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});const[i,...s]=e.append;t.onMessage({type:"append",clear:e.clear,append:i,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null})}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t?.destroy(),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&t.isReady}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(s){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${s}] RenderState.createTile`);const o=new t(s),n=this._tileInfoView.getTileBounds(e(),o),r=this._tileInfoView.getTileResolution(o.level),l=new i(o,r,n[0],n[3],!0);return l.stage=this.stage,l}_copyPixelBufferedEntitiesInto(e){let t=7;for(let i=-1;i<=1;i++)for(let o=-1;o<=1;o++){if(0===i&&0===o)continue;const n=this._tileInfoView.tileInfo.isWrappable,r=s(e.key,o,i,n).id,l=this._tiles.get(r);if(null!=l){const s=1<<t;e.copyPixelBufferedEntitesFrom(l,s,o,i)}t--}}}export{o as RenderState};
5
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{create as i}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import s from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as o}from"../../engine/webgl/FeatureTile.js";import{getPow2NeighborKey as r}from"./support/tileUtils.js";class n{constructor(e,t,i){this.getStage=e,this.version=t,this._tileInfoView=i,this._tiles=new Map,this._pendingUpdates=[],this._locked=!1}destroy(){}tiles(){return this._tiles.values()}size(){return this._tiles.size}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1;for(const e of this._pendingUpdates)this.updateTile(e);this._pendingUpdates=[]}updateTile(e){if(this._locked)return void this._pendingUpdates.push(e);if(has("esri-2d-update-debug")){const t=e.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${e.version}] Tile[${e.id}] Chunk[${t}] RenderState.updateTile [${e.type}]`,e)}const t=this._ensureTile(e.id);if("update"===e.type){const[i,...s]=e.modify;t.onMessage({type:"update",modify:i,remove:e.remove,end:e.end,attributeEpoch:e.attributeEpoch});for(const t of s){const i=this._tiles.get(t.tileId);i&&i.onMessage({type:"update",modify:t,remove:e.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null})}return}if(null==e.append)return void t.onMessage({type:"append",clear:e.clear,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});const[i,...s]=e.append;t.onMessage({type:"append",clear:e.clear,append:i,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null})}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t?.destroy(),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&t.isReady}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(r){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${r}] RenderState.createTile`);const n=new s(r),l=this._tileInfoView.getTileBounds(i(),n),d=this._tileInfoView.getTileResolution(n.level),a=new o(n,d,l[0],l[3],!0);if(a.stage=this.getStage(),!a.stage){const i=new e("featurelayerview:webgl","Cannot create tile with empty stage");t.getLogger("esri.views.2d.layers.features.RenderState").error(i)}return a}_copyPixelBufferedEntitiesInto(e){let t=7;for(let i=-1;i<=1;i++)for(let s=-1;s<=1;s++){if(0===i&&0===s)continue;const o=this._tileInfoView.tileInfo.isWrappable,n=r(e.key,s,i,o).id,l=this._tiles.get(n);if(null!=l){const o=1<<t;e.copyPixelBufferedEntitesFrom(l,o,s,i)}t--}}}export{n as RenderState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e){this._source=t,this._attributeStore=e,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(){}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,(t=>t),(t=>t))}getDisplayAndObjectIds(t){return this.displayMap(t,(t=>t),((t,e,s)=>[t,s]))}}export{e as AProcessorStrategy,t as ASendState};
5
+ class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e){this._source=t,this._attributeStore=e,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(){}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,(t=>t),(t=>t))}getDisplayAndObjectIds(t){return this.displayMap(t,(t=>t),((t,e,s)=>[t,s]))}afterUpdateChunks(){}}export{e as AProcessorStrategy,t as ASendState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/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{tileSize as i}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as r}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as o}from"./AProcessorStrategy.js";import{WithDisplayId as d}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as u}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import g from"../../../tiling/TileKey.js";const _=128;class m extends o{constructor(e){super(e),this.didSend=!1,this.done=!1}}class y{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);i.objectId=e.inner.id,i.displayId=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 g(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=a(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,r){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const r=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null;if(null!=u)if(1===u){const n=new s([],[e,r]),l=new t(n,o.inner.getAttributes(),null);l.geometry.coords[0]-=i,a.push(l);const d=new t(n,o.inner.getAttributes(),null);d.geometry.coords[0]+=i,a.push(d)}else e>i+i/2?e-=u*i:e<-i/2&&(e+=u*i);if(e<i+_&&e>=-_&&r<i+_&&r>=-_){const i=new s([],[e,r]),n=new t(i,o.inner.getAttributes(),null);n.objectId=o.inner.id,n.displayId=o.displayId,a.push(n)}}return f.fromOptimizedFeatures(a,r,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count)),this._store.releaseAllIds(),this._store.incrementDisplayIdGeneration(),this._clusters.clear();const s=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),i=1+this._clusterRadius/this._indexOptions.cellSize,r=new Set;for(const a of t){if(r.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(a.id),l=new d(a.clone(),t);r.add(a.id),this._clusters.set(a.id,l);const o=a.centroidXWorld,u=a.centroidYWorld;for(let e=a.gridY-i;e<=a.gridY+i;e++)for(let t=a.gridX-i;t<=a.gridX+i;t++){if(e===a.gridY&&t===a.gridX)continue;const i=this._cells.get(n.createId(t,e));if(!i||r.has(i.id))continue;const d=Math.abs(i.centroidXWorld-o),c=Math.abs(i.centroidYWorld-u);d<s&&c<s&&(l.inner.merge(i),r.add(i.id))}}}_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)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class S extends l{static async create(e,t,s,i,n,a){const l=new c({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>r.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await h.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,timeZone:a};return new S(e,t.clusterRadius,o,t.fields,i,n)}constructor(e,t,s,i,r,n){super(r,n,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient: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 m(e)}async*applyOverride(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){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}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}}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.objectIds);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 y(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.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new u(e.subscription,i,!0,e.done,{});yield a}}export{m as ClusterState,S 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{tileSize as i}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as r}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as o}from"./AProcessorStrategy.js";import{WithDisplayId as d}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as u}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import g from"../../../tiling/TileKey.js";const _=128;class m extends o{constructor(e){super(e),this.didSend=!1,this.done=!1}}class y{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);i.objectId=e.inner.id,i.displayId=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 g(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=a(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,r){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const r=o.inner.getCentroidY(l),d=n.tile.lod,c=d.wrap?d.worldSize[0]:null,u=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=c)if(1===c){const n=new s([],[e,r]),l=new t(n,o.inner.getAttributes(),null);l.geometry.coords[0]-=i,l.objectId=u,l.displayId=h,a.push(l);const d=new s([],[e,r]),c=new t(d,o.inner.getAttributes(),null);c.geometry.coords[0]+=i,c.objectId=u,c.displayId=h,a.push(c)}else e>i+i/2?e-=c*i:e<-i/2&&(e+=c*i);if(e<i+_&&e>=-_&&r<i+_&&r>=-_){const i=new s([],[e,r]),n=new t(i,o.inner.getAttributes(),null);n.objectId=u,n.displayId=h,a.push(n)}}return f.fromOptimizedFeatures(a,r,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 n of this._clusters.values())s.push(n.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,l=new Set;for(const a of t){if(l.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(a.id),s=new d(a.clone(),t);l.add(a.id),this._clusters.set(a.id,s);const o=a.centroidXWorld,c=a.centroidYWorld;for(let e=a.gridY-r;e<=a.gridY+r;e++)for(let t=a.gridX-r;t<=a.gridX+r;t++){if(e===a.gridY&&t===a.gridX)continue;const r=this._cells.get(n.createId(t,e));if(!r||l.has(r.id))continue;const d=Math.abs(r.centroidXWorld-o),u=Math.abs(r.centroidYWorld-c);d<i&&u<i&&(s.inner.merge(r),l.add(r.id))}}for(const n of s)this._store.releaseDisplayIdForObjectId(n)}_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)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class S extends l{static async create(e,t,s,i,n,a){const l=new u({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>r.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await h.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,timeZone:a};return new S(e,t.clusterRadius,o,t.fields,i,n)}constructor(e,t,s,i,r,n){super(r,n,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient: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 m(e)}async*applyOverride(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){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}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}}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.objectIds);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 y(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.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{m as ClusterState,S 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/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e,s){super(t,e),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._timeZone)}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
5
+ import{ASendState as e,AProcessorStrategy as t}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/OverrideChunk.js";class n extends e{}class a extends t{constructor(e,t,s){super(e,t),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._timeZone)}createState(e){return new n(e)}get aggregateQueryEngine(){return null}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),o=[];for(const n of this._source.chunks()){const e=n.reader.getCursor();for(;e.next();){const t=e.getObjectId(),n=e.getDisplayId(),a=r.get(t);if(null!=a){const e=s(n,a,t);o.push(e),r.delete(t)}}}return o}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const o of this._source.chunks()){const e=o.reader.getCursor();for(;e.next();){const o=e.getObjectId(),n=e.getDisplayId();t.has(n)&&!s.has(o)&&(r.push({...e.readLegacyFeatureWorldSpace(),displayId:n}),s.add(o))}}return{features:r,aggregates:[]}}async*applyOverride(e){const t=[],r=e.reader.getCursor();for(;r.next();){const e=r.getObjectId();t.push(e);const s=this._attributeStore.createDisplayIdForObjectId(e);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const n=this.getDisplayIds(t),a=this.getDisplayIds(e.removed),i=new o;i.applyOverrides(e);for(const o of this._sendStates.values())yield new s(o.subscription,null,n,!1,i.queryInfo);for(const o of this._sendStates.values()){const e=i.getTileReader(o.subscription.tile);yield new s(o.subscription,e,a,!1,i.queryInfo)}for(const s of e.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const e of this._sendStates.values())yield*this._update(e)}}removeChunks(e){for(const t of e)this.handledChunks.delete(t.chunkId),this.handledChunksForAttributeData.delete(t.chunkId),this._cleanupChunkIds(t)}afterUpdateChunks(){for(const e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this.handledChunksForIdCreation.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this.handledChunksForIdCreation.delete(e.chunkId)}}async _updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:s}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=s.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions)}}}*_update(e){const{subscription:t,handledChunks:s}=e;for(const o of this._source.chunks()){const{chunkId:n}=o;if(s.has(n))continue;s.add(n);const a=o.getTileReader(t.tile);a&&(yield new r(e.subscription,a,!1,o.end,o.queryInfo))}}}export{n as DefaultSendState,a as FeatureUpdateStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{QueueProcessor as o}from"../../../../../support/QueueProcessor.js";class n extends r{constructor(e,t,r,n,a){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=n,this._eventLog=a,this._queue=new o({concurrency:16,process:async e=>{const t={signal:e.options?.signal,query:e.query.customParameters};return this._adapter.executeQuery(e.query.inner,t)}}),this._adapter=s(e,n)}async updateFields(r){this._queryInfo.updateFields(r);const s=Array.from(this._store.chunks()).map((async e=>{const r=t.fromJSON(e.queryInfo.queryJSON);if(r)try{return await this._tryUpdateFields(e.reader,r),null}catch(s){return s}})),o=(await Promise.all(s)).filter((e=>e));if(o.length)throw new e("featurelayer-query","Encountered errors when downloading fields",{errors:o})}async queryOverride({edits:e}){const t=[],r=[];for(const n of e.removed)null!=n.objectId&&-1!==n.objectId?t.push(n.objectId):r.push(n.globalId);r.length&&t.push(...this._mapGlobalIdsToObjectIds(r));const s=e.addOrModified.map((({objectId:e})=>e)),o=this._queryInfo.createQuery({objectIds:s});return{reader:await this._fetch(o),removed:t}}_mapGlobalIdsToObjectIds(e){const t=new Set(e),r=this._metadata.globalIdField;if(null==r)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=[];return this._store.forEachUnsafe((e=>{const o=e.readAttribute(r);t.has(o)&&s.push(e.getObjectId())})),s}async _fetch(e,t){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e.inner),r}async _tryUpdateFields(e,t){const r=this._queryInfo.createPatchFieldsQuery(t,e.fields);if(!r)return;const s=await this._enqueue(r,this._options);e.joinAttributes(s)}async _enqueue(e,t){return this._eventLog.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally((()=>{this._eventLog.onEvent({type:"fetchEnd",done:0===this._queue.length})}))}}export{n as AFetchLoadStrategy};
5
+ import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{FeatureSetReaderJSON as o}from"../../support/FeatureSetReaderJSON.js";import{QueueProcessor as n}from"../../../../../support/QueueProcessor.js";class a extends r{constructor(e,t,r,o,a){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=o,this._eventLog=a,this._queue=new n({concurrency:16,process:async e=>{const t={signal:e.options?.signal,query:e.query.customParameters};return this._adapter.executeQuery(e.query.inner,t)}}),this._adapter=s(e,o)}async updateFields(r){this._queryInfo.updateFields(r);const s=Array.from(this._store.chunks()).map((async e=>{const r=t.fromJSON(e.queryInfo.queryJSON);if(r)try{return await this._tryUpdateFields(e.reader,r),null}catch(s){return s}})),o=(await Promise.all(s)).filter((e=>e));if(o.length)throw new e("featurelayer-query","Encountered errors when downloading fields",{errors:o})}async queryOverride({edits:e}){const t=[],r=[];for(const o of e.removed)null!=o.objectId&&-1!==o.objectId?t.push(o.objectId):r.push(o.globalId);r.length&&t.push(...this._mapGlobalIdsToObjectIds(r));const s=e.addOrModified.map((({objectId:e})=>e));let n;if(s.length){const e=this._queryInfo.createQuery({objectIds:s});n=await this._fetch(e)}else n=o.empty(this._metadata);return{reader:n,removed:t}}_mapGlobalIdsToObjectIds(e){const t=new Set(e),r=this._metadata.globalIdField;if(null==r)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=[];return this._store.forEachUnsafe((e=>{const o=e.readAttribute(r);t.has(o)&&s.push(e.getObjectId())})),s}async _fetch(e,t){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e.inner),r}async _tryUpdateFields(e,t){const r=this._queryInfo.createPatchFieldsQuery(t,e.fields);if(!r)return;const s=await this._enqueue(r,this._options);e.joinAttributes(s)}async _enqueue(e,t){return this._eventLog.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally((()=>{this._eventLog.onEvent({type:"fetchEnd",done:0===this._queue.length})}))}}export{a as AFetchLoadStrategy};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ async function n(n,r){try{return await n}catch(t){if("no-queryEngine"!==t.name)throw t;return r}}export{n as handleNoEngineError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as m}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as _,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as x}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as b}from"../../../../support/arcadeOnDemand.js";import{CIMSymbolHelper as S}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as v}from"../../../../symbols/cim/OverrideHelper.js";import{evaluateValueOrFunction as P}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as R}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as M}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as C}from"../../../../symbols/support/utils.js";import w from"../../../2d/arcade/callExpressionWithFeature.js";import{transparentUnit as O}from"./constants.js";import{perObjectElevationAligner as j}from"./ElevationAligners.js";import{SymbolUpdateType as I,elevationModeChangeUpdateType as T,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as U}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A}from"./graphicUtils.js";import{ApplyRendererDiffResult as L}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as G}from"./placementUtils.js";import{placePointOnGeometry as V,createStageObject as H,extendPointGraphicElevationContext as k}from"./pointUtils.js";import{initFastSymbolUpdatesState as B,updateFastSymbolUpdatesState as N,evaluateModelTransformScale as W,ConvertOptions as $}from"../support/FastSymbolUpdates.js";import{createTexture as q,requiresHalfTexelOffset as J,defaultSymbolSizeRatio as Z,defaultTexSize as K}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as Q}from"../../terrain/OverlayRenderer.js";import{createPointGeometry as X}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as Y}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as ee}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as te}from"../../webgl-engine/materials/HUDMaterial.js";const re=f(0,0,1),ie=16,se=1.5,oe=Z,ae=[oe/2,oe/2,1-oe/2,1-oe/2],ne=[K*oe,K*oe];class le extends F{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,r,i){super(e,t,r,i),this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=C(this.symbolLayer),i=u(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ie);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){let t=this._cimData;if(t&&t.symbol||this.logger.error("Can't create texture, CIM data is undefined"),t.primitiveOverrides){t=s(t);const r=t.primitiveOverrides;v.evaluateOverrides(r,e,this._arcadeInfo.geometryType,null,null),v.applyOverrides(t.symbol,r)}const r=m(JSON.stringify(t));let i=this._cimSymbolTextures.get(r);if(i)return i;const o=this._context.sharedResources.cimSymbolRasterizer,a=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;a&&v.applyDictionaryTextOverrides(t.symbol,e,a,null);const n=null!=this._cimScaleFactorOrFunction?P(this._cimScaleFactorOrFunction,e):1;1!==n&&t.symbol&&z(t.symbol,n,!0);const l=S.getEnvelope(t,null,o.resourceManager);if(l&&l.width&&l.height){const e=l.x+l.width/2,r=l.y+l.height/2,s=o.rasterize({type:"cim",data:t},l.width,l.height,e,r,1,"esriGeometryPoint"),a=new M({x:-l.x/l.width-.5,y:(l.height+l.y)/l.height-.5});this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",a),i=new ee(s,{width:s?.width??1,height:s?.height??1})}else i=new ee(new ImageData(1,1),{width:1,height:1});return this._cimSymbolTextures.set(r,i),this._context.stage.add(i),i}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ce(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:c(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(he(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>q(t)));this._textureHandle=r,e.textureId=r.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=J(t),e.distanceFieldBoundingBox=ae;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/oe,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.texture;this._size=this._computeSizeFromTexture(c,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){if(this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference))}const i=this._context.sharedResources.cimSymbolRasterizer,s=[],o=t,a=o?.symbol;S.fetchResources(a,i.resourceManager,s,r),S.fetchFonts(a,i.resourceManager,s);const n=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):[],c=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:c,fields:n,geometryType:"esriGeometryPoint"},o?.primitiveOverrides&&s.push(v.createRenderExpressions(o.primitiveOverrides,this._arcadeInfo)),s.length>0&&(await Promise.all(s),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await b(t,this._context.layer.spatialReference,n);this._cimScaleFactorOrFunction=(e,t,i)=>{const s=w(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||R}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=he(this._getPrimitive())?se:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(he(this._getPrimitive()))return O;const e=null==this._getPrimitive(),t=this.symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in G?G[e]:G.center}_createMaterialAndAddToStage(e,t){if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new te(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._fastUpdates=B(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new te(e),t.add(this._materials[0]),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._forEachMaterial((e=>this._context.stage.remove(e))),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=c(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i=[0,0];if(this._cimData){if(!this._cimData.symbol)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage),i=[e.parameters.width,e.parameters.height]}else i=this._size,r=this._materials[0];const s=V(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,a=this._getVertexOpacityAndColor(o);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(o,e)}n*=this._symbolTextureRatio;const l=d(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,a,l,e.layer.uid):this._createAs3DShape(t,s,r,a,l,c,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(le.elevationModeChangeTypes,r,i);if(s!==I.UPDATE)return s;const o=E(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return L.RecreateSymbol;if(!N(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return L.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return L.FastUpdate}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:m}=this._context.sharedResources;if(null==h||null==m)return;const u=this._getIconSize(),d=u*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push((()=>{this._patchTask=o(this._patchTask),this._patchTask=r((e=>this._context.schedule((async(e,r)=>{const s=await t(m.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial((e=>{e.visible=!1,e.setParameters({textureId:null})}));const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.texture;this._size=this._computeSizeFromTexture(c,u),this._forEachMaterial((e=>{e.setParameters({textureId:c.id}),e.visible=!0}))}),e)))})),delete c.href}_defaultElevationInfoNoZ(){return me}_createAs3DShape(e,t,r,i,s,o,a){const n=this.getFastUpdateAttrValues(e),l=this._context.layer.uid,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:a,layerUid:l}),h=X(r,re,null,i,s,ue,null,n,c),m=H(this._context,t,h,o,a);if(null==m)return null;const u=new D(this,m.object,[h],null,null,j,o);return u.alignedSampledElevation=m.sampledElevation,u.needsElevationUpdates=E(o.mode)||"absolute-height"===o.mode,u.getScreenSize=this._createScreenSizeGetter(s,n),u.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(u.getScreenSize(),1,e),k(u,t,this._context.elevationProvider),u}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=_();g(t,a,this._context.overlaySR),a[2]=Q;const n=this._context.clippingExtent;if(null!=n&&!x(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),h=X(r,re,a,i,s,null,null,l,c),m=new Y(h,{layerUid:o,graphicUid:e.uid}),u=new U(this,[m],null,this._context.drapeSourceRenderer);return u.getScreenSize=this._createScreenSizeGetter(s,l),u.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(u.getScreenSize(),1,e),u}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=W(de,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=f(e,e,e),r=h(1),i=e*r,s=f(i,i,i);return new $({size:!0,color:!0,rotation:!0,opacity:!1},t,s,r)}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}_computeSizeFromTexture({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}test(){return{...super.test(),material:this._materials[0]}}}function ce(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function he(e){return null!=e&&("cross"===e||"x"===e)}le.PRIMITIVE_SIZE=ne,le.elevationModeChangeTypes={definedChanged:I.UPDATE,staysOnTheGround:I.NONE,onTheGroundChanged:I.RECREATE};const me={mode:"relative-to-ground",offset:0},ue=y(0,0,0,1),de=_();export{le as Graphics3DIconSymbolLayer};
5
+ import e from"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as m}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as _,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as x}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as b}from"../../../../support/arcadeOnDemand.js";import{CIMSymbolHelper as S}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as v}from"../../../../symbols/cim/OverrideHelper.js";import{evaluateValueOrFunction as P}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as R}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as w}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import C from"../../../2d/arcade/callExpressionWithFeature.js";import{transparentUnit as O}from"./constants.js";import{perObjectElevationAligner as j}from"./ElevationAligners.js";import{SymbolUpdateType as I,elevationModeChangeUpdateType as T,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as U}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A}from"./graphicUtils.js";import{ApplyRendererDiffResult as L}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as G}from"./placementUtils.js";import{placePointOnGeometry as V,createStageObject as H,extendPointGraphicElevationContext as k}from"./pointUtils.js";import{initFastSymbolUpdatesState as B,updateFastSymbolUpdatesState as N,evaluateModelTransformScale as W,ConvertOptions as $}from"../support/FastSymbolUpdates.js";import{createTexture as q,requiresHalfTexelOffset as J,defaultSymbolSizeRatio as Z,defaultTexSize as K}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as Q}from"../../terrain/OverlayRenderer.js";import{createPointGeometry as X}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as Y}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as ee}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as te}from"../../webgl-engine/materials/HUDMaterial.js";const re=f(0,0,1),ie=16,se=1.5,oe=Z,ae=[oe/2,oe/2,1-oe/2,1-oe/2],ne=[K*oe,K*oe];class le extends F{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,r,i){super(e,t,r,i),this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=M(this.symbolLayer),i=u(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ie);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){let t=this._cimData;if(t&&t.symbol||this.logger.error("Can't create texture, CIM data is undefined"),t.primitiveOverrides){t=s(t);const r=t.primitiveOverrides;v.evaluateOverrides(r,e,this._arcadeInfo.geometryType,null,null),v.applyOverrides(t.symbol,r)}const r=m(JSON.stringify(t));let i=this._cimSymbolTextures.get(r);if(i)return i;const o=this._context.sharedResources.cimSymbolRasterizer,a=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;a&&v.applyDictionaryTextOverrides(t.symbol,e,a,null);const n=null!=this._cimScaleFactorOrFunction?P(this._cimScaleFactorOrFunction,e):1;1!==n&&t.symbol&&z(t.symbol,n,!0);const l=S.getEnvelope(t,null,o.resourceManager);if(l&&l.width&&l.height){const e=l.x+l.width/2,r=l.y+l.height/2,s=o.rasterize({type:"cim",data:t},l.width,l.height,e,r,1,"esriGeometryPoint"),a=new w({x:-l.x/l.width-.5,y:(l.height+l.y)/l.height-.5});this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",a),i=new ee(s,{width:s?.width??1,height:s?.height??1})}else i=new ee(new ImageData(1,1),{width:1,height:1});return this._cimSymbolTextures.set(r,i),this._context.stage.add(i),i}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ce(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:c(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(he(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>q(t)));this._textureHandle=r,e.textureId=r.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=J(t),e.distanceFieldBoundingBox=ae;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/oe,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.texture;this._size=this._computeSizeFromTexture(c,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){if(this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference))}const i=this._context.sharedResources.cimSymbolRasterizer,s=[],o=t,a=o?.symbol;S.fetchResources(a,i.resourceManager,s,r),S.fetchFonts(a,i.resourceManager,s);const n=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):[],c=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:c,fields:n,geometryType:"esriGeometryPoint"},o?.primitiveOverrides&&s.push(v.createRenderExpressions(o.primitiveOverrides,this._arcadeInfo)),s.length>0&&(await Promise.all(s),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await b(t,this._context.layer.spatialReference,n);this._cimScaleFactorOrFunction=(e,t,i)=>{const s=C(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||R}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=he(this._getPrimitive())?se:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(he(this._getPrimitive()))return O;const e=null==this._getPrimitive(),t=this.symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in G?G[e]:G.center}_createMaterialAndAddToStage(e,t){if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new te(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._fastUpdates=B(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new te(e),t.add(this._materials[0]),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._forEachMaterial((e=>this._context.stage.remove(e))),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=c(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i=[0,0];if(this._cimData){if(!this._cimData.symbol)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage);const o=window.devicePixelRatio||1;i=[e.parameters.width/o,e.parameters.height/o]}else i=this._size,r=this._materials[0];const s=V(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,a=this._getVertexOpacityAndColor(o);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(o,e)}n*=this._symbolTextureRatio;const l=d(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,a,l,e.layer.uid):this._createAs3DShape(t,s,r,a,l,c,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(le.elevationModeChangeTypes,r,i);if(s!==I.UPDATE)return s;const o=E(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return L.RecreateSymbol;if(!N(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return L.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return L.FastUpdate}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:m}=this._context.sharedResources;if(null==h||null==m)return;const u=this._getIconSize(),d=u*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push((()=>{this._patchTask=o(this._patchTask),this._patchTask=r((e=>this._context.schedule((async(e,r)=>{const s=await t(m.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial((e=>{e.visible=!1,e.setParameters({textureId:null})}));const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.texture;this._size=this._computeSizeFromTexture(c,u),this._forEachMaterial((e=>{e.setParameters({textureId:c.id}),e.visible=!0}))}),e)))})),delete c.href}_defaultElevationInfoNoZ(){return me}_createAs3DShape(e,t,r,i,s,o,a){const n=this.getFastUpdateAttrValues(e),l=this._context.layer.uid,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:a,layerUid:l}),h=X(r,re,null,i,s,ue,null,n,c),m=H(this._context,t,h,o,a);if(null==m)return null;const u=new D(this,m.object,[h],null,null,j,o);return u.alignedSampledElevation=m.sampledElevation,u.needsElevationUpdates=E(o.mode)||"absolute-height"===o.mode,u.getScreenSize=this._createScreenSizeGetter(s,n),u.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(u.getScreenSize(),1,e),k(u,t,this._context.elevationProvider),u}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=_();g(t,a,this._context.overlaySR),a[2]=Q;const n=this._context.clippingExtent;if(null!=n&&!x(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),h=X(r,re,a,i,s,null,null,l,c),m=new Y(h,{layerUid:o,graphicUid:e.uid}),u=new U(this,[m],null,this._context.drapeSourceRenderer);return u.getScreenSize=this._createScreenSizeGetter(s,l),u.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(u.getScreenSize(),1,e),u}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=W(de,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=f(e,e,e),r=h(1),i=e*r,s=f(i,i,i);return new $({size:!0,color:!0,rotation:!0,opacity:!1},t,s,r)}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}_computeSizeFromTexture({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}test(){return{...super.test(),material:this._materials[0]}}}function ce(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function he(e){return null!=e&&("cross"===e||"x"===e)}le.PRIMITIVE_SIZE=ne,le.elevationModeChangeTypes={definedChanged:I.UPDATE,staysOnTheGround:I.NONE,onTheGroundChanged:I.RECREATE};const me={mode:"relative-to-ground",offset:0},ue=y(0,0,0,1),de=_();export{le as Graphics3DIconSymbolLayer};