@arcgis/core 4.24.0-next.20220401 → 4.24.0-next.20220402

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 (28) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/b1188ca77b975c6a7d92.js +1 -0
  3. package/core/accessorSupport/Property.js +1 -1
  4. package/package.json +1 -1
  5. package/support/revision.js +1 -1
  6. package/views/2d/engine/Stage.js +1 -1
  7. package/views/2d/engine/flow/BrushFlow.js +1 -1
  8. package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
  9. package/views/2d/engine/imagery/BrushVectorField.js +1 -1
  10. package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
  11. package/views/2d/engine/webgl/Painter.js +1 -1
  12. package/views/2d/engine/webgl/brushes/BrushBitmap.js +1 -1
  13. package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
  14. package/views/2d/engine/webgl/brushes/WGLBrushInfo.js +1 -1
  15. package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
  16. package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
  17. package/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js +1 -1
  18. package/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js +1 -1
  19. package/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js +1 -1
  20. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
  21. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  22. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  23. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  24. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  25. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  26. package/views/2d/engine/webgl/effects/post-processing/EffectManager.js +1 -1
  27. package/views/support/DefaultsFromMap.js +1 -1
  28. package/assets/esri/core/workers/chunks/5682039666f874836451.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.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e,isNone as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{WGLGeometryType as n,WGLDrawPhase as o}from"./enums.js";import a from"./MaterialManager.js";import h from"./TextureManager.js";import{AnimationEffect as f}from"./effects/AnimationEffect.js";import{BlendEffect as l}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import _ from"./effects/HighlightEffect.js";import{HittestEffect as d}from"./effects/HittestEffect.js";import{HittestEffectVTL as b}from"./effects/HittestEffectVTL.js";import{EffectManager as g}from"./effects/post-processing/EffectManager.js";import u from"./painter/RenderPass.js";import{TextureType as E,PixelFormat as p,PixelType as m,TextureSamplingMode as T,TextureWrapMode as M,TargetType as F,DepthStencilTargetType as R,RenderbufferFormat as w,BlendFactor as C}from"../../../webgl/enums.js";import{FramebufferObject as B}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as O}from"../../../webgl/Renderbuffer.js";const S={[n.FILL]:s.fill,[n.LINE]:s.line,[n.MARKER]:s.marker,[n.TEXT]:s.text};class P{constructor(e,t,s){this.context=e,this._blitRenderer=new i,this._brushCache=new Map,this._vtlMaterialManager=new r,this._blendEffect=new l,this._fboPool=[],this.effects={highlight:new _,hittest:new d,hittestVTL:new b,integrate:new f,insideEffect:new c("inside"),outsideEffect:new c("outside")},this.materialManager=new a(e),this.textureManager=new h(t,s),this._effectsManager=new g(t)}get vectorTilesMaterialManager(){return this._vtlMaterialManager}getRenderTarget(){return this._renderTarget}setRenderTarget(e){this._renderTarget=e}getFbos(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){for(const s in this._fbos)this._fbos[s].resize(e,t);return this._fbos}const s={target:E.TEXTURE_2D,pixelFormat:p.RGBA,dataType:m.UNSIGNED_BYTE,samplingMode:T.NEAREST,wrapMode:M.CLAMP_TO_EDGE,width:e,height:t},r={colorTarget:F.TEXTURE,depthStencilTarget:R.DEPTH_STENCIL_RENDER_BUFFER},i=new O(this.context,{width:e,height:t,internalFormat:w.DEPTH_STENCIL});this._stencilBuf=i,this._fbos={output:new B(this.context,r,s,i),blend:new B(this.context,r,s,i),effect0:new B(this.context,r,s,i)}}return this._fbos}acquireFbo(e,t){let s;s=this._fboPool.length>0?this._fboPool.pop():new B(this.context,{colorTarget:F.TEXTURE,depthStencilTarget:R.DEPTH_STENCIL_RENDER_BUFFER},{target:E.TEXTURE_2D,pixelFormat:p.RGBA,dataType:m.UNSIGNED_BYTE,samplingMode:T.NEAREST,wrapMode:M.CLAMP_TO_EDGE,width:e,height:t},this._stencilBuf);const r=s.descriptor;return r.width===e&&r.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderLayers(t,s=null){const{width:r,height:i}=t.getViewport();this._prevFBO=t.getBoundFramebufferObject();const n=this.getFbos(r,i);if(t.bindFramebuffer(n.output),t.setColorMask(!0,!0,!0,!0),t.setDepthWriteEnabled(!0),e(s)){const{r:e,g:r,b:i,a:n}=s.color;t.setClearColor(n*e/255,n*r/255,n*i/255,n)}else t.setClearColor(0,0,0,0);t.setClearDepth(1),t.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.setDepthWriteEnabled(!1)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,requireFBO:o,drawPhase:a}=e;if(o||N(a,i,n,s))r.bindFramebuffer(this._fbos.blend),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(r.gl.COLOR_BUFFER_BIT|r.gl.DEPTH_BUFFER_BIT),r.setDepthWriteEnabled(!1);else{const e=this._getOutputFBO();r.bindFramebuffer(e)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(r.gl.STENCIL_BUFFER_BIT)}compositeLayer(s,r){const{context:i,blendMode:n,effects:a,requireFBO:h,drawPhase:f}=s;if(h||N(f,n,a,r)){e(a)&&a.length>0&&f===o.MAP&&this._applyEffects(s,a);const h=this._getOutputFBO();i.bindFramebuffer(h),i.setStencilTestEnabled(!1),i.setStencilWriteMask(0),i.setBlendingEnabled(!0),i.setBlendFunctionSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA),i.setColorMask(!0,!0,!0,!0);const l=t(n)||f===o.HIGHLIGHT?"normal":n;this._blendEffect.draw(s,this._fbos.blend.colorTexture,T.NEAREST,l,r)}}renderLayers(e){if(e.bindFramebuffer(this._prevFBO),!this._fbos)return;const t=this._getOutputFBO();e.setStencilTestEnabled(!1),e.setStencilWriteMask(0),this.blitTexture(e,t.colorTexture,T.NEAREST)}dispose(){if(this.materialManager.dispose(),this.textureManager.dispose(),this._blitRenderer&&(this._blitRenderer.dispose(),this._blitRenderer=null),this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache.clear(),this._brushCache=null),this._fbos)for(const e in this._fbos)this._fbos[e]&&this._fbos[e].dispose();for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects)for(const e in this.effects)this.effects[e]&&this.effects[e].dispose();this._effectsManager.dispose(),this._vtlMaterialManager&&(this._vtlMaterialManager.dispose(),this._vtlMaterialManager=null),this._prevFBO=null}getGeometryBrush(e){const t=S[e];let s=this._brushCache.get(t);return void 0===s&&(s=new t,this._brushCache.set(t,s)),this._brushCache.get(t)}renderObject(e,t,r,i){const n=s[r];if(!n)return null;let o=this._brushCache.get(n);void 0===o&&(o=new n,this._brushCache.set(n,o)),o.prepareState(e,t,i),o.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return null;let o=this._brushCache.get(n);void 0===o&&(o=new n,this._brushCache.set(n,o)),o.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map((e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e))));return new u(t,e)}setHighlightOptions(e){this.effects.highlight.setHighlightOptions(e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}_getOutputFBO(){return null!=this._renderTarget?this._renderTarget:this._fbos.output}_applyEffects(e,t){const{context:s}=e,r=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:i,effect:n}of r)s.bindFramebuffer(this._fbos.blend),i.draw(e,this._fbos.blend,n)}}function N(t,s,r,i){return t!==o.HIGHLIGHT&&(1!==i||e(s)&&"normal"!==s||e(r)&&r.length>0)}export{P as default};
5
+ import{isSome as e,isNone as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{WGLGeometryType as n,WGLDrawPhase as o}from"./enums.js";import a from"./MaterialManager.js";import h from"./TextureManager.js";import{AnimationEffect as f}from"./effects/AnimationEffect.js";import{BlendEffect as l}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import _ from"./effects/HighlightEffect.js";import{HittestEffect as d}from"./effects/HittestEffect.js";import{HittestEffectVTL as b}from"./effects/HittestEffectVTL.js";import{EffectManager as g}from"./effects/post-processing/EffectManager.js";import u from"./painter/RenderPass.js";import{TextureType as E,PixelFormat as p,PixelType as m,TextureSamplingMode as T,TextureWrapMode as M,TargetType as F,DepthStencilTargetType as R,RenderbufferFormat as w,BlendFactor as C}from"../../../webgl/enums.js";import{FramebufferObject as B}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as O}from"../../../webgl/Renderbuffer.js";const S={[n.FILL]:s.fill,[n.LINE]:s.line,[n.MARKER]:s.marker,[n.TEXT]:s.text};class P{constructor(e,t,s){this.context=e,this._blitRenderer=new i,this._brushCache=new Map,this._vtlMaterialManager=new r,this._blendEffect=new l,this._fboPool=[],this.effects={highlight:new _,hittest:new d,hittestVTL:new b,integrate:new f,insideEffect:new c("inside"),outsideEffect:new c("outside")},this.materialManager=new a(e),this.textureManager=new h(t,s),this._effectsManager=new g}get vectorTilesMaterialManager(){return this._vtlMaterialManager}getRenderTarget(){return this._renderTarget}setRenderTarget(e){this._renderTarget=e}getFbos(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){for(const s in this._fbos)this._fbos[s].resize(e,t);return this._fbos}const s={target:E.TEXTURE_2D,pixelFormat:p.RGBA,dataType:m.UNSIGNED_BYTE,samplingMode:T.NEAREST,wrapMode:M.CLAMP_TO_EDGE,width:e,height:t},r={colorTarget:F.TEXTURE,depthStencilTarget:R.DEPTH_STENCIL_RENDER_BUFFER},i=new O(this.context,{width:e,height:t,internalFormat:w.DEPTH_STENCIL});this._stencilBuf=i,this._fbos={output:new B(this.context,r,s,i),blend:new B(this.context,r,s,i),effect0:new B(this.context,r,s,i)}}return this._fbos}acquireFbo(e,t){let s;s=this._fboPool.length>0?this._fboPool.pop():new B(this.context,{colorTarget:F.TEXTURE,depthStencilTarget:R.DEPTH_STENCIL_RENDER_BUFFER},{target:E.TEXTURE_2D,pixelFormat:p.RGBA,dataType:m.UNSIGNED_BYTE,samplingMode:T.NEAREST,wrapMode:M.CLAMP_TO_EDGE,width:e,height:t},this._stencilBuf);const r=s.descriptor;return r.width===e&&r.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderLayers(t,s=null){const{width:r,height:i}=t.getViewport();this._prevFBO=t.getBoundFramebufferObject();const n=this.getFbos(r,i);if(t.bindFramebuffer(n.output),t.setColorMask(!0,!0,!0,!0),t.setDepthWriteEnabled(!0),e(s)){const{r:e,g:r,b:i,a:n}=s.color;t.setClearColor(n*e/255,n*r/255,n*i/255,n)}else t.setClearColor(0,0,0,0);t.setClearDepth(1),t.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.setDepthWriteEnabled(!1)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,requireFBO:o,drawPhase:a}=e;if(o||N(a,i,n,s))r.bindFramebuffer(this._fbos.blend),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(r.gl.COLOR_BUFFER_BIT|r.gl.DEPTH_BUFFER_BIT),r.setDepthWriteEnabled(!1);else{const e=this._getOutputFBO();r.bindFramebuffer(e)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(r.gl.STENCIL_BUFFER_BIT)}compositeLayer(s,r){const{context:i,blendMode:n,effects:a,requireFBO:h,drawPhase:f}=s;if(h||N(f,n,a,r)){e(a)&&a.length>0&&f===o.MAP&&this._applyEffects(s,a);const h=this._getOutputFBO();i.bindFramebuffer(h),i.setStencilTestEnabled(!1),i.setStencilWriteMask(0),i.setBlendingEnabled(!0),i.setBlendFunctionSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA),i.setColorMask(!0,!0,!0,!0);const l=t(n)||f===o.HIGHLIGHT?"normal":n;this._blendEffect.draw(s,this._fbos.blend.colorTexture,T.NEAREST,l,r)}}renderLayers(e){if(e.bindFramebuffer(this._prevFBO),!this._fbos)return;const t=this._getOutputFBO();e.setStencilTestEnabled(!1),e.setStencilWriteMask(0),this.blitTexture(e,t.colorTexture,T.NEAREST)}dispose(){if(this.materialManager.dispose(),this.textureManager.dispose(),this._blitRenderer&&(this._blitRenderer.dispose(),this._blitRenderer=null),this._brushCache&&(this._brushCache.forEach((e=>e.dispose())),this._brushCache.clear(),this._brushCache=null),this._fbos)for(const e in this._fbos)this._fbos[e]&&this._fbos[e].dispose();for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects)for(const e in this.effects)this.effects[e]&&this.effects[e].dispose();this._effectsManager.dispose(),this._vtlMaterialManager&&(this._vtlMaterialManager.dispose(),this._vtlMaterialManager=null),this._prevFBO=null}getGeometryBrush(e){const t=S[e];let s=this._brushCache.get(t);return void 0===s&&(s=new t,this._brushCache.set(t,s)),this._brushCache.get(t)}renderObject(e,t,r,i){const n=s[r];if(!n)return null;let o=this._brushCache.get(n);void 0===o&&(o=new n,this._brushCache.set(n,o)),o.prepareState(e,t,i),o.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return null;let o=this._brushCache.get(n);void 0===o&&(o=new n,this._brushCache.set(n,o)),o.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map((e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e))));return new u(t,e)}setHighlightOptions(e){this.effects.highlight.setHighlightOptions(e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}_getOutputFBO(){return null!=this._renderTarget?this._renderTarget:this._fbos.output}_applyEffects(e,t){const{context:s}=e,r=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingEffect:i,effect:n}of r)s.bindFramebuffer(this._fbos.blend),i.draw(e,this._fbos.blend,n)}}function N(t,s,r,i){return t!==o.HIGHLIGHT&&(1!==i||e(s)&&"normal"!==s||e(r)&&r.length>0)}export{P 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{TEXTURE_BINDING_BITMAP as e}from"../definitions.js";import t from"../VertexStream.js";import i from"./WGLBrush.js";import{TextureSamplingMode as s,BlendFactor as n,CompareFunction as a}from"../../../../webgl/enums.js";const r={nearest:{defines:[],samplingMode:s.NEAREST,mips:!1},bilinear:{defines:[],samplingMode:s.LINEAR,mips:!1},bicubic:{defines:["bicubic"],samplingMode:s.LINEAR,mips:!1},trilinear:{defines:[],samplingMode:s.LINEAR_MIPMAP_LINEAR,mips:!0}},o=(e,t,i)=>{if("dynamic"===i.samplingMode){const{state:i}=e,s=t.resolution/t.pixelRatio/i.resolution,n=Math.round(e.pixelRatio)!==e.pixelRatio,a=s>1.05||s<.95;return i.rotation||a||n||t.isSourceScaled||t.rotation?r.bilinear:r.nearest}return r[i.samplingMode]};class d extends i{constructor(){super(...arguments),this._desc={vsPath:"raster/bitmap",fsPath:"raster/bitmap",attributes:new Map([["a_position",0],["a_texcoord",1]])}}dispose(){this._quad&&this._quad.dispose()}prepareState({context:e},t){e.setBlendingEnabled(!0),"additive"===t.blendFunction?e.setBlendFunctionSeparate(n.ONE,n.ONE,n.ONE,n.ONE):e.setBlendFunctionSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(a.EQUAL,t.stencilRef,255)}draw(i,s){const{context:n,renderingOptions:a,painter:r}=i;if(!s.source)return;i.timeline.begin(this.name),this._quad||(this._quad=new t(n,[0,0,1,0,0,1,1,1]));const d=o(i,s,a),m=r.materialManager.getProgram(this._desc,d.defines),{coordScale:c,computedOpacity:l,transforms:p}=s;s.setSamplingProfile(d),s.bind(i.context,e),n.useProgram(m),m.setUniformMatrix3fv("u_dvsMat3",p.dvs),m.setUniform1i("u_texture",e),m.setUniform2fv("u_coordScale",c),m.setUniform1f("u_opacity",l),this._quad.draw(),i.timeline.end(this.name)}}export{d as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{TEXTURE_BINDING_BITMAP as t}from"../definitions.js";import i from"../VertexStream.js";import s from"./WGLBrush.js";import{TextureSamplingMode as n,BlendFactor as r,CompareFunction as o}from"../../../../webgl/enums.js";const a={nearest:{defines:[],samplingMode:n.NEAREST,mips:!1},bilinear:{defines:[],samplingMode:n.LINEAR,mips:!1},bicubic:{defines:["bicubic"],samplingMode:n.LINEAR,mips:!1},trilinear:{defines:[],samplingMode:n.LINEAR_MIPMAP_LINEAR,mips:!0}},d=(e,t,i)=>{if("dynamic"===i.samplingMode){const{state:i}=e,s=t.resolution/t.pixelRatio/i.resolution,n=Math.round(e.pixelRatio)!==e.pixelRatio,r=s>1.05||s<.95;return i.rotation||r||n||t.isSourceScaled||t.rotation?a.bilinear:a.nearest}return a[i.samplingMode]};class m extends s{constructor(){super(...arguments),this._desc={vsPath:"raster/bitmap",fsPath:"raster/bitmap",attributes:new Map([["a_position",0],["a_texcoord",1]])}}dispose(){this._quad&&this._quad.dispose()}prepareState({context:e},t){e.setBlendingEnabled(!0),"additive"===t.blendFunction?e.setBlendFunctionSeparate(r.ONE,r.ONE,r.ONE,r.ONE):e.setBlendFunctionSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(o.EQUAL,t.stencilRef,255)}draw(s,n){const{context:r,renderingOptions:o,painter:a,requestRender:m}=s;if(!n.source)return;const c=d(s,n,o),l=a.materialManager.getProgram(this._desc,c.defines);if(e(m)&&!l.isCompiled)return void m();s.timeline.begin(this.name),this._quad||(this._quad=new i(r,[0,0,1,0,0,1,1,1]));const{coordScale:p,computedOpacity:u,transforms:f}=n;n.setSamplingProfile(c),n.bind(s.context,t),r.useProgram(l),l.setUniformMatrix3fv("u_dvsMat3",f.dvs),l.setUniform1i("u_texture",t),l.setUniform2fv("u_coordScale",p),l.setUniform1f("u_opacity",u),this._quad.draw(),s.timeline.end(this.name)}}export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as r}from"../../../../../core/maybe.js";import{f as t}from"../../../../../chunks/vec4f32.js";import{createProgramDescriptor as e}from"../Utils.js";import s from"./WGLBrush.js";import{background as o}from"../shaders/BackgroundPrograms.js";import{StencilOperation as i,CompareFunction as a,DataType as m,PrimitiveType as n}from"../../../../webgl/enums.js";import{createProgram as p}from"../../../../webgl/ProgramTemplate.js";const c=()=>e("clip",{geometry:[{location:0,name:"a_pos",count:2,type:m.SHORT}]});class l extends s{constructor(){super(...arguments),this._color=t(0,1,0,1)}dispose(){this._program&&this._program.dispose()}prepareState({context:r}){r.setStencilTestEnabled(!0),r.setBlendingEnabled(!1),r.setFaceCullingEnabled(!1),r.setColorMask(!1,!1,!1,!1),r.setStencilOp(i.KEEP,i.KEEP,i.REPLACE),r.setStencilWriteMask(255),r.setStencilFunction(a.ALWAYS,0,255)}draw(t,e){const{context:s,state:i}=t,a=c(),l=e.getVAO(s,i,a.attributes,a.bufferLayouts);r(l.indexBuffer)||(this._program||(this._program=p(s,o)),s.useProgram(this._program),this._program.setUniform2fv("u_coord_range",[1,1]),this._program.setUniform4fv("u_color",this._color),this._program.setUniformMatrix3fv("u_dvsMat3",i.displayMat3),s.bindVAO(l),s.drawElements(n.TRIANGLES,l.indexBuffer.size,m.UNSIGNED_INT,0),s.bindVAO())}}export{l as default};
5
+ import{isNone as r,isSome as t}from"../../../../../core/maybe.js";import{f as e}from"../../../../../chunks/vec4f32.js";import{createProgramDescriptor as s}from"../Utils.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{StencilOperation as a,CompareFunction as m,DataType as n,PrimitiveType as p}from"../../../../webgl/enums.js";import{createProgram as l}from"../../../../webgl/ProgramTemplate.js";const c=()=>s("clip",{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT}]});class f extends o{constructor(){super(...arguments),this._color=e(0,1,0,1)}dispose(){this._program&&this._program.dispose()}prepareState({context:r}){r.setStencilTestEnabled(!0),r.setBlendingEnabled(!1),r.setFaceCullingEnabled(!1),r.setColorMask(!1,!1,!1,!1),r.setStencilOp(a.KEEP,a.KEEP,a.REPLACE),r.setStencilWriteMask(255),r.setStencilFunction(m.ALWAYS,0,255)}draw(e,s){const{context:o,state:a,requestRender:m}=e,f=c(),d=s.getVAO(o,a,f.attributes,f.bufferLayouts);r(d.indexBuffer)||(this._program||(this._program=l(o,i)),!t(m)||this._program.isCompiled?(o.useProgram(this._program),this._program.setUniform2fv("u_coord_range",[1,1]),this._program.setUniform4fv("u_color",this._color),this._program.setUniformMatrix3fv("u_dvsMat3",a.displayMat3),o.bindVAO(d),o.drawElements(p.TRIANGLES,d.indexBuffer.size,n.UNSIGNED_INT,0),o.bindVAO()):m())}}export{f 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{f as t}from"../../../../../chunks/vec4f32.js";import{Pos2b as e}from"../DefaultVertexAttributeLayouts.js";import r from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as o}from"../../../../webgl/BufferObject.js";import{BlendFactor as n,PrimitiveType as a,Usage as l,TextureType as u,PixelFormat as _,PixelType as m,TextureSamplingMode as f,TextureWrapMode as c}from"../../../../webgl/enums.js";import{createProgram as h}from"../../../../webgl/ProgramTemplate.js";import{Texture as g}from"../../../../webgl/Texture.js";import{VertexArrayObject as d}from"../../../../webgl/VertexArrayObject.js";const A=300,b=32;class p extends r{constructor(){super(...arguments),this._color=t(1,0,0,1)}dispose(){this._outlineProgram&&(this._outlineProgram.dispose(),this._outlineProgram=null),this._tileInfoProgram&&(this._tileInfoProgram.dispose(),this._tileInfoProgram=null),this._outlineVertexArrayObject&&(this._outlineVertexArrayObject.dispose(),this._outlineVertexArrayObject=null),this._tileInfoVertexArrayObject&&(this._tileInfoVertexArrayObject.dispose(),this._tileInfoVertexArrayObject=null),this._canvas=null}prepareState({context:t}){t.setBlendingEnabled(!0),t.setBlendFunctionSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!1)}draw(t,e){const{context:r}=t;if(!e.isReady)return;this._loadWGLResources(r),r.bindVAO(this._outlineVertexArrayObject),r.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),this._outlineProgram.setUniform2f("u_coord_range",e.rangeX,e.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),r.drawArrays(a.LINE_STRIP,0,4);const i=this._getTexture(r,e);i?(r.bindVAO(this._tileInfoVertexArrayObject),r.useProgram(this._tileInfoProgram),r.bindTexture(i,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",e.rangeX/e.width,e.rangeY/e.height),this._tileInfoProgram.setUniform2f("u_delta",8,8),this._tileInfoProgram.setUniform2f("u_dimensions",i.descriptor.width,i.descriptor.height),r.drawArrays(a.TRIANGLE_STRIP,0,4),r.bindVAO()):r.bindVAO()}_loadWGLResources(t){if(this._outlineProgram&&this._tileInfoProgram)return;const r=h(t,i),n=h(t,s),a=new Int8Array([0,0,1,0,1,1,0,1]),u=o.createVertex(t,l.STATIC_DRAW,a),_=new d(t,i.attributes,e,{geometry:u}),m=new Int8Array([0,0,1,0,0,1,1,1]),f=o.createVertex(t,l.STATIC_DRAW,m),c=new d(t,s.attributes,e,{geometry:f});this._outlineProgram=r,this._tileInfoProgram=n,this._outlineVertexArrayObject=_,this._tileInfoVertexArrayObject=c}_getTexture(t,e){if(e.texture&&e.triangleCountReportedInDebug===e.triangleCount)return e.texture;e.triangleCountReportedInDebug=e.triangleCount,this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","canvas2d"),this._canvas.setAttribute("width",`${A}`),this._canvas.setAttribute("height",`${b}`),this._canvas.setAttribute("style","display:none"));const r=e.triangleCount;let i=e.key.id;e.triangleCount>0&&(i+=`, ${r}`);const s=this._canvas,o=s.getContext("2d");return o.font="24px sans-serif",o.textAlign="left",o.textBaseline="top",o.clearRect(0,0,A,b),r>1e5?(o.fillStyle="red",o.fillRect(0,0,A,b),o.fillStyle="black"):(o.clearRect(0,0,A,b),o.fillStyle="blue"),o.fillText(i,0,0),e.texture=new g(t,{target:u.TEXTURE_2D,pixelFormat:_.RGBA,dataType:m.UNSIGNED_BYTE,samplingMode:f.NEAREST,wrapMode:c.CLAMP_TO_EDGE},s),e.texture}}export{p as default};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{f as e}from"../../../../../chunks/vec4f32.js";import{Pos2b as r}from"../DefaultVertexAttributeLayouts.js";import i from"./WGLBrush.js";import{background as o}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as u,TextureType as m,PixelFormat as _,PixelType as f,TextureSamplingMode as h,TextureWrapMode as c}from"../../../../webgl/enums.js";import{createProgram as g}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{VertexArrayObject as p}from"../../../../webgl/VertexArrayObject.js";const A=300,b=32;class x extends i{constructor(){super(...arguments),this._color=e(1,0,0,1)}dispose(){this._outlineProgram&&(this._outlineProgram.dispose(),this._outlineProgram=null),this._tileInfoProgram&&(this._tileInfoProgram.dispose(),this._tileInfoProgram=null),this._outlineVertexArrayObject&&(this._outlineVertexArrayObject.dispose(),this._outlineVertexArrayObject=null),this._tileInfoVertexArrayObject&&(this._tileInfoVertexArrayObject.dispose(),this._tileInfoVertexArrayObject=null),this._canvas=null}prepareState({context:t}){t.setBlendingEnabled(!0),t.setBlendFunctionSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!1)}draw(e,r){const{context:i,requestRender:o}=e;if(!r.isReady)return;if(this._loadWGLResources(i),t(o)&&(!this._outlineProgram.isCompiled||!this._tileInfoProgram.isCompiled))return void o();i.bindVAO(this._outlineVertexArrayObject),i.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",r.transforms.dvs),this._outlineProgram.setUniform2f("u_coord_range",r.rangeX,r.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),i.drawArrays(l.LINE_STRIP,0,4);const s=this._getTexture(i,r);s?(i.bindVAO(this._tileInfoVertexArrayObject),i.useProgram(this._tileInfoProgram),i.bindTexture(s,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",r.transforms.dvs),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",r.rangeX/r.width,r.rangeY/r.height),this._tileInfoProgram.setUniform2f("u_delta",8,8),this._tileInfoProgram.setUniform2f("u_dimensions",s.descriptor.width,s.descriptor.height),i.drawArrays(l.TRIANGLE_STRIP,0,4),i.bindVAO()):i.bindVAO()}_loadWGLResources(t){if(this._outlineProgram&&this._tileInfoProgram)return;const e=g(t,o),i=g(t,s),a=new Int8Array([0,0,1,0,1,1,0,1]),l=n.createVertex(t,u.STATIC_DRAW,a),m=new p(t,o.attributes,r,{geometry:l}),_=new Int8Array([0,0,1,0,0,1,1,1]),f=n.createVertex(t,u.STATIC_DRAW,_),h=new p(t,s.attributes,r,{geometry:f});this._outlineProgram=e,this._tileInfoProgram=i,this._outlineVertexArrayObject=m,this._tileInfoVertexArrayObject=h}_getTexture(t,e){if(e.texture&&e.triangleCountReportedInDebug===e.triangleCount)return e.texture;e.triangleCountReportedInDebug=e.triangleCount,this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","canvas2d"),this._canvas.setAttribute("width",`${A}`),this._canvas.setAttribute("height",`${b}`),this._canvas.setAttribute("style","display:none"));const r=e.triangleCount;let i=e.key.id;e.triangleCount>0&&(i+=`, ${r}`);const o=this._canvas,s=o.getContext("2d");return s.font="24px sans-serif",s.textAlign="left",s.textBaseline="top",s.clearRect(0,0,A,b),r>1e5?(s.fillStyle="red",s.fillRect(0,0,A,b),s.fillStyle="black"):(s.clearRect(0,0,A,b),s.fillStyle="blue"),s.fillText(i,0,0),e.texture=new d(t,{target:m.TEXTURE_2D,pixelFormat:_.RGBA,dataType:f.UNSIGNED_BYTE,samplingMode:h.NEAREST,wrapMode:c.CLAMP_TO_EDGE},o),e.texture}}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.24/esri/copyright.txt for details.
4
4
  */
5
- import{f as t}from"../../../../../chunks/vec4f32.js";import{Pos2b as r}from"../DefaultVertexAttributeLayouts.js";import e from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{StencilOperation as o,Face as a,CompareFunction as n,PrimitiveType as l,Usage as d}from"../../../../webgl/enums.js";import{createProgram as m}from"../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as _}from"../../../../webgl/VertexArrayObject.js";class c extends e{constructor(){super(...arguments),this._color=t(1,0,0,1),this._initialized=!1}dispose(){this._solidProgram&&(this._solidProgram.dispose(),this._solidProgram=null),this._solidVertexArrayObject&&(this._solidVertexArrayObject.dispose(),this._solidVertexArrayObject=null)}prepareState({context:t},r){t.setDepthWriteEnabled(!1),t.setDepthTestEnabled(!1),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!1),t.setColorMask(!1,!1,!1,!1),t.setStencilOp(o.KEEP,o.KEEP,o.REPLACE),t.setStencilWriteMask(255),t.setStencilFunctionSeparate(a.FRONT_AND_BACK,n.GREATER,r.stencilRef,255)}draw(t,r){const{context:e}=t;this._initialized||this._initialize(e),e.bindVAO(this._solidVertexArrayObject),e.useProgram(this._solidProgram),this._solidProgram.setUniformMatrix3fv("u_dvsMat3",r.transforms.dvs),this._solidProgram.setUniform2fv("u_coord_range",[r.rangeX,r.rangeY]),this._solidProgram.setUniform1f("u_depth",0),this._solidProgram.setUniform4fv("u_color",this._color),e.drawArrays(l.TRIANGLE_STRIP,0,4),e.bindVAO()}_initialize(t){if(this._initialized)return!0;const e=m(t,i);if(!e)return!1;const o=new Int8Array([0,0,1,0,0,1,1,1]),a=s.createVertex(t,d.STATIC_DRAW,o),n=new _(t,i.attributes,r,{geometry:a});return this._solidProgram=e,this._solidVertexArrayObject=n,this._initialized=!0,!0}}export{c as default};
5
+ import{isSome as r}from"../../../../../core/maybe.js";import{f as t}from"../../../../../chunks/vec4f32.js";import{Pos2b as e}from"../DefaultVertexAttributeLayouts.js";import i from"./WGLBrush.js";import{background as s}from"../shaders/BackgroundPrograms.js";import{BufferObject as o}from"../../../../webgl/BufferObject.js";import{StencilOperation as a,Face as l,CompareFunction as n,PrimitiveType as d,Usage as m}from"../../../../webgl/enums.js";import{createProgram as _}from"../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as c}from"../../../../webgl/VertexArrayObject.js";class h extends i{constructor(){super(...arguments),this._color=t(1,0,0,1),this._initialized=!1}dispose(){this._solidProgram&&(this._solidProgram.dispose(),this._solidProgram=null),this._solidVertexArrayObject&&(this._solidVertexArrayObject.dispose(),this._solidVertexArrayObject=null)}prepareState({context:r},t){r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setBlendingEnabled(!1),r.setColorMask(!1,!1,!1,!1),r.setStencilOp(a.KEEP,a.KEEP,a.REPLACE),r.setStencilWriteMask(255),r.setStencilFunctionSeparate(l.FRONT_AND_BACK,n.GREATER,t.stencilRef,255)}draw(t,e){const{context:i,requestRender:s}=t;this._initialized||this._initialize(i),!r(s)||this._solidProgram.isCompiled?(i.bindVAO(this._solidVertexArrayObject),i.useProgram(this._solidProgram),this._solidProgram.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),this._solidProgram.setUniform2fv("u_coord_range",[e.rangeX,e.rangeY]),this._solidProgram.setUniform1f("u_depth",0),this._solidProgram.setUniform4fv("u_color",this._color),i.drawArrays(d.TRIANGLE_STRIP,0,4),i.bindVAO()):s()}_initialize(r){if(this._initialized)return!0;const t=_(r,s);if(!t)return!1;const i=new Int8Array([0,0,1,0,0,1,1,1]),a=o.createVertex(r,m.STATIC_DRAW,i),l=new c(r,s.attributes,e,{geometry:a});return this._solidProgram=t,this._solidVertexArrayObject=l,this._initialized=!0,!0}}export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{nextPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{isSome as r}from"../../../../../core/maybe.js";import{c as o}from"../../../../../chunks/mat3f32.js";import{f as e}from"../../../../../chunks/vec4f32.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as i,VTL_HIGH_RES_CUTOFF as s}from"../definitions.js";import{WGLDrawPhase as a}from"../enums.js";import{u32to4Xu8 as n}from"../number.js";import c from"./WGLBrush.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{TextureSamplingMode as f,CompareFunction as l,PrimitiveType as u,Usage as p}from"../../../../webgl/enums.js";import{VertexArrayObject as _}from"../../../../webgl/VertexArrayObject.js";class d extends c{constructor(){super(...arguments),this._color=e(1,0,0,1),this._patternMatrix=o(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(o,e){const{context:c,painter:m,styleLayerUID:p}=o;this._loadWGLResources(o);const _=o.displayLevel,d=o.styleLayer,h=d.backgroundMaterial,g=m.vectorTilesMaterialManager,v=d.getPaintValue("background-color",_),b=d.getPaintValue("background-opacity",_),y=d.getPaintValue("background-pattern",_),M=void 0!==y,x=v[3]*b,j=1|window.devicePixelRatio,U=o.spriteMosaic;let L,w;const A=j>s?2:1,P=o.drawPhase===a.HITTEST,I=this._programOptions;I.id=P,I.pattern=M;const k=g.getMaterialProgram(c,h,I);if(c.bindVAO(this._vao),c.useProgram(k),M){const t=U.getMosaicItemPosition(y,!0);if(r(t)){const{tl:o,br:e,page:s}=t;L=e[0]-o[0],w=e[1]-o[1];const a=U.getPageSize(s);r(a)&&(U.bind(c,f.LINEAR,s,i),k.setUniform4f("u_tlbr",o[0],o[1],e[0],e[1]),k.setUniform2fv("u_mosaicSize",a),k.setUniform1i("u_texture",i))}k.setUniform1f("u_opacity",b)}else this._color[0]=x*v[0],this._color[1]=x*v[1],this._color[2]=x*v[2],this._color[3]=x,k.setUniform4fv("u_color",this._color);if(k.setUniform1f("u_depth",d.z||0),P){const t=n(p+1);k.setUniform4fv("u_id",t)}for(const r of e){if(k.setUniform1f("u_coord_range",r.rangeX),k.setUniformMatrix3fv("u_dvsMat3",r.transforms.dvs),M){const o=Math.max(2**(Math.round(_)-r.key.level),1),e=A*r.width*o,i=e/t(L),s=e/t(w);this._patternMatrix[0]=i,this._patternMatrix[4]=s,k.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}c.setStencilFunction(l.EQUAL,r.stencilRef,255),c.drawArrays(u.TRIANGLE_STRIP,0,4)}}_loadWGLResources(t){if(this._vao)return;const{context:r,styleLayer:o}=t,e=o.backgroundMaterial,i=new Int8Array([0,0,1,0,0,1,1,1]),s=m.createVertex(r,p.STATIC_DRAW,i),a=new _(r,e.getAttributeLocations(),e.getLayoutInfo(),{geometry:s});this._vao=a}}export{d as WGLBrushVTLBackground};
5
+ import{nextPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{isSome as r}from"../../../../../core/maybe.js";import{c as e}from"../../../../../chunks/mat3f32.js";import{f as o}from"../../../../../chunks/vec4f32.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as i,VTL_HIGH_RES_CUTOFF as s}from"../definitions.js";import{WGLDrawPhase as a}from"../enums.js";import{u32to4Xu8 as n}from"../number.js";import c from"./WGLBrush.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{TextureSamplingMode as f,CompareFunction as l,PrimitiveType as u,Usage as p}from"../../../../webgl/enums.js";import{VertexArrayObject as _}from"../../../../webgl/VertexArrayObject.js";class d extends c{constructor(){super(...arguments),this._color=o(1,0,0,1),this._patternMatrix=e(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,o){const{context:c,painter:m,styleLayerUID:p,requestRender:_}=e;this._loadWGLResources(e);const d=e.displayLevel,h=e.styleLayer,g=h.backgroundMaterial,v=m.vectorTilesMaterialManager,b=h.getPaintValue("background-color",d),y=h.getPaintValue("background-opacity",d),M=h.getPaintValue("background-pattern",d),x=void 0!==M,j=b[3]*y,U=1|window.devicePixelRatio,L=e.spriteMosaic;let w,A;const P=U>s?2:1,I=e.drawPhase===a.HITTEST,R=this._programOptions;R.id=I,R.pattern=x;const k=v.getMaterialProgram(c,g,R);if(!r(_)||I||k.isCompiled){if(c.bindVAO(this._vao),c.useProgram(k),x){const t=L.getMosaicItemPosition(M,!0);if(r(t)){const{tl:e,br:o,page:s}=t;w=o[0]-e[0],A=o[1]-e[1];const a=L.getPageSize(s);r(a)&&(L.bind(c,f.LINEAR,s,i),k.setUniform4f("u_tlbr",e[0],e[1],o[0],o[1]),k.setUniform2fv("u_mosaicSize",a),k.setUniform1i("u_texture",i))}k.setUniform1f("u_opacity",y)}else this._color[0]=j*b[0],this._color[1]=j*b[1],this._color[2]=j*b[2],this._color[3]=j,k.setUniform4fv("u_color",this._color);if(k.setUniform1f("u_depth",h.z||0),I){const t=n(p+1);k.setUniform4fv("u_id",t)}for(const r of o){if(k.setUniform1f("u_coord_range",r.rangeX),k.setUniformMatrix3fv("u_dvsMat3",r.transforms.dvs),x){const e=Math.max(2**(Math.round(d)-r.key.level),1),o=P*r.width*e,i=o/t(w),s=o/t(A);this._patternMatrix[0]=i,this._patternMatrix[4]=s,k.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}c.setStencilFunction(l.EQUAL,r.stencilRef,255),c.drawArrays(u.TRIANGLE_STRIP,0,4)}}else _()}_loadWGLResources(t){if(this._vao)return;const{context:r,styleLayer:e}=t,o=e.backgroundMaterial,i=new Int8Array([0,0,1,0,0,1,1,1]),s=m.createVertex(r,p.STATIC_DRAW,i),a=new _(r,o.getAttributeLocations(),o.getLayoutInfo(),{geometry:s});this._vao=a}}export{d as WGLBrushVTLBackground};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../core/maybe.js";import{TranslateAnchor as t}from"../../vectorTiles/style/StyleDefinition.js";import{WGLDrawPhase as r}from"../enums.js";import{u32to4Xu8 as i}from"../number.js";import n from"./WGLBrush.js";import{CompareFunction as a,PrimitiveType as s,DataType as o}from"../../../../webgl/enums.js";class l extends n{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(n,l){const{context:c,displayLevel:m,requiredLevel:u,state:f,drawPhase:d,painter:p,spriteMosaic:y,styleLayerUID:v}=n;if(!l.some((e=>{var t,r;return null!=(t=null==(r=e.layerData.get(v))?void 0:r.circleIndexCount)&&t})))return;const g=n.styleLayer,E=g.circleMaterial,M=p.vectorTilesMaterialManager,T=1.2,x=g.getPaintValue("circle-translate",m),I=g.getPaintValue("circle-translate-anchor",m),U=d===r.HITTEST,_=this._programOptions;_.id=U;const h=M.getMaterialProgram(c,E,_);c.useProgram(h),h.setUniformMatrix3fv("u_displayMat3",I===t.VIEWPORT?f.displayMat3:f.displayViewMat3),h.setUniform2fv("u_circleTranslation",x),h.setUniform1f("u_depth",g.z),h.setUniform1f("u_antialiasingWidth",T);let L=-1;if(U){const e=i(v+1);h.setUniform4fv("u_id",e)}for(const t of l){if(!t.layerData.has(v))continue;t.key.level!==L&&(L=t.key.level,E.setDataUniforms(h,m,g,L,y));const r=t.layerData.get(v);if(!r.circleIndexCount)continue;r.prepareForRendering(c);const i=r.circleVertexArrayObject;e(i)||(c.bindVAO(i),h.setUniformMatrix3fv("u_dvsMat3",t.transforms.dvs),u!==t.key.level?c.setStencilFunction(a.EQUAL,t.stencilRef,255):c.setStencilFunction(a.GREATER,255,255),c.drawElements(s.TRIANGLES,r.circleIndexCount,o.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r.circleIndexStart),t.triangleCount+=r.circleIndexCount/3)}}}export{l as WGLBrushVTLCircle};
5
+ import{isSome as e,isNone as t}from"../../../../../core/maybe.js";import{TranslateAnchor as r}from"../../vectorTiles/style/StyleDefinition.js";import{WGLDrawPhase as i}from"../enums.js";import{u32to4Xu8 as n}from"../number.js";import a from"./WGLBrush.js";import{CompareFunction as s,PrimitiveType as o,DataType as l}from"../../../../webgl/enums.js";class c extends a{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(a,c){const{context:m,displayLevel:u,requiredLevel:f,state:d,drawPhase:p,painter:y,spriteMosaic:v,styleLayerUID:g,requestRender:E}=a;if(!c.some((e=>{var t,r;return null!=(t=null==(r=e.layerData.get(g))?void 0:r.circleIndexCount)&&t})))return;const M=a.styleLayer,T=M.circleMaterial,x=y.vectorTilesMaterialManager,I=1.2,U=M.getPaintValue("circle-translate",u),_=M.getPaintValue("circle-translate-anchor",u),h=p===i.HITTEST,L=this._programOptions;L.id=h;const R=x.getMaterialProgram(m,T,L);if(!h&&e(E)&&!R.isCompiled)return void E();m.useProgram(R),R.setUniformMatrix3fv("u_displayMat3",_===r.VIEWPORT?d.displayMat3:d.displayViewMat3),R.setUniform2fv("u_circleTranslation",U),R.setUniform1f("u_depth",M.z),R.setUniform1f("u_antialiasingWidth",I);let S=-1;if(h){const e=n(g+1);R.setUniform4fv("u_id",e)}for(const e of c){if(!e.layerData.has(g))continue;e.key.level!==S&&(S=e.key.level,T.setDataUniforms(R,u,M,S,v));const r=e.layerData.get(g);if(!r.circleIndexCount)continue;r.prepareForRendering(m);const i=r.circleVertexArrayObject;t(i)||(m.bindVAO(i),R.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),f!==e.key.level?m.setStencilFunction(s.EQUAL,e.stencilRef,255):m.setStencilFunction(s.GREATER,255,255),m.drawElements(o.TRIANGLES,r.circleIndexCount,l.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r.circleIndexStart),e.triangleCount+=r.circleIndexCount/3)}}}export{c as WGLBrushVTLCircle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{TranslateAnchor as i}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as a,VTL_HIGH_RES_CUTOFF as n}from"../definitions.js";import{WGLDrawPhase as r}from"../enums.js";import{u32to4Xu8 as o}from"../number.js";import l from"./WGLBrush.js";import{TextureSamplingMode as s,CompareFunction as f,PrimitiveType as u,DataType as c}from"../../../../webgl/enums.js";const d=1/65536;class m extends l{constructor(){super(...arguments),this._fillProgramOptions={id:!1,pattern:!1},this._outlineProgramOptions={id:!1}}dispose(){}drawMany(t,e){const{displayLevel:i,drawPhase:a,renderPass:n,spriteMosaic:l,styleLayerUID:s}=t;let f=!1;for(const r of e)if(r.layerData.has(s)){const t=r.layerData.get(s);if(t.fillIndexCount>0||t.outlineIndexCount>0){f=!0;break}}if(!f)return;const u=t.styleLayer,c=u.getPaintProperty("fill-pattern"),d=void 0!==c,m=d&&c.isDataDriven;let p;if(d&&!m){const t=c.getValue(i);p=l.getMosaicItemPosition(t,!0)}const y=!d&&u.getPaintValue("fill-antialias",i);let g=!0,_=1;if(!d){const t=u.getPaintProperty("fill-color"),e=u.getPaintProperty("fill-opacity");if(!(null!=t&&t.isDataDriven||null!=e&&e.isDataDriven)){const t=u.getPaintValue("fill-color",i);_=u.getPaintValue("fill-opacity",i)*t[3],_>=1&&(g=!1)}}if(g&&"opaque"===n)return;let E;a===r.HITTEST&&(E=o(s+1));const M=u.getPaintValue("fill-translate",i),P=u.getPaintValue("fill-translate-anchor",i);(g||"translucent"!==n)&&this._drawFill(t,s,u,e,M,P,d,p,m,E);const v=!u.hasDataDrivenOutlineColor&&u.outlineUsesFillColor&&_<1;y&&"opaque"!==n&&!v&&this._drawOutline(t,s,u,e,M,P,E)}_drawFill(o,l,m,p,y,g,_,E,M,P){if(_&&!M&&t(E))return;const{context:v,displayLevel:I,state:T,drawPhase:U,painter:x,pixelRatio:h,spriteMosaic:D}=o,S=m.fillMaterial,N=x.vectorTilesMaterialManager,w=h>n?2:1,L=U===r.HITTEST,R=this._fillProgramOptions;R.id=L,R.pattern=_;const A=N.getMaterialProgram(v,S,R);if(v.useProgram(A),e(E)){const{page:t}=E,i=D.getPageSize(t);e(i)&&(D.bind(v,s.LINEAR,t,a),A.setUniform2fv("u_mosaicSize",i),A.setUniform1i("u_texture",a))}A.setUniformMatrix3fv("u_displayMat3",g===i.VIEWPORT?T.displayMat3:T.displayViewMat3),A.setUniform2fv("u_fillTranslation",y),A.setUniform1f("u_depth",m.z+d),L&&A.setUniform4fv("u_id",P);let V=-1;for(const i of p){if(!i.layerData.has(l))continue;i.key.level!==V&&(V=i.key.level,S.setDataUniforms(A,I,m,V,D));const n=i.layerData.get(l);if(!n.fillIndexCount)continue;n.prepareForRendering(v);const r=n.fillVertexArrayObject;if(!t(r)){if(v.bindVAO(r),A.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),v.setStencilFunction(f.EQUAL,i.stencilRef,255),_){const t=Math.max(2**(Math.round(I)-i.key.level),1),e=i.rangeX/(w*i.width*t);A.setUniform1f("u_patternFactor",e)}if(M){const t=n.patternMap;if(!t)continue;for(const[i,n]of t){const t=D.getPageSize(i);e(t)&&(D.bind(v,s.LINEAR,i,a),A.setUniform2fv("u_mosaicSize",t),A.setUniform1i("u_texture",a),v.drawElements(u.TRIANGLES,n[1],c.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*n[0]))}}else v.drawElements(u.TRIANGLES,n.fillIndexCount,c.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*n.fillIndexStart);i.triangleCount+=n.fillIndexCount/3}}}_drawOutline(e,a,n,o,l,s,m){const{context:p,displayLevel:y,state:g,drawPhase:_,painter:E,pixelRatio:M,spriteMosaic:P}=e,v=n.outlineMaterial,I=E.vectorTilesMaterialManager,T=.75/M,U=_===r.HITTEST,x=this._outlineProgramOptions;x.id=U;const h=I.getMaterialProgram(p,v,x);p.useProgram(h),h.setUniformMatrix3fv("u_displayMat3",s===i.VIEWPORT?g.displayMat3:g.displayViewMat3),h.setUniform2fv("u_fillTranslation",l),h.setUniform1f("u_depth",n.z+d),h.setUniform1f("u_outline_width",T),U&&h.setUniform4fv("u_id",m);let D=-1;for(const i of o){if(!i.layerData.has(a))continue;i.key.level!==D&&(D=i.key.level,v.setDataUniforms(h,y,n,D,P));const e=i.layerData.get(a);if(e.prepareForRendering(p),!e.outlineIndexCount)continue;const r=e.outlineVertexArrayObject;t(r)||(p.bindVAO(r),h.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),p.setStencilFunction(f.EQUAL,i.stencilRef,255),p.drawElements(u.TRIANGLES,e.outlineIndexCount,c.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*e.outlineIndexStart),i.triangleCount+=e.outlineIndexCount/3)}}}export{m as WGLBrushVTLFill};
5
+ import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{TranslateAnchor as i}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as n,VTL_HIGH_RES_CUTOFF as r}from"../definitions.js";import{WGLDrawPhase as a}from"../enums.js";import{u32to4Xu8 as o}from"../number.js";import s from"./WGLBrush.js";import{TextureSamplingMode as l,CompareFunction as f,PrimitiveType as u,DataType as d}from"../../../../webgl/enums.js";const c=1/65536;class m extends s{constructor(){super(...arguments),this._fillProgramOptions={id:!1,pattern:!1},this._outlineProgramOptions={id:!1}}dispose(){}drawMany(t,e){const{displayLevel:i,drawPhase:n,renderPass:r,spriteMosaic:s,styleLayerUID:l}=t;let f=!1;for(const a of e)if(a.layerData.has(l)){const t=a.layerData.get(l);if(t.fillIndexCount>0||t.outlineIndexCount>0){f=!0;break}}if(!f)return;const u=t.styleLayer,d=u.getPaintProperty("fill-pattern"),c=void 0!==d,m=c&&d.isDataDriven;let p;if(c&&!m){const t=d.getValue(i);p=s.getMosaicItemPosition(t,!0)}const y=!c&&u.getPaintValue("fill-antialias",i);let g=!0,_=1;if(!c){const t=u.getPaintProperty("fill-color"),e=u.getPaintProperty("fill-opacity");if(!(null!=t&&t.isDataDriven||null!=e&&e.isDataDriven)){const t=u.getPaintValue("fill-color",i);_=u.getPaintValue("fill-opacity",i)*t[3],_>=1&&(g=!1)}}if(g&&"opaque"===r)return;let E;n===a.HITTEST&&(E=o(l+1));const v=u.getPaintValue("fill-translate",i),M=u.getPaintValue("fill-translate-anchor",i);(g||"translucent"!==r)&&this._drawFill(t,l,u,e,v,M,c,p,m,E);const P=!u.hasDataDrivenOutlineColor&&u.outlineUsesFillColor&&_<1;y&&"opaque"!==r&&!P&&this._drawOutline(t,l,u,e,v,M,E)}_drawFill(o,s,m,p,y,g,_,E,v,M){if(_&&!v&&t(E))return;const{context:P,displayLevel:I,state:T,drawPhase:U,painter:x,pixelRatio:h,spriteMosaic:D,requestRender:S}=o,R=m.fillMaterial,N=x.vectorTilesMaterialManager,w=h>r?2:1,L=U===a.HITTEST,A=this._fillProgramOptions;A.id=L,A.pattern=_;const C=N.getMaterialProgram(P,R,A);if(e(S)&&!L&&!C.isCompiled)return void S();if(P.useProgram(C),e(E)){const{page:t}=E,i=D.getPageSize(t);e(i)&&(D.bind(P,l.LINEAR,t,n),C.setUniform2fv("u_mosaicSize",i),C.setUniform1i("u_texture",n))}C.setUniformMatrix3fv("u_displayMat3",g===i.VIEWPORT?T.displayMat3:T.displayViewMat3),C.setUniform2fv("u_fillTranslation",y),C.setUniform1f("u_depth",m.z+c),L&&C.setUniform4fv("u_id",M);let V=-1;for(const i of p){if(!i.layerData.has(s))continue;i.key.level!==V&&(V=i.key.level,R.setDataUniforms(C,I,m,V,D));const r=i.layerData.get(s);if(!r.fillIndexCount)continue;r.prepareForRendering(P);const a=r.fillVertexArrayObject;if(!t(a)){if(P.bindVAO(a),C.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),P.setStencilFunction(f.EQUAL,i.stencilRef,255),_){const t=Math.max(2**(Math.round(I)-i.key.level),1),e=i.rangeX/(w*i.width*t);C.setUniform1f("u_patternFactor",e)}if(v){const t=r.patternMap;if(!t)continue;for(const[i,r]of t){const t=D.getPageSize(i);e(t)&&(D.bind(P,l.LINEAR,i,n),C.setUniform2fv("u_mosaicSize",t),C.setUniform1i("u_texture",n),P.drawElements(u.TRIANGLES,r[1],d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r[0]))}}else P.drawElements(u.TRIANGLES,r.fillIndexCount,d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r.fillIndexStart);i.triangleCount+=r.fillIndexCount/3}}}_drawOutline(n,r,o,s,l,m,p){const{context:y,displayLevel:g,state:_,drawPhase:E,painter:v,pixelRatio:M,spriteMosaic:P,requestRender:I}=n,T=o.outlineMaterial,U=v.vectorTilesMaterialManager,x=.75/M,h=E===a.HITTEST,D=this._outlineProgramOptions;D.id=h;const S=U.getMaterialProgram(y,T,D);if(e(I)&&!h&&!S.isCompiled)return void I();y.useProgram(S),S.setUniformMatrix3fv("u_displayMat3",m===i.VIEWPORT?_.displayMat3:_.displayViewMat3),S.setUniform2fv("u_fillTranslation",l),S.setUniform1f("u_depth",o.z+c),S.setUniform1f("u_outline_width",x),h&&S.setUniform4fv("u_id",p);let R=-1;for(const e of s){if(!e.layerData.has(r))continue;e.key.level!==R&&(R=e.key.level,T.setDataUniforms(S,g,o,R,P));const i=e.layerData.get(r);if(i.prepareForRendering(y),!i.outlineIndexCount)continue;const n=i.outlineVertexArrayObject;t(n)||(y.bindVAO(n),S.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),y.setStencilFunction(f.EQUAL,e.stencilRef,255),y.drawElements(u.TRIANGLES,i.outlineIndexCount,d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i.outlineIndexStart),e.triangleCount+=i.outlineIndexCount/3)}}}export{m as WGLBrushVTLFill};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e,isNone as t}from"../../../../../core/maybe.js";import{TranslateAnchor as i}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as n}from"../definitions.js";import{WGLDrawPhase as a}from"../enums.js";import{u32to4Xu8 as r}from"../number.js";import o from"./WGLBrush.js";import{TextureSamplingMode as s,CompareFunction as l,PrimitiveType as f,DataType as m}from"../../../../webgl/enums.js";class u extends o{constructor(){super(...arguments),this._programOptions={id:!1,pattern:!1,sdf:!1}}dispose(){}drawMany(o,u){const{context:c,displayLevel:p,state:d,drawPhase:g,painter:y,pixelRatio:E,spriteMosaic:v,styleLayerUID:M}=o;if(!u.some((e=>{var t,i;return null!=(t=null==(i=e.layerData.get(M))?void 0:i.lineIndexCount)&&t})))return;const _=o.styleLayer,U=_.lineMaterial,I=y.vectorTilesMaterialManager,P=_.getPaintValue("line-translate",p),x=_.getPaintValue("line-translate-anchor",p),T=_.getPaintProperty("line-pattern"),S=void 0!==T,D=S&&T.isDataDriven;let L,N;if(S&&!D){const e=T.getValue(p);L=v.getMosaicItemPosition(e)}let V=!1;if(!S){const e=_.getPaintProperty("line-dasharray");if(N=void 0!==e,V=N&&e.isDataDriven,N&&!V){const t=e.getValue(p),i=_.getDashKey(t,_.getLayoutValue("line-cap",p));L=v.getMosaicItemPosition(i)}}const R=1/E,h=g===a.HITTEST,A=this._programOptions;A.id=h,A.pattern=S,A.sdf=N;const j=I.getMaterialProgram(c,U,A);if(c.useProgram(j),j.setUniformMatrix3fv("u_displayViewMat3",d.displayViewMat3),j.setUniformMatrix3fv("u_displayMat3",x===i.VIEWPORT?d.displayMat3:d.displayViewMat3),j.setUniform2fv("u_lineTranslation",P),j.setUniform1f("u_depth",_.z),j.setUniform1f("u_antialiasing",R),h){const e=r(M+1);j.setUniform4fv("u_id",e)}if(L&&e(L)){const{page:t}=L,i=v.getPageSize(t);e(i)&&(v.bind(c,s.LINEAR,t,n),j.setUniform2fv("u_mosaicSize",i),j.setUniform1i("u_texture",n))}let w=-1;for(const i of u){if(!i.layerData.has(M))continue;i.key.level!==w&&(w=i.key.level,U.setDataUniforms(j,p,_,w,v));const a=2**(p-w)/E;j.setUniform1f("u_zoomFactor",a);const r=i.layerData.get(M);if(!r.lineIndexCount)continue;r.prepareForRendering(c);const o=r.lineVertexArrayObject;if(!t(o)){if(c.bindVAO(o),j.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),c.setStencilFunction(l.EQUAL,i.stencilRef,255),D||V){const t=r.patternMap;if(!t)continue;for(const[i,a]of t){const t=v.getPageSize(i);e(t)&&(v.bind(c,s.LINEAR,i,n),j.setUniform2fv("u_mosaicSize",t),j.setUniform1i("u_texture",n),c.drawElements(f.TRIANGLES,a[1],m.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*a[0]))}}else c.drawElements(f.TRIANGLES,r.lineIndexCount,m.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r.lineIndexStart);i.triangleCount+=r.lineIndexCount/3}}}}export{u as WGLBrushVTLLine};
5
+ import{isSome as e,isNone as t}from"../../../../../core/maybe.js";import{TranslateAnchor as i}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as n}from"../definitions.js";import{WGLDrawPhase as r}from"../enums.js";import{u32to4Xu8 as a}from"../number.js";import o from"./WGLBrush.js";import{TextureSamplingMode as s,CompareFunction as l,PrimitiveType as f,DataType as m}from"../../../../webgl/enums.js";class u extends o{constructor(){super(...arguments),this._programOptions={id:!1,pattern:!1,sdf:!1}}dispose(){}drawMany(o,u){const{context:c,displayLevel:d,state:p,drawPhase:g,painter:y,pixelRatio:v,spriteMosaic:E,styleLayerUID:M,requestRender:_}=o;if(!u.some((e=>{var t,i;return null!=(t=null==(i=e.layerData.get(M))?void 0:i.lineIndexCount)&&t})))return;const U=o.styleLayer,I=U.lineMaterial,P=y.vectorTilesMaterialManager,x=U.getPaintValue("line-translate",d),T=U.getPaintValue("line-translate-anchor",d),S=U.getPaintProperty("line-pattern"),D=void 0!==S,L=D&&S.isDataDriven;let N,R;if(D&&!L){const e=S.getValue(d);N=E.getMosaicItemPosition(e)}let V=!1;if(!D){const e=U.getPaintProperty("line-dasharray");if(R=void 0!==e,V=R&&e.isDataDriven,R&&!V){const t=e.getValue(d),i=U.getDashKey(t,U.getLayoutValue("line-cap",d));N=E.getMosaicItemPosition(i)}}const h=1/v,A=g===r.HITTEST,j=this._programOptions;j.id=A,j.pattern=D,j.sdf=R;const w=P.getMaterialProgram(c,I,j);if(e(_)&&!A&&!w.isCompiled)return void _();if(c.useProgram(w),w.setUniformMatrix3fv("u_displayViewMat3",p.displayViewMat3),w.setUniformMatrix3fv("u_displayMat3",T===i.VIEWPORT?p.displayMat3:p.displayViewMat3),w.setUniform2fv("u_lineTranslation",x),w.setUniform1f("u_depth",U.z),w.setUniform1f("u_antialiasing",h),A){const e=a(M+1);w.setUniform4fv("u_id",e)}if(N&&e(N)){const{page:t}=N,i=E.getPageSize(t);e(i)&&(E.bind(c,s.LINEAR,t,n),w.setUniform2fv("u_mosaicSize",i),w.setUniform1i("u_texture",n))}let b=-1;for(const i of u){if(!i.layerData.has(M))continue;i.key.level!==b&&(b=i.key.level,I.setDataUniforms(w,d,U,b,E));const r=2**(d-b)/v;w.setUniform1f("u_zoomFactor",r);const a=i.layerData.get(M);if(!a.lineIndexCount)continue;a.prepareForRendering(c);const o=a.lineVertexArrayObject;if(!t(o)){if(c.bindVAO(o),w.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),c.setStencilFunction(l.EQUAL,i.stencilRef,255),L||V){const t=a.patternMap;if(!t)continue;for(const[i,r]of t){const t=E.getPageSize(i);e(t)&&(E.bind(c,s.LINEAR,i,n),w.setUniform2fv("u_mosaicSize",t),w.setUniform1i("u_texture",n),c.drawElements(f.TRIANGLES,r[1],m.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*r[0]))}}else c.drawElements(f.TRIANGLES,a.lineIndexCount,m.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*a.lineIndexStart);i.triangleCount+=a.lineIndexCount/3}}}}export{u as WGLBrushVTLLine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../core/maybe.js";import{c as t,f as a}from"../../../../../chunks/vec2f32.js";import{FADE_DURATION as i}from"../../vectorTiles/decluttering/config.js";import{RotationAlignment as r,SymbolPlacement as s,TranslateAnchor as n}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as o,VTL_TEXTURE_BINDING_UNIT_GLYPHS as l}from"../definitions.js";import{WGLDrawPhase as f}from"../enums.js";import{degToByte as c}from"../GeometryUtils.js";import{u32to4Xu8 as m}from"../number.js";import p from"./WGLBrush.js";import{TextureSamplingMode as u,CompareFunction as g,PrimitiveType as y,DataType as d}from"../../../../webgl/enums.js";const _=1/65536;class h extends p{constructor(){super(...arguments),this._iconProgramOptions={id:!1,sdf:!1},this._sdfProgramOptions={id:!1},this._spritesTextureSize=t()}dispose(){}drawMany(e,t){const{drawPhase:a,styleLayerUID:i}=e,r=e.styleLayer;let s;a===f.HITTEST&&(s=m(i+1)),this._drawIcons(e,r,t,s),this._drawText(e,r,t,s)}_drawIcons(t,a,l,m){const{context:p,displayLevel:u,drawPhase:g,painter:y,spriteMosaic:d,state:_,styleLayerUID:h}=t,M=a.iconMaterial,P=y.vectorTilesMaterialManager;let T,U=!1;for(const e of l)if(e.layerData.has(h)&&(T=e.layerData.get(h),T.iconPerPageElementsMap.size>0)){U=!0;break}if(!U)return;const E=a.getPaintValue("icon-translate",u),x=a.getPaintValue("icon-translate-anchor",u);let v=a.getLayoutValue("icon-rotation-alignment",u);v===r.AUTO&&(v=a.getLayoutValue("symbol-placement",u)===s.POINT?r.VIEWPORT:r.MAP);const I=v===r.MAP,S=a.getLayoutValue("icon-keep-upright",u)&&I,D=T.isIconSDF,V=g===f.HITTEST,R=this._iconProgramOptions;R.id=V,R.sdf=D;const w=P.getMaterialProgram(p,M,R);p.useProgram(w),w.setUniformMatrix3fv("u_displayViewMat3",v===r.MAP?_.displayViewMat3:_.displayMat3),w.setUniformMatrix3fv("u_displayMat3",x===n.VIEWPORT?_.displayMat3:_.displayViewMat3),w.setUniform2fv("u_iconTranslation",E),w.setUniform1f("u_depth",a.z),w.setUniform1f("u_mapRotation",c(_.rotation)),w.setUniform1f("u_keepUpright",S?1:0),w.setUniform1f("u_level",10*u),w.setUniform1i("u_texture",o),w.setUniform1f("u_fadeDuration",i/1e3),V&&w.setUniform4fv("u_id",m);let A=-1;for(const i of l){if(!i.layerData.has(h))continue;if(i.key.level!==A&&(A=i.key.level,M.setDataUniforms(w,u,a,A,d)),T=i.layerData.get(h),0===T.iconPerPageElementsMap.size)continue;T.prepareForRendering(p),T.updateOpacityInfo();const r=T.iconVertexArrayObject;if(!e(r)){p.bindVAO(r),w.setUniformMatrix3fv("u_dvsMat3",i.transforms.dvs),w.setUniform1f("u_time",(performance.now()-T.lastOpacityUpdate)/1e3);for(const[e,a]of T.iconPerPageElementsMap)this._renderIconRange(t,w,a,e,i)}}}_renderIconRange(e,t,a,i,r){const{context:s,spriteMosaic:n}=e;this._spritesTextureSize[0]=n.getWidth(i)/4,this._spritesTextureSize[1]=n.getHeight(i)/4,t.setUniform2fv("u_mosaicSize",this._spritesTextureSize),n.bind(s,u.LINEAR,i,o),s.setStencilTestEnabled(!0),s.setStencilFunction(g.GREATER,255,255),s.setStencilWriteMask(0),s.drawElements(y.TRIANGLES,a[1],d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*a[0]),r.triangleCount+=a[1]/3}_drawText(t,o,m,p){const{context:u,displayLevel:y,drawPhase:d,glyphMosaic:h,painter:M,pixelRatio:P,spriteMosaic:T,state:U,styleLayerUID:E}=t,x=o.textMaterial,v=M.vectorTilesMaterialManager;let I,S=!1;for(const e of m)if(e.layerData.has(E)&&(I=e.layerData.get(E),I.glyphPerPageElementsMap.size>0)){S=!0;break}if(!S)return;const D=o.getPaintProperty("text-opacity");if(D&&!D.isDataDriven&&0===D.getValue(y))return;const V=o.getPaintProperty("text-color"),R=!V||V.isDataDriven||V.getValue(y)[3]>0,w=o.getPaintProperty("text-halo-width"),A=o.getPaintProperty("text-halo-color"),L=(!w||w.isDataDriven||w.getValue(y)>0)&&(!A||A.isDataDriven||A.getValue(y)[3]>0);if(!R&&!L)return;const O=24/8;let N=o.getLayoutValue("text-rotation-alignment",y);N===r.AUTO&&(N=o.getLayoutValue("symbol-placement",y)===s.POINT?r.VIEWPORT:r.MAP);const b=N===r.MAP,z=o.getLayoutValue("text-keep-upright",y)&&b,k=d===f.HITTEST,j=.8*O/P;this._glyphTextureSize||(this._glyphTextureSize=a(h.width/4,h.height/4));const G=o.getPaintValue("text-translate",y),W=o.getPaintValue("text-translate-anchor",y),F=this._sdfProgramOptions;F.id=k;const B=v.getMaterialProgram(u,x,F);u.useProgram(B),B.setUniformMatrix3fv("u_displayViewMat3",N===r.MAP?U.displayViewMat3:U.displayMat3),B.setUniformMatrix3fv("u_displayMat3",W===n.VIEWPORT?U.displayMat3:U.displayViewMat3),B.setUniform2fv("u_textTranslation",G),B.setUniform1f("u_depth",o.z+_),B.setUniform2fv("u_mosaicSize",this._glyphTextureSize),B.setUniform1f("u_mapRotation",c(U.rotation)),B.setUniform1f("u_keepUpright",z?1:0),B.setUniform1f("u_level",10*y),B.setUniform1i("u_texture",l),B.setUniform1f("u_antialiasingWidth",j),B.setUniform1f("u_fadeDuration",i/1e3),k&&B.setUniform4fv("u_id",p);let H=-1;for(const a of m){if(!a.layerData.has(E))continue;if(a.key.level!==H&&(H=a.key.level,x.setDataUniforms(B,y,o,H,T)),I=a.layerData.get(E),0===I.glyphPerPageElementsMap.size)continue;I.prepareForRendering(u),I.updateOpacityInfo();const t=I.textVertexArrayObject;if(e(t))continue;u.bindVAO(t),B.setUniformMatrix3fv("u_dvsMat3",a.transforms.dvs),u.setStencilTestEnabled(!0),u.setStencilFunction(g.GREATER,255,255),u.setStencilWriteMask(0);const i=(performance.now()-I.lastOpacityUpdate)/1e3;B.setUniform1f("u_time",i),I.glyphPerPageElementsMap.forEach(((e,t)=>{this._renderGlyphRange(u,e,t,h,B,L,R,a)}))}}_renderGlyphRange(e,t,a,i,r,s,n,o){i.bind(e,u.LINEAR,a,l),s&&(r.setUniform1f("u_halo",1),e.drawElements(y.TRIANGLES,t[1],d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),o.triangleCount+=t[1]/3),n&&(r.setUniform1f("u_halo",0),e.drawElements(y.TRIANGLES,t[1],d.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),o.triangleCount+=t[1]/3)}}export{h as WGLBrushVTLSymbol};
5
+ import{isSome as e,isNone as t}from"../../../../../core/maybe.js";import{c as i,f as a}from"../../../../../chunks/vec2f32.js";import{FADE_DURATION as r}from"../../vectorTiles/decluttering/config.js";import{RotationAlignment as s,SymbolPlacement as n,TranslateAnchor as o}from"../../vectorTiles/style/StyleDefinition.js";import{VTL_TEXTURE_BINDING_UNIT_SPRITES as l,VTL_TEXTURE_BINDING_UNIT_GLYPHS as f}from"../definitions.js";import{WGLDrawPhase as u}from"../enums.js";import{degToByte as m}from"../GeometryUtils.js";import{u32to4Xu8 as p}from"../number.js";import c from"./WGLBrush.js";import{TextureSamplingMode as d,CompareFunction as g,PrimitiveType as y,DataType as _}from"../../../../webgl/enums.js";const h=1/65536;class M extends c{constructor(){super(...arguments),this._iconProgramOptions={id:!1,sdf:!1},this._sdfProgramOptions={id:!1},this._spritesTextureSize=i()}dispose(){}drawMany(e,t){const{drawPhase:i,styleLayerUID:a}=e,r=e.styleLayer;let s;i===u.HITTEST&&(s=p(a+1)),this._drawIcons(e,r,t,s),this._drawText(e,r,t,s)}_drawIcons(i,a,f,p){const{context:c,displayLevel:d,drawPhase:g,painter:y,spriteMosaic:_,state:h,styleLayerUID:M,requestRender:P}=i,T=a.iconMaterial,U=y.vectorTilesMaterialManager;let E,x=!1;for(const e of f)if(e.layerData.has(M)&&(E=e.layerData.get(M),E.iconPerPageElementsMap.size>0)){x=!0;break}if(!x)return;const v=a.getPaintValue("icon-translate",d),I=a.getPaintValue("icon-translate-anchor",d);let S=a.getLayoutValue("icon-rotation-alignment",d);S===s.AUTO&&(S=a.getLayoutValue("symbol-placement",d)===n.POINT?s.VIEWPORT:s.MAP);const D=S===s.MAP,V=a.getLayoutValue("icon-keep-upright",d)&&D,R=E.isIconSDF,w=g===u.HITTEST,A=this._iconProgramOptions;A.id=w,A.sdf=R;const L=U.getMaterialProgram(c,T,A);if(e(P)&&!w&&!L.isCompiled)return void P();c.useProgram(L),L.setUniformMatrix3fv("u_displayViewMat3",S===s.MAP?h.displayViewMat3:h.displayMat3),L.setUniformMatrix3fv("u_displayMat3",I===o.VIEWPORT?h.displayMat3:h.displayViewMat3),L.setUniform2fv("u_iconTranslation",v),L.setUniform1f("u_depth",a.z),L.setUniform1f("u_mapRotation",m(h.rotation)),L.setUniform1f("u_keepUpright",V?1:0),L.setUniform1f("u_level",10*d),L.setUniform1i("u_texture",l),L.setUniform1f("u_fadeDuration",r/1e3),w&&L.setUniform4fv("u_id",p);let O=-1;for(const e of f){if(!e.layerData.has(M))continue;if(e.key.level!==O&&(O=e.key.level,T.setDataUniforms(L,d,a,O,_)),E=e.layerData.get(M),0===E.iconPerPageElementsMap.size)continue;E.prepareForRendering(c),E.updateOpacityInfo();const r=E.iconVertexArrayObject;if(!t(r)){c.bindVAO(r),L.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),L.setUniform1f("u_time",(performance.now()-E.lastOpacityUpdate)/1e3);for(const[t,a]of E.iconPerPageElementsMap)this._renderIconRange(i,L,a,t,e)}}}_renderIconRange(e,t,i,a,r){const{context:s,spriteMosaic:n}=e;this._spritesTextureSize[0]=n.getWidth(a)/4,this._spritesTextureSize[1]=n.getHeight(a)/4,t.setUniform2fv("u_mosaicSize",this._spritesTextureSize),n.bind(s,d.LINEAR,a,l),s.setStencilTestEnabled(!0),s.setStencilFunction(g.GREATER,255,255),s.setStencilWriteMask(0),s.drawElements(y.TRIANGLES,i[1],_.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]),r.triangleCount+=i[1]/3}_drawText(i,l,p,c){const{context:d,displayLevel:y,drawPhase:_,glyphMosaic:M,painter:P,pixelRatio:T,spriteMosaic:U,state:E,styleLayerUID:x,requestRender:v}=i,I=l.textMaterial,S=P.vectorTilesMaterialManager;let D,V=!1;for(const e of p)if(e.layerData.has(x)&&(D=e.layerData.get(x),D.glyphPerPageElementsMap.size>0)){V=!0;break}if(!V)return;const R=l.getPaintProperty("text-opacity");if(R&&!R.isDataDriven&&0===R.getValue(y))return;const w=l.getPaintProperty("text-color"),A=!w||w.isDataDriven||w.getValue(y)[3]>0,L=l.getPaintProperty("text-halo-width"),O=l.getPaintProperty("text-halo-color"),N=(!L||L.isDataDriven||L.getValue(y)>0)&&(!O||O.isDataDriven||O.getValue(y)[3]>0);if(!A&&!N)return;const b=24/8;let z=l.getLayoutValue("text-rotation-alignment",y);z===s.AUTO&&(z=l.getLayoutValue("symbol-placement",y)===n.POINT?s.VIEWPORT:s.MAP);const k=z===s.MAP,j=l.getLayoutValue("text-keep-upright",y)&&k,G=_===u.HITTEST,W=.8*b/T;this._glyphTextureSize||(this._glyphTextureSize=a(M.width/4,M.height/4));const C=l.getPaintValue("text-translate",y),F=l.getPaintValue("text-translate-anchor",y),B=this._sdfProgramOptions;B.id=G;const H=S.getMaterialProgram(d,I,B);if(e(v)&&!G&&!H.isCompiled)return void v();d.useProgram(H),H.setUniformMatrix3fv("u_displayViewMat3",z===s.MAP?E.displayViewMat3:E.displayMat3),H.setUniformMatrix3fv("u_displayMat3",F===o.VIEWPORT?E.displayMat3:E.displayViewMat3),H.setUniform2fv("u_textTranslation",C),H.setUniform1f("u_depth",l.z+h),H.setUniform2fv("u_mosaicSize",this._glyphTextureSize),H.setUniform1f("u_mapRotation",m(E.rotation)),H.setUniform1f("u_keepUpright",j?1:0),H.setUniform1f("u_level",10*y),H.setUniform1i("u_texture",f),H.setUniform1f("u_antialiasingWidth",W),H.setUniform1f("u_fadeDuration",r/1e3),G&&H.setUniform4fv("u_id",c);let Y=-1;for(const e of p){if(!e.layerData.has(x))continue;if(e.key.level!==Y&&(Y=e.key.level,I.setDataUniforms(H,y,l,Y,U)),D=e.layerData.get(x),0===D.glyphPerPageElementsMap.size)continue;D.prepareForRendering(d),D.updateOpacityInfo();const i=D.textVertexArrayObject;if(t(i))continue;d.bindVAO(i),H.setUniformMatrix3fv("u_dvsMat3",e.transforms.dvs),d.setStencilTestEnabled(!0),d.setStencilFunction(g.GREATER,255,255),d.setStencilWriteMask(0);const a=(performance.now()-D.lastOpacityUpdate)/1e3;H.setUniform1f("u_time",a),D.glyphPerPageElementsMap.forEach(((t,i)=>{this._renderGlyphRange(d,t,i,M,H,N,A,e)}))}}_renderGlyphRange(e,t,i,a,r,s,n,o){a.bind(e,d.LINEAR,i,f),s&&(r.setUniform1f("u_halo",1),e.drawElements(y.TRIANGLES,t[1],_.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),o.triangleCount+=t[1]/3),n&&(r.setUniform1f("u_halo",0),e.drawElements(y.TRIANGLES,t[1],_.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),o.triangleCount+=t[1]/3)}}export{M as WGLBrushVTLSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as t,isSome as e,isNone as o}from"../../../../../core/maybe.js";import r from"../../../../../core/RandomLCG.js";import{TEXTURE_BINDING_RENDERER_0 as i,TEXTURE_BINDING_RENDERER_1 as s,TILE_SIZE as n}from"../definitions.js";import{WGLGeometryType as a}from"../enums.js";import{createProgramDescriptor as d}from"../Utils.js";import l from"./WGLGeometryBrush.js";import{FillMaterialKey as m}from"../materialKey/MaterialKey.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PrimitiveType as u,DataType as c,TextureType as f,PixelFormat as h,PixelType as T,TextureSamplingMode as p,TextureWrapMode as y,TargetType as x,DepthStencilTargetType as D,RenderbufferFormat as g,Usage as E}from"../../../../webgl/enums.js";import{FramebufferObject as S}from"../../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../../webgl/Renderbuffer.js";import{Texture as U}from"../../../../webgl/Texture.js";import{VertexArrayObject as O}from"../../../../webgl/VertexArrayObject.js";const b=t=>{const e={geometry:[{location:0,name:"a_pos",count:2,type:c.SHORT},{location:1,name:"a_id",count:3,type:c.UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:c.UNSIGNED_BYTE}]};return t.dotDensity?(e.geometry.push({location:3,name:"a_inverseArea",count:1,type:c.FLOAT}),d(t.data,e)):(e.geometry.push({location:3,name:"a_color",count:4,type:c.UNSIGNED_BYTE,normalized:!0}),t.simple||e.geometry.push({location:4,name:"a_aux1",count:4,type:c.UNSIGNED_SHORT}),e.geometry.push({location:5,name:"a_aux2",count:4,type:c.UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:c.UNSIGNED_BYTE}),t.simple||e.geometry.push({location:7,name:"a_zoomRange",count:2,type:c.UNSIGNED_SHORT}),d(t.data,e))};class N extends l{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([i,s]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=t(this._dotFBO),this._dotVAO=t(this._dotVAO)}getGeometryType(){return a.FILL}drawGeometry(t,o,r,i){const{context:s,painter:n,rendererInfo:a,requiredLevel:d,passOptions:l}=t,_=m.load(r.materialKey),f=n.materialManager;let h=u.TRIANGLES,T=b(_);e(l)&&"hittest"===l.type&&(T=this._getTriangleDesc(r.materialKey,T),h=u.POINTS);const{attributes:p,bufferLayouts:y}=T,x=f.getMaterialProgram(t,_,"materials/fill",p,i);if(s.useProgram(x),this._setSharedUniforms(x,t,o),x.setUniform2f("u_tileOffset",512*o.key.col,512*o.key.row),_.textureBinding){n.textureManager.bindTextures(s,x,_);const t=1/2**(d-o.key.level);x.setUniform1f("u_zoomFactor",t)}const D=1/t.pixelRatio;x.setUniform1f("u_blur",D),x.setUniform1f("u_antialiasing",D),this._setSizeVVUniforms(_,x,a,o),this._setColorAndOpacityVVUniforms(_,x,a);const g=e(l)&&"hittest"===l.type,E=r.target.getVAO(s,y,p,g);let S=r.indexCount,w=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(g&&(S/=3,w/=3),s.bindVAO(E),!_.dotDensity||g)s.drawElements(h,S,c.UNSIGNED_INT,w);else{const e=this._drawDotLocations(t,o,x,S,w);this._drawDotDensity(t,o,e)}}_drawDotDensity(t,e,o){const{context:r,painter:i,rendererInfo:s}=t,n=i.materialManager.getProgram(this._dotDesc),a=this._createDotDensityMesh(r,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:c.SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});r.setStencilTestEnabled(!0),r.useProgram(n),n.setUniform1f("u_tileZoomFactor",1),n.setUniform1i("u_texture",this._dotSamplers[0]),n.setUniform1f("u_dotSize",Math.max(s.ddDotSize,1)),n.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(n,t,e),r.bindTexture(o,this._dotSamplers[0]),r.bindVAO(a),r.drawArrays(u.POINTS,0,262144)}_drawDotLocations(t,e,o,r,i){const{context:s,rendererInfo:a,requiredLevel:d}=t,l=s.getViewport();s.setViewport(0,0,512,512);const m=s.getBoundFramebufferObject(),_=this._createFBO(s);s.bindFramebuffer(_),s.setClearColor(0,0,0,0),s.clear(s.gl.COLOR_BUFFER_BIT|s.gl.STENCIL_BUFFER_BIT),s.setStencilTestEnabled(!1);const f=1/2**(d-e.key.level),h=n,T=h*window.devicePixelRatio*h*window.devicePixelRatio,p=1/f*(1/f),y=a.ddDotScale?t.state.scale/a.ddDotScale:1;return o.setUniform1f("u_tileZoomFactor",f),o.setUniform1f("u_tileDotsOverArea",T/(n*window.devicePixelRatio*n*window.devicePixelRatio)),o.setUniformMatrix4fv("u_dotColors",a.ddColors),o.setUniform4fv("u_isActive",a.ddActiveDots),o.setUniform4fv("u_dotBackgroundColor",a.ddBackgroundColor),o.setUniform1f("u_dotValue",Math.max(1,a.ddDotValue*y*p)),this._bindDotDensityTextures(s,o,a,h),s.drawElements(u.TRIANGLES,r,c.UNSIGNED_INT,i),s.setViewport(l.x,l.y,l.width,l.height),s.bindFramebuffer(m),_.colorTexture}_createFBO(t){if(o(this._dotFBO)){const e=512,o=512,r={target:f.TEXTURE_2D,pixelFormat:h.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:y.CLAMP_TO_EDGE,width:e,height:o},i={colorTarget:x.TEXTURE,depthStencilTarget:D.DEPTH_STENCIL_RENDER_BUFFER},s=new w(t,{width:e,height:o,internalFormat:g.DEPTH_STENCIL});this._dotFBO=new S(t,i,r,s)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_bindDotDensityTextures(t,e,o,r){const i=this._createDotDensityTextures(t,r,o.ddSeed);e.setUniform1iv("u_dotTextures",this._dotSamplers);for(let s=0;s<i.length;s++)t.bindTexture(i[s],this._dotSamplers[s])}_createDotDensityMesh(t,e,r){if(o(this._dotVAO)){const o=2,i=new Int16Array(262144*o);for(let t=0;t<512;t++)for(let e=0;e<512;e++)i[o*(e+512*t)]=e,i[o*(e+512*t)+1]=t;const s=_.createVertex(t,E.STATIC_DRAW,i);this._dotVAO=new O(t,e,r,{geometry:s},null)}return this._dotVAO}_createDotDensityTextures(t,e,o){if(this._dotTextureSize===e&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=e,this._seed=o),null===this._dotTextures){const i=new r(o);this._dotTextures=[this._allocDotDensityTexture(t,e,i),this._allocDotDensityTexture(t,e,i)]}return this._dotTextures}_allocDotDensityTexture(t,e,o){const r=new Float32Array(e*e*4);for(let i=0;i<r.length;i++)r[i]=o.getFloat();return new U(t,{wrapMode:y.REPEAT,pixelFormat:h.RGBA,dataType:T.FLOAT,samplingMode:p.NEAREST,width:e,height:e},r)}}export{N as default};
5
+ import{disposeMaybe as e,isSome as t,isNone as o}from"../../../../../core/maybe.js";import r from"../../../../../core/RandomLCG.js";import{TEXTURE_BINDING_RENDERER_0 as i,TEXTURE_BINDING_RENDERER_1 as s,TILE_SIZE as n}from"../definitions.js";import{WGLGeometryType as a}from"../enums.js";import{createProgramDescriptor as d}from"../Utils.js";import l from"./WGLGeometryBrush.js";import{FillMaterialKey as m}from"../materialKey/MaterialKey.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{PrimitiveType as _,DataType as c,TextureType as f,PixelFormat as h,PixelType as T,TextureSamplingMode as p,TextureWrapMode as y,TargetType as x,DepthStencilTargetType as D,RenderbufferFormat as g,Usage as E}from"../../../../webgl/enums.js";import{FramebufferObject as S}from"../../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../../webgl/Renderbuffer.js";import{Texture as U}from"../../../../webgl/Texture.js";import{VertexArrayObject as O}from"../../../../webgl/VertexArrayObject.js";const b=e=>{const t={geometry:[{location:0,name:"a_pos",count:2,type:c.SHORT},{location:1,name:"a_id",count:3,type:c.UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:c.UNSIGNED_BYTE}]};return e.dotDensity?(t.geometry.push({location:3,name:"a_inverseArea",count:1,type:c.FLOAT}),d(e.data,t)):(t.geometry.push({location:3,name:"a_color",count:4,type:c.UNSIGNED_BYTE,normalized:!0}),e.simple||t.geometry.push({location:4,name:"a_aux1",count:4,type:c.UNSIGNED_SHORT}),t.geometry.push({location:5,name:"a_aux2",count:4,type:c.UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:c.UNSIGNED_BYTE}),e.simple||t.geometry.push({location:7,name:"a_zoomRange",count:2,type:c.UNSIGNED_SHORT}),d(e.data,t))};class N extends l{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([i,s]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=e(this._dotFBO),this._dotVAO=e(this._dotVAO)}getGeometryType(){return a.FILL}drawGeometry(e,o,r,i){const{context:s,painter:n,rendererInfo:a,requiredLevel:d,passOptions:l,requestRender:u}=e,f=m.load(r.materialKey),h=t(l)&&"hittest"===l.type,T=n.materialManager;let p=_.TRIANGLES,y=b(f);h&&(y=this._getTriangleDesc(r.materialKey,y),p=_.POINTS);const{attributes:x,bufferLayouts:D}=y,g=T.getMaterialProgram(e,f,"materials/fill",x,i);if(t(u)&&!h&&!g.isCompiled)return void u();if(s.useProgram(g),this._setSharedUniforms(g,e,o),g.setUniform2f("u_tileOffset",512*o.key.col,512*o.key.row),f.textureBinding){n.textureManager.bindTextures(s,g,f);const e=1/2**(d-o.key.level);g.setUniform1f("u_zoomFactor",e)}const E=1/e.pixelRatio;g.setUniform1f("u_blur",E),g.setUniform1f("u_antialiasing",E),this._setSizeVVUniforms(f,g,a,o),this._setColorAndOpacityVVUniforms(f,g,a);const S=r.target.getVAO(s,D,x,h);let w=r.indexCount,U=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(h&&(w/=3,U/=3),s.bindVAO(S),!f.dotDensity||h)s.drawElements(p,w,c.UNSIGNED_INT,U);else{const t=this._drawDotLocations(e,o,g,w,U);this._drawDotDensity(e,o,t)}}_drawDotDensity(e,o,r){const{context:i,painter:s,rendererInfo:n,requestRender:a}=e,d=s.materialManager.getProgram(this._dotDesc);if(t(a)&&!d.isCompiled)return void a();const l=this._createDotDensityMesh(i,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:c.SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});i.setStencilTestEnabled(!0),i.useProgram(d),d.setUniform1f("u_tileZoomFactor",1),d.setUniform1i("u_texture",this._dotSamplers[0]),d.setUniform1f("u_dotSize",Math.max(n.ddDotSize,1)),d.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(d,e,o),i.bindTexture(r,this._dotSamplers[0]),i.bindVAO(l),i.drawArrays(_.POINTS,0,262144)}_drawDotLocations(e,t,o,r,i){const{context:s,rendererInfo:a,requiredLevel:d}=e,l=s.getViewport();s.setViewport(0,0,512,512);const m=s.getBoundFramebufferObject(),u=this._createFBO(s);s.bindFramebuffer(u),s.setClearColor(0,0,0,0),s.clear(s.gl.COLOR_BUFFER_BIT|s.gl.STENCIL_BUFFER_BIT),s.setStencilTestEnabled(!1);const f=1/2**(d-t.key.level),h=n,T=h*window.devicePixelRatio*h*window.devicePixelRatio,p=1/f*(1/f),y=a.ddDotScale?e.state.scale/a.ddDotScale:1;return o.setUniform1f("u_tileZoomFactor",f),o.setUniform1f("u_tileDotsOverArea",T/(n*window.devicePixelRatio*n*window.devicePixelRatio)),o.setUniformMatrix4fv("u_dotColors",a.ddColors),o.setUniform4fv("u_isActive",a.ddActiveDots),o.setUniform4fv("u_dotBackgroundColor",a.ddBackgroundColor),o.setUniform1f("u_dotValue",Math.max(1,a.ddDotValue*y*p)),this._bindDotDensityTextures(s,o,a,h),s.drawElements(_.TRIANGLES,r,c.UNSIGNED_INT,i),s.setViewport(l.x,l.y,l.width,l.height),s.bindFramebuffer(m),u.colorTexture}_createFBO(e){if(o(this._dotFBO)){const t=512,o=512,r={target:f.TEXTURE_2D,pixelFormat:h.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:y.CLAMP_TO_EDGE,width:t,height:o},i={colorTarget:x.TEXTURE,depthStencilTarget:D.DEPTH_STENCIL_RENDER_BUFFER},s=new w(e,{width:t,height:o,internalFormat:g.DEPTH_STENCIL});this._dotFBO=new S(e,i,r,s)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let e=0;e<this._dotTextures.length;e++)this._dotTextures[e].dispose();this._dotTextures=null}}_bindDotDensityTextures(e,t,o,r){const i=this._createDotDensityTextures(e,r,o.ddSeed);t.setUniform1iv("u_dotTextures",this._dotSamplers);for(let s=0;s<i.length;s++)e.bindTexture(i[s],this._dotSamplers[s])}_createDotDensityMesh(e,t,r){if(o(this._dotVAO)){const o=2,i=new Int16Array(262144*o);for(let e=0;e<512;e++)for(let t=0;t<512;t++)i[o*(t+512*e)]=t,i[o*(t+512*e)+1]=e;const s=u.createVertex(e,E.STATIC_DRAW,i);this._dotVAO=new O(e,t,r,{geometry:s},null)}return this._dotVAO}_createDotDensityTextures(e,t,o){if(this._dotTextureSize===t&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=t,this._seed=o),null===this._dotTextures){const i=new r(o);this._dotTextures=[this._allocDotDensityTexture(e,t,i),this._allocDotDensityTexture(e,t,i)]}return this._dotTextures}_allocDotDensityTexture(e,t,o){const r=new Float32Array(t*t*4);for(let i=0;i<r.length;i++)r[i]=o.getFloat();return new U(e,{wrapMode:y.REPEAT,pixelFormat:h.RGBA,dataType:T.FLOAT,samplingMode:p.NEAREST,width:t,height:t},r)}}export{N 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as t}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LabelMaterialKey as o}from"../materialKey/MaterialKey.js";import{DataType as n,CompareFunction as r,PrimitiveType as i}from"../../../../webgl/enums.js";const s=e=>t(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT},{location:1,name:"a_id",count:4,type:n.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:n.UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:n.UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:n.UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:n.SHORT},{location:8,name:"a_texCoords",count:2,type:n.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.LABEL}drawGeometry(e,t,a,m){const{context:l,painter:c,state:f,rendererInfo:u}=e,d=o.load(a.materialKey),_=d.mapAligned?1:0;if(!_&&Math.abs(t.key.level-Math.round(100*e.displayLevel)/100)>=1)return;const{bufferLayouts:p,attributes:E}=s(d),y=c.materialManager.getMaterialProgram(e,d,"materials/label",E,m);e.context.setStencilFunction(r.EQUAL,0,255),l.useProgram(y),this._setSharedUniforms(y,e,t),c.textureManager.bindTextures(l,y,d);const N=1===_?f.displayViewMat3:f.displayMat3;this._setSizeVVUniforms(d,y,u,t),y.setUniform1f("u_mapRotation",Math.floor(f.rotation/360*254)),y.setUniform1f("u_mapAligned",_),y.setUniformMatrix3fv("u_displayMat3",N),y.setUniform1f("u_opacity",1),y.setUniform2fv("u_screenSize",e.state.size),y.setUniform1f("u_isHalo",1);const S=a.target.getVAO(l,p,E),U=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(S),l.drawElements(i.TRIANGLES,a.indexCount,n.UNSIGNED_INT,U),y.setUniform1f("u_isHalo",0),l.drawElements(i.TRIANGLES,a.indexCount,n.UNSIGNED_INT,U),l.setStencilTestEnabled(!0),l.setBlendingEnabled(!0)}}export{m as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LabelMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,CompareFunction as i,PrimitiveType as s}from"../../../../webgl/enums.js";const m=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texAndSize",count:4,type:r.UNSIGNED_BYTE},{location:5,name:"a_refSymbolAndPlacementOffset",count:4,type:r.UNSIGNED_BYTE},{location:6,name:"a_glyphData",count:4,type:r.UNSIGNED_BYTE},{location:7,name:"a_vertexOffset",count:2,type:r.SHORT},{location:8,name:"a_texCoords",count:2,type:r.UNSIGNED_SHORT}]});class l extends a{dispose(){}getGeometryType(){return t.LABEL}drawGeometry(t,o,a,l){const{context:c,painter:d,state:f,rendererInfo:u,passOptions:p,requestRender:y}=t,_=n.load(a.materialKey),E=e(p)&&"hittest"===p.type,N=_.mapAligned?1:0;if(!N&&Math.abs(o.key.level-Math.round(100*t.displayLevel)/100)>=1)return;const{bufferLayouts:S,attributes:U}=m(_),T=d.materialManager.getMaterialProgram(t,_,"materials/label",U,l);if(e(y)&&!E&&!T.isCompiled)return void y();t.context.setStencilFunction(i.EQUAL,0,255),c.useProgram(T),this._setSharedUniforms(T,t,o),d.textureManager.bindTextures(c,T,_);const G=1===N?f.displayViewMat3:f.displayMat3;this._setSizeVVUniforms(_,T,u,o),T.setUniform1f("u_mapRotation",Math.floor(f.rotation/360*254)),T.setUniform1f("u_mapAligned",N),T.setUniformMatrix3fv("u_displayMat3",G),T.setUniform1f("u_opacity",1),T.setUniform2fv("u_screenSize",t.state.size),T.setUniform1f("u_isHalo",1);const g=a.target.getVAO(c,S,U),I=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;c.bindVAO(g),c.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),T.setUniform1f("u_isHalo",0),c.drawElements(s.TRIANGLES,a.indexCount,r.UNSIGNED_INT,I),c.setStencilTestEnabled(!0),c.setBlendingEnabled(!0)}}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.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as a}from"../Utils.js";import o from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";const s=t=>a(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:r.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:r.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:r.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:r.BYTE},{location:7,name:"a_aux",count:2,type:r.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:r.UNSIGNED_SHORT}]});class m extends o{dispose(){}getGeometryType(){return e.LINE}drawGeometry(e,a,o,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:y}=e,_=n.load(o.materialKey);let d=s(_),f=i.TRIANGLES;t(y)&&"hittest"===y.type&&(d=this._getTriangleDesc(o.materialKey,d),f=i.POINTS);const{attributes:E,bufferLayouts:N}=d,g=c.materialManager.getMaterialProgram(e,_,"materials/line",E,m),S=1/e.pixelRatio,T=0;l.useProgram(g),this._setSharedUniforms(g,e,a),_.textureBinding&&c.textureManager.bindTextures(l,g,_);const U=2**(p-a.key.level);g.setUniform1f("u_zoomFactor",U),g.setUniform1f("u_blur",T+S),g.setUniform1f("u_antialiasing",S),this._setSizeVVUniforms(_,g,u,a),this._setColorAndOpacityVVUniforms(_,g,u),l.setFaceCullingEnabled(!1);const G=t(y)&&"hittest"===y.type,I=o.target.getVAO(l,N,E,G);let x=o.indexCount,D=o.indexFrom*Uint32Array.BYTES_PER_ELEMENT;G&&(x/=3,D/=3),l.bindVAO(I),l.drawElements(f,x,r.UNSIGNED_INT,D)}}export{m as default};
5
+ import{isSome as e}from"../../../../../core/maybe.js";import{WGLGeometryType as t}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";const s=e=>o(e.data,{geometry:[{location:0,name:"a_pos",count:2,type:r.SHORT},{location:1,name:"a_id",count:4,type:r.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:r.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:r.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:r.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:r.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:r.BYTE},{location:7,name:"a_aux",count:2,type:r.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:r.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return t.LINE}drawGeometry(t,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:d,requestRender:y}=t,_=n.load(a.materialKey),f=e(d)&&"hittest"===d.type;let E=s(_),N=i.TRIANGLES;f&&(E=this._getTriangleDesc(a.materialKey,E),N=i.POINTS);const{attributes:g,bufferLayouts:S}=E,T=c.materialManager.getMaterialProgram(t,_,"materials/line",g,m);if(e(y)&&!f&&!T.isCompiled)return void y();const U=1/t.pixelRatio,G=0;l.useProgram(T),this._setSharedUniforms(T,t,o),_.textureBinding&&c.textureManager.bindTextures(l,T,_);const I=2**(p-o.key.level);T.setUniform1f("u_zoomFactor",I),T.setUniform1f("u_blur",G+U),T.setUniform1f("u_antialiasing",U),this._setSizeVVUniforms(_,T,u,o),this._setColorAndOpacityVVUniforms(_,T,u),l.setFaceCullingEnabled(!1);const x=a.target.getVAO(l,S,g,f);let D=a.indexCount,O=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;f&&(D/=3,O/=3),l.bindVAO(x),l.drawElements(N,D,r.UNSIGNED_INT,O)}}export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{MarkerMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_vertexOffset",count:2,type:i.SHORT},{location:2,name:"a_texCoords",count:2,type:i.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:i.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:i.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.MARKER}drawGeometry(e,o,a,m){const{context:l,painter:c,rendererInfo:p,state:d,passOptions:u}=e,y=n.load(a.materialKey),{bufferLayouts:_,attributes:E}=s(y),N=c.materialManager.getMaterialProgram(e,y,"materials/icon",E,m);l.useProgram(N),y.textureBinding&&c.textureManager.bindTextures(l,N,y,!0);let S=r.TRIANGLES;t(u)&&"hittest"===u.type&&(S=r.POINTS),this._setSharedUniforms(N,e,o);const f=y.vvRotation?d.displayViewMat3:d.displayMat3;N.setUniformMatrix3fv("u_displayMat3",f),this._setSizeVVUniforms(y,N,p,o),this._setColorAndOpacityVVUniforms(y,N,p),this._setRotationVVUniforms(y,N,p);const T=a.target.getVAO(l,_,E),U=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(T),l.drawElements(S,a.indexCount,i.UNSIGNED_INT,U)}}export{m as default};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{MarkerMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_vertexOffset",count:2,type:i.SHORT},{location:2,name:"a_texCoords",count:2,type:i.UNSIGNED_SHORT},{location:3,name:"a_bitSetAndDistRatio",count:2,type:i.UNSIGNED_SHORT},{location:4,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:5,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:6,name:"a_outlineColor",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:7,name:"a_sizeAndOutlineWidth",count:4,type:i.UNSIGNED_BYTE},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.MARKER}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:c,state:d,passOptions:u,requestRender:y}=e,_=n.load(a.materialKey),E=t(u)&&"hittest"===u.type,{bufferLayouts:N,attributes:f}=s(_),S=p.materialManager.getMaterialProgram(e,_,"materials/icon",f,m);if(t(y)&&!E&&!S.isCompiled)return void y();l.useProgram(S),_.textureBinding&&p.textureManager.bindTextures(l,S,_,!0);let T=r.TRIANGLES;t(u)&&"hittest"===u.type&&(T=r.POINTS),this._setSharedUniforms(S,e,o);const U=_.vvRotation?d.displayViewMat3:d.displayMat3;S.setUniformMatrix3fv("u_displayMat3",U),this._setSizeVVUniforms(_,S,c,o),this._setColorAndOpacityVVUniforms(_,S,c),this._setRotationVVUniforms(_,S,c);const R=a.target.getVAO(l,N,f),G=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(R),l.drawElements(T,a.indexCount,i.UNSIGNED_INT,G)}}export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{TextMaterialKey as r}from"../materialKey/MaterialKey.js";import{DataType as n,PrimitiveType as i}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT},{location:1,name:"a_id",count:4,type:n.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:n.UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:n.BYTE},{location:6,name:"a_zoomRange",count:2,type:n.UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:n.SHORT},{location:8,name:"a_texCoords",count:2,type:n.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.TEXT}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:u,state:_,passOptions:c}=e,y=r.load(a.materialKey),{bufferLayouts:d,attributes:f}=s(y),E=p.materialManager.getMaterialProgram(e,y,"materials/text",f,m);l.useProgram(E);let N=i.TRIANGLES;t(c)&&"hittest"===c.type&&(N=i.POINTS),this._setSharedUniforms(E,e,o),p.textureManager.bindTextures(l,E,y),E.setUniformMatrix3fv("u_displayMat3",_.displayMat3),E.setUniformMatrix3fv("u_displayViewMat3",_.displayViewMat3),this._setSizeVVUniforms(y,E,u,o),this._setColorAndOpacityVVUniforms(y,E,u),this._setRotationVVUniforms(y,E,u),E.setUniform1f("u_isHalo",1);const T=a.target.getVAO(l,d,f),S=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(T),l.drawElements(i.TRIANGLES,a.indexCount,n.UNSIGNED_INT,S),E.setUniform1f("u_isHalo",0),l.drawElements(N,a.indexCount,n.UNSIGNED_INT,S)}}export{m as default};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{TextMaterialKey as r}from"../materialKey/MaterialKey.js";import{DataType as n,PrimitiveType as i}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:n.SHORT},{location:1,name:"a_id",count:4,type:n.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_haloColor",count:4,type:n.UNSIGNED_BYTE,normalized:!0},{location:4,name:"a_texFontSize",count:4,type:n.UNSIGNED_BYTE},{location:5,name:"a_aux",count:4,type:n.BYTE},{location:6,name:"a_zoomRange",count:2,type:n.UNSIGNED_SHORT},{location:7,name:"a_vertexOffset",count:2,type:n.SHORT},{location:8,name:"a_texCoords",count:2,type:n.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.TEXT}drawGeometry(e,o,a,m){const{context:l,painter:p,rendererInfo:u,state:d,passOptions:_,requestRender:c}=e,y=r.load(a.materialKey),f=t(_)&&"hittest"===_.type,{bufferLayouts:E,attributes:N}=s(y),T=p.materialManager.getMaterialProgram(e,y,"materials/text",N,m);if(t(c)&&!f&&!T.isCompiled)return void c();l.useProgram(T);let S=i.TRIANGLES;f&&(S=i.POINTS),this._setSharedUniforms(T,e,o),p.textureManager.bindTextures(l,T,y),T.setUniformMatrix3fv("u_displayMat3",d.displayMat3),T.setUniformMatrix3fv("u_displayViewMat3",d.displayViewMat3),this._setSizeVVUniforms(y,T,u,o),this._setColorAndOpacityVVUniforms(y,T,u),this._setRotationVVUniforms(y,T,u),T.setUniform1f("u_isHalo",1);const U=a.target.getVAO(l,E,N),x=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;l.bindVAO(U),l.drawElements(i.TRIANGLES,a.indexCount,n.UNSIGNED_INT,x),T.setUniform1f("u_isHalo",0),l.drawElements(S,a.indexCount,n.UNSIGNED_INT,x)}}export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{Bloom as e}from"./Bloom.js";import{Blur as t}from"./Blur.js";import{Colorize as o}from"./Colorize.js";import{DropShadow as s}from"./DropShadow.js";import{Opacity as r}from"./Opacity.js";function c(e){switch(e){case"bloom":case"blur":case"opacity":case"drop-shadow":return e;default:return"colorize"}}const f={colorize:()=>new o,blur:()=>new t,bloom:()=>new e,opacity:()=>new r,"drop-shadow":()=>new s};class i{constructor(e){this._requestRender=e,this._effectMap=new Map}dispose(){this._requestRender&&(this._requestRender=null),this._effectMap.forEach((e=>e.dispose())),this._effectMap.clear()}getPostProcessingEffects(e){if(!e||0===e.length)return[];const t=[];for(const o of e){const e=c(o.type);let s=this._effectMap.get(e);s||(s=f[e](),this._effectMap.set(e,s)),t.push({postProcessingEffect:s,effect:o})}return t}}export{i as EffectManager};
5
+ import{Bloom as o}from"./Bloom.js";import{Blur as e}from"./Blur.js";import{Colorize as t}from"./Colorize.js";import{DropShadow as s}from"./DropShadow.js";import{Opacity as r}from"./Opacity.js";function c(o){switch(o){case"bloom":case"blur":case"opacity":case"drop-shadow":return o;default:return"colorize"}}const f={colorize:()=>new t,blur:()=>new e,bloom:()=>new o,opacity:()=>new r,"drop-shadow":()=>new s};class i{constructor(){this._effectMap=new Map}dispose(){this._effectMap.forEach((o=>o.dispose())),this._effectMap.clear()}getPostProcessingEffects(o){if(!o||0===o.length)return[];const e=[];for(const t of o){const o=c(t.type);let s=this._effectMap.get(o);s||(s=f[o](),this._effectMap.set(o,s)),e.push({postProcessingEffect:s,effect:t})}return e}}export{i as EffectManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{abortMaybe as a,isSome as n,unwrap as i,isNone as s}from"../../core/maybe.js";import{createTask as l,isAborted as r}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{supportsHeightModelInfo as u,deriveHeightModelInfoFromLayer as c}from"../../geometry/support/heightModelInfoUtils.js";import{ViewingMode as d}from"../ViewingMode.js";import{projectWithEngineOrService as f}from"./projectionUtils.js";let h=class extends t{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return n(this.userSpatialReference)?this.userSpatialReference:i(this._spatialReferenceTask.spatialReference)}get extent(){return i(this._extentTask.extent)}get heightModelInfo(){return i(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return i(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return i(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return s(this.userSpatialReference)||this.userSpatialReference.equals(i(this._spatialReferenceTask.spatialReference))?i(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return i(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const s=null==(e=this.map)?void 0:e.call(this),l=[];return n(this.priorityCollection)&&l.push(this.priorityCollection),l.push({parent:null==s?void 0:s.basemap,layers:null==s||null==(t=s.basemap)?void 0:t.baseLayers},{layers:null==s?void 0:s.layers},{parent:null==s?void 0:s.ground,layers:null==s||null==(a=s.ground)?void 0:a.layers},{parent:null==s?void 0:s.basemap,layers:null==s||null==(i=s.basemap)?void 0:i.referenceLayers}),l}get _allLayers(){return this._collectLayers(this.mapCollections)}get _spatialReferenceTask(){var e;if(this.suspended)return null!=(e=this._get("_spatialReferenceTask"))?e:{updating:!1};const{layers:t,updating:a}=this._allLayers;let i=null;for(const s of t){const e=this._getSupportedSpatialReferences(s);if(e.length>0){const t=this._narrowDownSpatialReferenceCandidates(i,e);n(t)&&(i=t)}if(n(i)&&1===i.length)break}if(a&&(s(i)||1!==i.length))return{updating:!0};const l=this._pickSpatialReferenceCandidate(i);return{spatialReference:n(l)?l.spatialReference:null,viewingMode:n(l)?l.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,n,i,s,l,r;if(!this.required.tileInfo)return null!=(r=this._get("_tileInfoTask"))?r:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(n=a.call(this))||null==(i=n.basemap)?void 0:i.baseLayers},{layers:null==(s=this.map)||null==(l=s.call(this))?void 0:l.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:n}=this._allLayers;for(const l of a)if(u(l)){const e=c(l);var i,s;if(e)return{heightModelInfo:e,vcsWkid:null==(i=l.spatialReference)?void 0:i.vcsWkid,latestVcsWkid:null==(s=l.spatialReference)?void 0:s.latestVcsWkid,updating:!1}}return{updating:n}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const l of t.layers){var s;const e="fullExtents"in l&&l.fullExtents||(n(l.fullExtent)?[l.fullExtent]:[]),t=this.requiresExtentInSpatialReference?null:e[0],a=null!=(s=e.find((e=>e.spatialReference.equals(this.spatialReference))))?s:t;if(a)return{candidates:[{extent:a,layer:l}],updating:!1};if(this._getSupportedSpatialReferences(l).length>0)for(const n of e)i.push({extent:n,layer:l})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(s(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const i=this._pickExtentCandidate(e),o=this.spatialReference;return i.extent.equals(this._projectExtentTask.input)&&o.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:n(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished}:(n(this._projectExtentTask.task)&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._projectExtentTask={input:i.extent.clone(),output:null,spatialReference:o.clone(),task:l((async e=>{try{const t=await f(i.extent,o,i.layer.portalItem,e);this._projectExtentTask={...this._projectExtentTask,task:null,output:t}}catch(t){if(r(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,t){if(s(e))return t;const a=[],i=(e,t)=>n(e)?n(t)?e===t&&e:e:t;for(const n of e)for(const e of t){if(!n.spatialReference.equals(e.spatialReference))continue;const t=i(n.viewingMode,e.viewingMode);if(!1!==t){a.push({spatialReference:n.spatialReference,viewingMode:t});break}}return a.length>0?a:null}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return s(e)||e.length<1?n(t)?{spatialReference:t,viewingMode:null}:null:(n(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==d.Local))&&(e=e.filter((({viewingMode:e})=>e!==d.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(n(t)){const e=n(t.constraints)?t.constraints:[{spatialReference:i,viewingMode:null}];for(const{spatialReference:t,viewingMode:n}of e)(!this.requiresExtentInSpatialReference||s(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:n})}}return a}_pickExtentCandidate(e){const t=this.spatialReference;return e.find((({extent:e})=>t.equals(e.spatialReference)))||e[0]}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const n of e)if(this._collectCollection(n,a),a.preloading===this.sourcePreloadCount)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const a of e.layers){switch(this._loadMaybe(a)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":t.updating||t.layers.push(a),"layers"in a&&this._collectCollection({layers:a.layers},t)}if(t.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(e.title,e.load(),"loading"):e.loadStatus:"loaded"}};e([o()],h.prototype,"required",void 0),e([o({constructOnly:!0})],h.prototype,"map",void 0),e([o({constructOnly:!0})],h.prototype,"getSpatialReferenceSupport",void 0),e([o()],h.prototype,"defaultSpatialReference",void 0),e([o()],h.prototype,"userSpatialReference",void 0),e([o()],h.prototype,"sourcePreloadCount",void 0),e([o()],h.prototype,"priorityCollection",void 0),e([o()],h.prototype,"requiresExtentInSpatialReference",void 0),e([o()],h.prototype,"suspended",void 0),e([o({readOnly:!0})],h.prototype,"ready",null),e([o({readOnly:!0})],h.prototype,"heightModelInfoReady",null),e([o({readOnly:!0})],h.prototype,"spatialReference",null),e([o({readOnly:!0})],h.prototype,"extent",null),e([o({readOnly:!0})],h.prototype,"heightModelInfo",null),e([o({readOnly:!0})],h.prototype,"vcsWkid",null),e([o({readOnly:!0})],h.prototype,"latestVcsWkid",null),e([o({readOnly:!0})],h.prototype,"viewingMode",null),e([o({readOnly:!0})],h.prototype,"tileInfo",null),e([o({readOnly:!0})],h.prototype,"mapCollections",null),e([o({readOnly:!0})],h.prototype,"_allLayers",null),e([o({readOnly:!0})],h.prototype,"_spatialReferenceTask",null),e([o({readOnly:!0})],h.prototype,"_tileInfoTask",null),e([o({readOnly:!0})],h.prototype,"_heightModelInfoTask",null),e([o({readOnly:!0})],h.prototype,"_extentCandidatesTask",null),e([o()],h.prototype,"_extentTask",null),e([o()],h.prototype,"_projectExtentTask",void 0),h=e([p("esri.views.support.DefaultsFromMap")],h);export{h as DefaultsFromMap};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{abortMaybe as a,isSome as n,unwrap as i,isNone as s}from"../../core/maybe.js";import{createTask as r,isAborted as l}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{supportsHeightModelInfo as u,deriveHeightModelInfoFromLayer as c}from"../../geometry/support/heightModelInfoUtils.js";import{ViewingMode as d}from"../ViewingMode.js";import{projectWithEngineOrService as f}from"./projectionUtils.js";let h=class extends t{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return n(this.userSpatialReference)?this.userSpatialReference:i(this._spatialReferenceTask.spatialReference)}get extent(){return i(this._extentTask.extent)}get heightModelInfo(){return i(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return i(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return i(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return s(this.userSpatialReference)||this.userSpatialReference.equals(i(this._spatialReferenceTask.spatialReference))?i(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return i(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const s=null==(e=this.map)?void 0:e.call(this),r=[];return n(this.priorityCollection)&&r.push(this.priorityCollection),r.push({parent:null==s?void 0:s.basemap,layers:null==s||null==(t=s.basemap)?void 0:t.baseLayers},{layers:null==s?void 0:s.layers},{parent:null==s?void 0:s.ground,layers:null==s||null==(a=s.ground)?void 0:a.layers},{parent:null==s?void 0:s.basemap,layers:null==s||null==(i=s.basemap)?void 0:i.referenceLayers}),r}get _allLayers(){return this._collectLayers(this.mapCollections)}get _spatialReferenceTask(){var e;if(this.suspended)return null!=(e=this._get("_spatialReferenceTask"))?e:{updating:!1};const{layers:t,updating:a}=this._allLayers;let i=null;for(const s of t){const e=this._getSupportedSpatialReferences(s);if(e.length>0){const t=this._narrowDownSpatialReferenceCandidates(i,e);n(t)&&(i=t)}if(n(i)&&1===i.length)break}if(a&&(s(i)||1!==i.length))return{updating:!0};const r=this._pickSpatialReferenceCandidate(i);return{spatialReference:n(r)?r.spatialReference:null,viewingMode:n(r)?r.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,n,i,s,r,l;if(!this.required.tileInfo)return null!=(l=this._get("_tileInfoTask"))?l:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(n=a.call(this))||null==(i=n.basemap)?void 0:i.baseLayers},{layers:null==(s=this.map)||null==(r=s.call(this))?void 0:r.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:n}=this._allLayers;for(const r of a)if(u(r)){const e=c(r);var i,s;if(e)return{heightModelInfo:e,vcsWkid:null==(i=r.spatialReference)?void 0:i.vcsWkid,latestVcsWkid:null==(s=r.spatialReference)?void 0:s.latestVcsWkid,updating:!1}}return{updating:n}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const r of t.layers){var s;const e="fullExtents"in r&&r.fullExtents||(n(r.fullExtent)?[r.fullExtent]:[]),t=this.requiresExtentInSpatialReference?null:e[0],a=null!=(s=e.find((e=>e.spatialReference.equals(this.spatialReference))))?s:t;if(a)return{candidates:[{extent:a,layer:r}],updating:!1};if(this._getSupportedSpatialReferences(r).length>0)for(const n of e)i.push({extent:n,layer:r})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(s(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const i=this._pickExtentCandidate(e),o=this.spatialReference;return i.extent.equals(this._projectExtentTask.input)&&o.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:n(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished}:(n(this._projectExtentTask.task)&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._projectExtentTask={input:i.extent.clone(),output:null,spatialReference:o.clone(),task:r((async e=>{try{const t=await f(i.extent,o,i.layer.portalItem,e);this._projectExtentTask={...this._projectExtentTask,task:null,output:t}}catch(t){if(l(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,t){if(s(e))return t;const a=[],i=(e,t)=>n(e)?n(t)?e===t&&e:e:t;for(const n of e)for(const e of t){if(!n.spatialReference.equals(e.spatialReference))continue;const t=i(n.viewingMode,e.viewingMode);if(!1!==t){a.push({spatialReference:n.spatialReference,viewingMode:t});break}}return a.length>0?a:null}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return s(e)||e.length<1?n(t)?{spatialReference:t,viewingMode:null}:null:(n(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==d.Local))&&(e=e.filter((({viewingMode:e})=>e!==d.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(n(t)){const e=n(t.constraints)?t.constraints:[{spatialReference:i,viewingMode:null}];for(const{spatialReference:t,viewingMode:n}of e)(!this.requiresExtentInSpatialReference||s(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:n})}}return a}_pickExtentCandidate(e){const t=this.spatialReference;return e.find((({extent:e})=>t.equals(e.spatialReference)))||e[0]}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const n of e)if(this._collectCollection(n,a),a.preloading===this.sourcePreloadCount)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const a of e.layers){switch(this._loadMaybe(a)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":t.updating||t.layers.push(a),"layers"in a&&this._collectCollection({layers:a.layers},t)}if(t.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(e.load(),"loading"):e.loadStatus:"loaded"}};e([o()],h.prototype,"required",void 0),e([o({constructOnly:!0})],h.prototype,"map",void 0),e([o({constructOnly:!0})],h.prototype,"getSpatialReferenceSupport",void 0),e([o()],h.prototype,"defaultSpatialReference",void 0),e([o()],h.prototype,"userSpatialReference",void 0),e([o()],h.prototype,"sourcePreloadCount",void 0),e([o()],h.prototype,"priorityCollection",void 0),e([o()],h.prototype,"requiresExtentInSpatialReference",void 0),e([o()],h.prototype,"suspended",void 0),e([o({readOnly:!0})],h.prototype,"ready",null),e([o({readOnly:!0})],h.prototype,"heightModelInfoReady",null),e([o({readOnly:!0})],h.prototype,"spatialReference",null),e([o({readOnly:!0})],h.prototype,"extent",null),e([o({readOnly:!0})],h.prototype,"heightModelInfo",null),e([o({readOnly:!0})],h.prototype,"vcsWkid",null),e([o({readOnly:!0})],h.prototype,"latestVcsWkid",null),e([o({readOnly:!0})],h.prototype,"viewingMode",null),e([o({readOnly:!0})],h.prototype,"tileInfo",null),e([o({readOnly:!0})],h.prototype,"mapCollections",null),e([o({readOnly:!0})],h.prototype,"_allLayers",null),e([o({readOnly:!0})],h.prototype,"_spatialReferenceTask",null),e([o({readOnly:!0})],h.prototype,"_tileInfoTask",null),e([o({readOnly:!0})],h.prototype,"_heightModelInfoTask",null),e([o({readOnly:!0})],h.prototype,"_extentCandidatesTask",null),e([o()],h.prototype,"_extentTask",null),e([o()],h.prototype,"_projectExtentTask",void 0),h=e([p("esri.views.support.DefaultsFromMap")],h);export{h as DefaultsFromMap};