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.
 
 

16 lines
6.4 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 ../../core/jsonMap ../../core/JSONSupport ../../core/unitUtils ../../core/accessorSupport/decorators/property ../../core/accessorSupport/ensureType ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/reader ../../core/accessorSupport/decorators/subclass ../../core/accessorSupport/decorators/writer ../../geometry/Point ../../geometry/SpatialReference ../../geometry/support/aaBoundingRect ../../geometry/support/spatialReferenceUtils ../../geometry/support/webMercatorUtils ./LOD ./TileKey".split(" "),
function(k,w,f,B,m,x,G,H,y,C,D,q,z,A,u,E,p,F){var n;w=new w.JSONMap({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});f=n=class extends f.JSONSupport{static create(a={}){const {resolutionFactor:b=1,scales:c,size:d=256,spatialReference:e=z.WebMercator,numLODs:h=24}=a;if(!u.isValid(e)){a=[];if(c)for(var g=0;g<c.length;g++){var l=
c[g];a.push(new p({level:g,scale:l,resolution:l}))}else for(g=5E-4,l=h-1;0<=l;l--)a.unshift(new p({level:l,scale:g,resolution:g})),g*=2;return new n({dpi:96,lods:a,origin:new q(0,0,e),size:[d,d],spatialReference:e})}g=u.getInfo(e);a=a.origin?new q({x:a.origin.x,y:a.origin.y,spatialReference:e}):g?new q({x:g.origin[0],y:g.origin[1],spatialReference:e}):new q({x:0,y:0,spatialReference:e});g=1/(39.37*B.getMetersPerUnitForSR(e)*96);l=[];if(c)for(var r=0;r<c.length;r++){var t=c[r];l.push(new p({level:r,
scale:t,resolution:t*g}))}else{var v=u.isGeographic(e)?512/d*5.916575275917094E8:256/d*5.91657527591555E8;r=Math.ceil(h/b);l.push(new p({level:0,scale:v,resolution:v*g}));for(t=1;t<r;t++)v/=2**b,l.push(new p({level:t,scale:v,resolution:v*g}))}return new n({dpi:96,lods:l,origin:a,size:[d,d],spatialReference:e})}constructor(a){super(a);this.dpi=96;this.spatialReference=this.size=this.origin=this.format=null}get isWrappable(){const {spatialReference:a,origin:b}=this;if(a&&b){const c=u.getInfo(a);return a.isWrappable&&
!!c&&Math.abs(c.origin[0]-b.x)<=c.dx}return!1}readOrigin(a,b){return q.fromJSON({spatialReference:b.spatialReference,...a})}set lods(a){const b=[],c=this._levelToLOD={};a&&a.forEach(d=>{b.push(d.scale);c[d.level]=d});this._set("scales",b);this._set("lods",a);this._initializeUpsampleLevels()}readSize(a,b){return[b.cols,b.rows]}writeSize(a,b){b.cols=a[0];b.rows=a[1]}zoomToScale(a){const b=this.scales;if(0>=a)return b[0];if(a>=b.length-1)return b[b.length-1];const c=Math.floor(a);return b[c]/(b[c]/b[c+
1])**(a-c)}scaleToZoom(a){const b=this.scales,c=b.length-1;let d=0;for(;d<c;d++){const e=b[d],h=b[d+1];if(e<=a)break;if(h===a)return d+1;if(e>a&&h<a)return d+Math.log(e/a)/Math.log(e/h)}return d}tileAt(a,b,c,d){var e=this.lodAt(a);if(!e)return null;let h;if("number"===typeof b)h=b,b=c;else{if(u.equals(b.spatialReference,this.spatialReference))h=b.x,b=b.y;else{d=E.project(b,this.spatialReference);if(null==d)return null;h=d.x;b=d.y}d=c}c=e.resolution*this.size[0];e=e.resolution*this.size[1];d||=new F.TileKey(null,
0,0,0,A.create());d.level=a;d.row=Math.floor((this.origin.y-b)/e+.001);d.col=Math.floor((h-this.origin.x)/c+.001);this.updateTileInfo(d);return d}updateTileInfo(a,b=n.ExtrapolateOptions.NONE){var c=this.lodAt(a.level);c||b!==n.ExtrapolateOptions.POWER_OF_TWO||(b=this.lods[this.lods.length-1],b.level<a.level&&(c=b));if(c){var d=a.level-c.level;b=c.resolution*this.size[0]/2**d;c=c.resolution*this.size[1]/2**d;a.id=`${a.level}/${a.row}/${a.col}`;a.extent||(a.extent=A.create());a.extent[0]=this.origin.x+
a.col*b;a.extent[1]=this.origin.y-(a.row+1)*c;a.extent[2]=a.extent[0]+b;a.extent[3]=a.extent[1]+c}}upsampleTile(a){const b=this._upsampleLevels[a.level];if(!b||-1===b.parentLevel)return!1;a.level=b.parentLevel;a.row=Math.floor(a.row/b.factor+.001);a.col=Math.floor(a.col/b.factor+.001);this.updateTileInfo(a);return!0}getTileBounds(a,b){var c=this.lodAt(b.level);if(null==c)return null;var {resolution:d}=c;c=d*this.size[0];d*=this.size[1];a[0]=this.origin.x+b.col*c;a[1]=this.origin.y-(b.row+1)*d;a[2]=
a[0]+c;a[3]=a[1]+d;return a}lodAt(a){return this._levelToLOD?.[a]??null}clone(){return n.fromJSON(this.write({}))}getCompatibleForVTL(a){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===a)return null;const b=(512===this.size[0]&&256===a?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===a&&0===b)return this;const c=[],d=this.lods.length-b;for(let e=0;e<d;e++){const h=e+b,{scale:g,resolution:l}=0<=h?this.lods[h]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};
c.push(new p({level:e,scale:g,resolution:l}))}return new n({size:[a,a],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:c})}_initializeUpsampleLevels(){const a=this.lods;this._upsampleLevels=[];let b=null;for(let c=0;c<a.length;c++){const d=a[c];this._upsampleLevels[d.level]={parentLevel:b?b.level:-1,factor:b?b.resolution/d.resolution:0};b=d}}};k.__decorate([m.property({type:Number,json:{write:!0}})],f.prototype,
"compressionQuality",void 0);k.__decorate([m.property({type:Number,json:{write:!0}})],f.prototype,"dpi",void 0);k.__decorate([m.property({type:String,json:{read:w.read,write:w.write,origins:{"web-scene":{read:!1,write:!1}}}})],f.prototype,"format",void 0);k.__decorate([m.property({readOnly:!0})],f.prototype,"isWrappable",null);k.__decorate([m.property({type:q,json:{write:!0}})],f.prototype,"origin",void 0);k.__decorate([y.reader("origin")],f.prototype,"readOrigin",null);k.__decorate([m.property({type:[p],
value:null,json:{write:!0}})],f.prototype,"lods",null);k.__decorate([m.property({readOnly:!0})],f.prototype,"scales",void 0);k.__decorate([m.property({cast:a=>Array.isArray(a)?a:"number"===typeof a?[a,a]:[256,256]})],f.prototype,"size",void 0);k.__decorate([y.reader("size",["rows","cols"])],f.prototype,"readSize",null);k.__decorate([D.writer("size",{cols:{type:x.Integer},rows:{type:x.Integer}})],f.prototype,"writeSize",null);k.__decorate([m.property({type:z,json:{write:!0}})],f.prototype,"spatialReference",
void 0);f=n=k.__decorate([C.subclass("esri.layers.support.TileInfo")],f);(function(a){a=a.ExtrapolateOptions||(a.ExtrapolateOptions={});a[a.NONE=0]="NONE";a[a.POWER_OF_TWO=1]="POWER_OF_TWO"})(f||={});return f});