You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
4.7 KiB
12 lines
4.7 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define(["exports","../../../core/maybe","../../../chunks/RasterColorizer.glsl","../../webgl/enums","../../webgl/rasterUtils"],function(h,d,m,k,e){const l={bandCount:3,outMin:0,outMax:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class n{constructor(a,b,c=null,f=null){this.lij=a;this.type="raster-tile";this._interpolation=this._bandIds=this._symbolizerParameters= |
|
this._source=this._memoryUsed=null;this._dirty=!1;this._transformGrid=null;this.isRendereredSource=!1;this.rawPixelData=this.symbolizerRenderer=null;this.opacity=1;this.source=b;this.width=c||b.width;this.height=f||b.height}get source(){return this._source}set source(a){this._source=a;this._rasterTexture=d.disposeMaybe(this._rasterTexture);this._memoryUsed=null}get symbolizerParameters(){return this.isRendereredSource?{...l,maxCutOff:[1,1,1],factor:[1,1,1]}:this._symbolizerParameters||l}set symbolizerParameters(a){this._symbolizerParameters= |
|
a}get bandIds(){return this._bandIds}set bandIds(a){null!=a&&0<a.length?this._bandIds&&a.every((b,c)=>this._bandIds?.[c]?b===this._bandIds[c]:!1)||(this._bandIds=a,this._dirty=!0):this._bandIds=null}get interpolation(){return this._interpolation||"nearest"}set interpolation(a){this._interpolation=a;null!=this._rasterTexture&&(a=this._getRasterTextureInterpolation(a),this._rasterTexture.setSamplingMode("bilinear"===a?k.TextureSamplingMode.LINEAR:k.TextureSamplingMode.NEAREST))}get transformGrid(){return this._transformGrid}set transformGrid(a){this._transformGrid= |
|
a;this._transformGridTexture=d.disposeMaybe(this._transformGridTexture);this._memoryUsed=null}bind(a){if(!(this.source&&this.source.pixels&&0<this.source.pixels.length))return!1;(null==this._rasterTexture||this._dirty)&&this._updateRasterTexture(a,this.bandIds);null!=this._rasterTexture&&(this._updateColormapTexture(a),this.transformGrid&&null==this._transformGridTexture&&(this._transformGridTexture=e.createTransformTexture(a,this.transformGrid)));return!0}getUniforms(){const {symbolizerParameters:a, |
|
transformGrid:b,width:c,height:f,opacity:g}=this,p=e.getCommonUniforms(b,[c,f],[this.source.width,this.source.height],g),q=e.getColormapUniforms(a.colormap,a.colormapOffset),r="stretch"===this.symbolizerParameters.type?e.getStretchUniforms(this.symbolizerParameters):null,t="hillshade"===this.symbolizerParameters.type?e.getShadedReliefUniforms(this.symbolizerParameters):null;return new m.ColorizerUniforms(p,q,r||t,this._rasterTexture,this._transformGridTexture,this._colormapTexture)}get isBilinearWithStretchColorRamp(){const {symbolizerParameters:a}= |
|
this;return"bilinear"===this.interpolation&&null!=a.colormap&&"stretch"===a.type}get memoryUsage(){null==this._memoryUsed&&(this._memoryUsed=[this._rasterTexture,this._transformGridTexture,this._colormapTexture].map(a=>null!=a?a.descriptor.width*a.descriptor.height*4:0).reduce((a,b)=>a+b,0));return this._memoryUsed}release(){this._rasterTexture=d.disposeMaybe(this._rasterTexture);this._transformGridTexture=d.disposeMaybe(this._transformGridTexture);this._colormapTexture=d.disposeMaybe(this._colormapTexture); |
|
this.rawPixelData=this.transformGrid=this.source=null;return!0}_updateRasterTexture(a,b){const c=this.source?this.source.extractBands(b):null;c?.pixels&&0<c.pixels.length?(b=null==b&&null==this.bandIds||null!=b&&null!=this.bandIds&&b.join("")===this.bandIds.join(""),null!=this._rasterTexture&&b||(this._rasterTexture=d.disposeMaybe(this._rasterTexture),b=this._getRasterTextureInterpolation(this.interpolation),this._rasterTexture=e.createRasterTexture(a,c,b,this.isRendereredSource||this.hasStretchTypeNone()))): |
|
this._rasterTexture=d.disposeMaybe(this._rasterTexture)}hasStretchTypeNone(){return"stretchType"in this.symbolizerParameters&&"none"===this.symbolizerParameters.stretchType&&!this.symbolizerParameters.useGamma&&"u8"===this.source.pixelType}_getRasterTextureInterpolation(a){return"lut"===this.symbolizerParameters.type||"nearest"===a||"majority"===a||this.isBilinearWithStretchColorRamp?"nearest":"bilinear"}_updateColormapTexture(a){const b=this._colormap,c=this.symbolizerParameters.colormap;if(!c)this._colormapTexture= |
|
d.disposeMaybe(this._colormapTexture),this._colormap=null;else if(!b)this._colormapTexture=e.createColormapTexture(a,c),this._colormap=c;else if(c.length!==b.length||c.some((f,g)=>f!==b[g]))this._colormapTexture=d.disposeMaybe(this._colormapTexture),this._colormapTexture=e.createColormapTexture(a,c),this._colormap=c}}h.RasterTile=n;Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); |