Custom Gis Application with Arcgis Javascript API with modern layouting
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.
 
 

11 lines
4.1 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("../../chunks/tslib.es6 ../../Color ../../core/Clonable ../../core/Collection ../../core/collectionUtils ../../core/JSONSupport ../../core/mathUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ./VoxelColorStop ./VoxelOpacityStop ./VoxelRangeFilter".split(" "),function(r,B,m,u,C,D,q,v,H,I,J,E,y,z,F){var n;(function(a){a[a.Color=1]="Color";a[a.Alpha=2]="Alpha";a[a.Both=3]="Both"})(n||={});
m=class extends m.ClonableMixin(D.JSONSupport){constructor(a){super(a);this.rangeFilter=this.stretchRange=this.interpolation=null;this._colorMapSize=256;this.colorStops=new (u.ofType(y));this.opacityStops=new (u.ofType(z))}set colorStops(a){this._set("colorStops",C.referenceSetter(a,this._get("colorStops"),u.ofType(y)))}set opacityStops(a){this._set("opacityStops",C.referenceSetter(a,this._get("opacityStops"),u.ofType(z)))}getPreviousNext(a,d,b){let c=a;for(;0<--c&&d[c].type!==b&&d[c].type!==n.Both;);
const k=d.length;for(;++a<k&&d[a].type!==b&&d[a].type!==n.Both;);return[c,a]}get rasterizedTransferFunction(){const a=[];if(2>this.colorStops.length)return a;const d=[],b=[];for(var c of this.colorStops){if(!c.color)return a;b.push({color:{r:c.color.r,g:c.color.g,b:c.color.b,a:Math.round(255*(1-c.color.a))},position:c.position,type:n.Color})}if(0===this.opacityStops.length)for(var k of b)d.push({color:k.color,position:k.position});else{for(var g of this.opacityStops){c=q.clamp(g.position,0,1);k=Math.round(255*
q.clamp(1-g.opacity,0,1));let f=!1;for(var h of b)if(h.type===n.Color&&1E-5>Math.abs(h.position-c)){h.color.a=k;h.type=n.Both;f=!0;break}f||b.push({color:{r:0,g:0,b:0,a:k},position:g.position,type:n.Alpha})}b.sort((f,e)=>f.position<e.position?-1:1);g=b.length;for(h=0;h<g;++h){const f=b[h];if(f.type!==n.Both)if(f.type===n.Color){const [e,l]=this.getPreviousNext(h,b,n.Alpha);f.color.a=-1!==e&&l!==g?Math.round(q.lerp(b[e].color.a,b[l].color.a,(f.position-b[e].position)/(b[l].position-b[e].position))):
-1!==e?b[e].color.a:b[l].color.a}else{const [e,l]=this.getPreviousNext(h,b,n.Color);if(-1!==e&&l!==g){const p=(f.position-b[e].position)/(b[l].position-b[e].position),w=b[e].color,G=b[l].color;x.forEach(A=>{f.color[A]=Math.round(q.lerp(w[A],G[A],p))})}else-1!==e?x.forEach(p=>{f.color[p]=b[e].color[p]}):x.forEach(p=>{f.color[p]=b[l].color[p]})}}for(var t of b)d.push({color:t.color,position:t.position})}d[0].position=0;d[d.length-1].position=1;t=0;g=1;for(h=0;h<this._colorMapSize;++h){for(c=h/this._colorMapSize;c>
d[g].position;)t=g++;const f=(c-d[t].position)/(d[g].position-d[t].position),e=d[t].color,l=d[g].color,p=new B;x.forEach(w=>{p[w]=Math.round(q.lerp(e[w],l[w],f))});p.a=q.clamp(1-q.lerp(e.a,l.a,f)/255,0,1);a.push(p)}return a}getColorForContinuousDataValue(a,d){const b=this.rasterizedTransferFunction;if(2>this.colorStops.length||!Array.isArray(this.stretchRange)||2>this.stretchRange.length||256>b.length)return null;let c=this.stretchRange[0],k=this.stretchRange[1];if(c>k){const g=c;c=k;k=g}a=q.clamp(a,
c,k);a=b[Math.round((a-c)/(k-c)*(this._colorMapSize-1))].clone();d||(a.a=1);return a}};r.__decorate([v.property({type:["linear","nearest"],json:{write:!0}})],m.prototype,"interpolation",void 0);r.__decorate([v.property({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],m.prototype,"stretchRange",void 0);r.__decorate([v.property({type:u.ofType(y),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.colorStops&&0<this.colorStops.length}}}}})],m.prototype,"colorStops",null);r.__decorate([v.property({type:u.ofType(z),
json:{read:{source:"alphaStops"},write:{enabled:!0,target:"alphaStops",overridePolicy(){return{enabled:!!this.opacityStops&&0<this.opacityStops.length}}}}})],m.prototype,"opacityStops",null);r.__decorate([v.property({type:F,json:{write:!0}})],m.prototype,"rangeFilter",void 0);r.__decorate([v.property({type:[B],clonable:!1,json:{read:!1}})],m.prototype,"rasterizedTransferFunction",null);m=r.__decorate([E.subclass("esri.layers.voxel.VoxelTransferFunctionStyle")],m);const x=["r","g","b"];return m});