@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 16.6 kB
JavaScript
;(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9036],{17029(e,t,i){i.r(t),i.d(t,{default:()=>Z});var r,s=i(5482),o=i(11254),l=i(51447),n=i(49186),a=i(66552),c=i(53966),u=i(25728),p=i(91429),h=i(86738),g=i(16930),d=i(5443),y=i(19419),w=i(4146),v=i(63074),f=i(54310),b=i(25036),m=i(33446),M=i(87045);const A=new(i(72802).U)(0,0,0);let C=r=class extends((0,v.dM)((0,b.j)((0,f.J)(w.A)))){constructor(e){super(e),this.tileInfo=M.A.create({spatialReference:g.A.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new d.A(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,g.A.WebMercator),this.spatialReference=g.A.WebMercator}addResolvingPromise(e){super.addResolvingPromise(e)}getTileBounds(e,t,i,r){const s=r||(0,y.vt)();return A.level=e,A.row=t,A.col=i,A.extent=s,this.tileInfo.updateTileInfo(A),s}fetchTile(e,t,i,r={}){const{signal:s}=r,l=this.getTileUrl(e,t,i),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return(0,o.A)(l??"",n).then(e=>e.data)}async fetchImageBitmapTile(e,t,i,s={}){const{signal:l}=s;if(this.fetchTile!==r.prototype.fetchTile){const r=await this.fetchTile(e,t,i,s);return(0,m.C)(r,e,t,i,l)}const n=this.getTileUrl(e,t,i)??"",a={responseType:"blob",signal:l,query:{...this.refreshParameters}},{data:c}=await(0,o.A)(n,a);return(0,m.C)(c,e,t,i,l)}getTileUrl(){throw new n.A("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};(0,s.Cg)([(0,p.MZ)({type:M.A})],C.prototype,"tileInfo",void 0),(0,s.Cg)([(0,p.MZ)({type:["show","hide"]})],C.prototype,"listMode",void 0),(0,s.Cg)([(0,p.MZ)({readOnly:!0,value:"base-tile"})],C.prototype,"type",void 0),(0,s.Cg)([(0,p.MZ)({nonNullable:!0})],C.prototype,"fullExtent",void 0),(0,s.Cg)([(0,p.MZ)({type:g.A})],C.prototype,"spatialReference",void 0),C=r=(0,s.Cg)([(0,p.$K)("esri.layers.BaseTileLayer")],C);var x=i(16131),z=i(91806);const T=new a.J({BingMapsAerial:"aerial",BingMapsRoad:"road",BingMapsHybrid:"hybrid"});(0,l.uW)(c.A.getLogger("esri.layers.BingMapsLayer"),"esri.layers.BingMapsLayer",{version:"4.33",warnOnce:!0});let R=class extends((0,x.q)((0,u.M)(C))){constructor(e){super(e),this.type="bing-maps",this.tileInfo=new M.A({size:[256,256],dpi:96,origin:new h.A({x:-20037508.342787,y:20037508.342787,spatialReference:g.A.WebMercator}),spatialReference:g.A.WebMercator,lods:[new z.A({level:1,resolution:78271.5169639999,scale:295828763.795777}),new z.A({level:2,resolution:39135.7584820001,scale:147914381.897889}),new z.A({level:3,resolution:19567.8792409999,scale:73957190.948944}),new z.A({level:4,resolution:9783.93962049996,scale:36978595.474472}),new z.A({level:5,resolution:4891.96981024998,scale:18489297.737236}),new z.A({level:6,resolution:2445.98490512499,scale:9244648.868618}),new z.A({level:7,resolution:1222.99245256249,scale:4622324.434309}),new z.A({level:8,resolution:611.49622628138,scale:2311162.217155}),new z.A({level:9,resolution:305.748113140558,scale:1155581.108577}),new z.A({level:10,resolution:152.874056570411,scale:577790.554289}),new z.A({level:11,resolution:76.4370282850732,scale:288895.277144}),new z.A({level:12,resolution:38.2185141425366,scale:144447.638572}),new z.A({level:13,resolution:19.1092570712683,scale:72223.819286}),new z.A({level:14,resolution:9.55462853563415,scale:36111.909643}),new z.A({level:15,resolution:4.77731426794937,scale:18055.954822}),new z.A({level:16,resolution:2.38865713397468,scale:9027.977411}),new z.A({level:17,resolution:1.19432856685505,scale:4513.988705}),new z.A({level:18,resolution:.597164283559817,scale:2256.994353}),new z.A({level:19,resolution:.298582141647617,scale:1128.497176}),new z.A({level:20,resolution:.1492910708238085,scale:564.248588})]}),this.key=null,this.style="road",this.culture="en-US",this.region=null,this.portalUrl=null,this.hasAttributionData=!0}get bingMetadata(){return this._get("bingMetadata")}set bingMetadata(e){this._set("bingMetadata",e)}get copyright(){return null!=this.bingMetadata?this.bingMetadata.copyright:null}get operationalLayerType(){return T.toJSON(this.style)}get bingLogo(){return null!=this.bingMetadata?this.bingMetadata.brandLogoUri:null}load(e){return this.key?this.addResolvingPromise(this._getMetadata()):this.portalUrl?this.addResolvingPromise(this._getPortalBingKey().then(()=>this._getMetadata())):this.addResolvingPromise(Promise.reject(new n.A("bingmapslayer:load","Bing layer must have bing key."))),Promise.resolve(this)}getTileUrl(e,t,i){if(!this.loaded||null==this.bingMetadata)return null;const r=this.bingMetadata.resourceSets[0].resources[0],s=r.imageUrlSubdomains[t%r.imageUrlSubdomains.length],o=this._getQuadKey(e,t,i);return r.imageUrl.replace("{subdomain}",s).replace("{quadkey}",o)}async fetchAttributionData(){return this.load().then(()=>null==this.bingMetadata?null:{contributors:this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map(e=>({attribution:e.attribution,coverageAreas:e.coverageAreas.map(e=>({zoomMin:e.zoomMin-(e.zoomMin?1:0),zoomMax:e.zoomMax-(e.zoomMin?1:0),score:1,bbox:[e.bbox[0],e.bbox[1],e.bbox[2],e.bbox[3]]}))}))})}_getMetadata(){const e={road:"roadOnDemand",aerial:"aerial",hybrid:"aerialWithLabelsOnDemand"}[this.style];return(0,o.A)(`https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${e}`,{responseType:"json",query:{include:"ImageryProviders",uriScheme:"https",key:this.key,suppressStatus:!0,output:"json",culture:this.culture,userRegion:this.region}}).then(e=>{const t=e.data;if(200!==t.statusCode)throw new n.A("bingmapslayer:getmetadata",t.statusDescription);if(this.bingMetadata=t,0===this.bingMetadata.resourceSets.length)throw new n.A("bingmapslayer:getmetadata","no bing resourcesets");if(0===this.bingMetadata.resourceSets[0].resources.length)throw new n.A("bingmapslayer:getmetadata","no bing resources")}).catch(e=>{throw new n.A("bingmapslayer:getmetadata",e.message)})}_getPortalBingKey(){return(0,o.A)(this.portalUrl??"",{responseType:"json",authMode:"no-prompt",query:{f:"json"}}).then(e=>{if(!e.data.bingKey)throw new n.A("bingmapslayer:getportalbingkey","The referenced Portal does not contain a valid bing key");this.key=e.data.bingKey}).catch(e=>{throw new n.A("bingmapslayer:getportalbingkey",e.message)})}_getQuadKey(e,t,i){let r="";for(let s=e;s>0;s--){let e=0;const o=1<<s-1;0!==(i&o)&&(e+=1),0!==(t&o)&&(e+=2),r+=e.toString()}return r}};(0,s.Cg)([(0,p.MZ)({json:{read:!1,write:!1},value:null})],R.prototype,"bingMetadata",null),(0,s.Cg)([(0,p.MZ)({json:{read:!1,write:!1},value:"bing-maps",readOnly:!0})],R.prototype,"type",void 0),(0,s.Cg)([(0,p.MZ)({type:M.A})],R.prototype,"tileInfo",void 0),(0,s.Cg)([(0,p.MZ)({type:String,readOnly:!0,json:{read:!1,write:!1}})],R.prototype,"copyright",null),(0,s.Cg)([(0,p.MZ)({type:String,json:{write:!1,read:!1}})],R.prototype,"key",void 0),(0,s.Cg)([(0,p.MZ)({type:T.apiValues,nonNullable:!0,json:{read:{source:"layerType",reader:T.read}}})],R.prototype,"style",void 0),(0,s.Cg)([(0,p.MZ)({type:["BingMapsAerial","BingMapsHybrid","BingMapsRoad"]})],R.prototype,"operationalLayerType",null),(0,s.Cg)([(0,p.MZ)({type:String,json:{write:!1,read:!1}})],R.prototype,"culture",void 0),(0,s.Cg)([(0,p.MZ)({type:String,json:{write:!1,read:!1}})],R.prototype,"region",void 0),(0,s.Cg)([(0,p.MZ)({type:String,json:{write:!0,read:!0}})],R.prototype,"portalUrl",void 0),(0,s.Cg)([(0,p.MZ)({type:Boolean,json:{write:!1,read:!1}})],R.prototype,"hasAttributionData",void 0),(0,s.Cg)([(0,p.MZ)({type:String,readOnly:!0})],R.prototype,"bingLogo",null),R=(0,s.Cg)([(0,p.$K)("esri.layers.BingMapsLayer")],R);const Z=R},33446(e,t,i){i.d(t,{C:()=>l,m:()=>o});var r=i(49186),s=i(74887);async function o(e,t,i){let o;try{o=await createImageBitmap(e)}catch(e){throw new r.A("request:server",`Unable to load ${t}`,{url:t,error:e})}return(0,s.Te)(i),o}async function l(e,t,i,o,l){let n;try{n=await createImageBitmap(e)}catch(e){throw new r.A("request:server",`Unable to load tile ${t}/${i}/${o}`,{error:e,level:t,row:i,col:o})}return(0,s.Te)(l),n}},69540(e,t,i){i.d(t,{OU:()=>u,Pw:()=>p});var r=i(5482),s=i(69622),o=(i(44208),i(4718)),l=(i(53966),i(97768)),n=i(88620),a=i(64108);const c=Symbol("ClonableMixin"),u=e=>{var t;const i=e;let s=class extends i{constructor(){super(...arguments),this[t]=!0}static{t=c}clone(e){const t=(0,n.oY)(this);(0,l.Lw)(t,"unable to clone instance of non-accessor class");const i=t.metadata,r=t.store,s={},a=new Map;for(const t in i){const l=i[t],n=r?.originOf(t),c=l.clonable;if(l.readOnly||!1===c||7!==n&&0!==n&&5!==n&&4!==n)continue;const u=this[t];let p=null;if("function"==typeof c)p=c(u,e);else if("reference"===c)p=u;else if(p=(0,o.TU)(u,e),null!=u&&null==p)continue;0===n?a.set(t,p):s[t]=p}const c=new(0,Object.getPrototypeOf(this).constructor)(s);if(a.size){const e=(0,n.oY)(c)?.store;if(e)for(const[t,i]of a)e.set(t,i,0)}return c}};return s=(0,r.Cg)([(0,a.$)("esri.core.Clonable")],s),s},p=u(s.A)},72802(e,t,i){i.d(t,{U:()=>s});var r=i(19419);class s{constructor(e,t,i,s=(0,r.vt)()){this._level=e,this._row=t,this._col=i,this.extent=s}get id(){return this._id??=`${this.level}/${this.row}/${this.col}`,this._id}get level(){return this._level}set level(e){this._level=e,this._id=null}get row(){return this._row}set row(e){this._row=e,this._id=null}get col(){return this._col}set col(e){this._col=e,this._id=null}toJSON(){return{level:this._level,row:this._row,col:this._col,extent:this.extent}}static fromJSON(e){return new s(e.level,e.row,e.col,e.extent)}}},78553(e,t,i){i.d(t,{D:()=>o,p:()=>s});var r=i(56507);function s(e){const t=(0,r.Vr)(100*(1-e));return Math.max(0,Math.min(t,100))}function o(e){const t=1-e/100;return Math.max(0,Math.min(t,1))}},87045(e,t,i){i.d(t,{A:()=>b});var r,s=i(5482),o=i(66552),l=i(25482),n=i(86211),a=i(91429),c=i(56507),u=i(86738),p=i(16930),h=i(21325),g=i(28735),d=i(91806),y=i(72802),w=i(36005),v=i(43937);const f=new o.J({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"});let b=class extends l.o{static{r=this}static create(e={}){const{resolutionFactor:t=1,scales:i,size:s=256,spatialReference:o=p.A.WebMercator,numLODs:l=24}=e;if(!(0,h.fn)(o)){const e=[];if(i)for(let t=0;t<i.length;t++){const r=i[t];e.push(new d.A({level:t,scale:r,resolution:r}))}else{let t=5e-4;for(let i=l-1;i>=0;i--)e.unshift(new d.A({level:i,scale:t,resolution:t})),t*=2}return new r({dpi:96,lods:e,origin:new u.A(0,0,o),size:[s,s],spatialReference:o})}const a=(0,h.Vp)(o),c=e.origin?new u.A({x:e.origin.x,y:e.origin.y,spatialReference:o}):new u.A(a?{x:a.origin[0],y:a.origin[1],spatialReference:o}:{x:0,y:0,spatialReference:o}),g=1/(39.37*(0,n.GA)(o)*96),y=[];if(i)for(let e=0;e<i.length;e++){const t=i[e],r=t*g;y.push(new d.A({level:e,scale:t,resolution:r}))}else{let e=(0,h.EA)(o)?512/s*591657527.5917094:256/s*591657527.591555;const i=Math.ceil(l/t);y.push(new d.A({level:0,scale:e,resolution:e*g}));for(let r=1;r<i;r++){const i=e/2**t,s=i*g;y.push(new d.A({level:r,scale:i,resolution:s})),e=i}}return new r({dpi:96,lods:y,origin:c,size:[s,s],spatialReference:o})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const i=(0,h.Vp)(e);return e.isWrappable&&!!i&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return u.A.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0;const r=[],s=this._levelToLOD={};e&&(t=-1/0,i=1/0,e.forEach(e=>{r.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,s[e.level]=e})),this._set("scales",r),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const i=Math.floor(e),r=i+1;return t[i]/(t[i]/t[r])**(e-i)}scaleToZoom(e){const t=this.scales,i=t.length-1;let r=0;for(;r<i;r++){const i=t[r],s=t[r+1];if(i<=e)return r;if(s===e)return r+1;if(i>e&&s<e)return r+Math.log(i/e)/Math.log(i/s)}return r}tileAt(e,t,i,r){const s=this.lodAt(e);if(!s)return null;let o,l;if("number"==typeof t)o=t,l=i;else if((0,h.aI)(t.spatialReference,this.spatialReference))o=t.x,l=t.y,r=i;else{const e=(0,g.Cv)(t,this.spatialReference);if(null==e)return null;o=e.x,l=e.y,r=i}const n=s.resolution*this.size[0],a=s.resolution*this.size[1];return r??=new y.U(0,0,0),r.level=e,r.row=Math.floor((this.origin.y-l)/a+.001),r.col=Math.floor((o-this.origin.x)/n+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=0){if(!("extent"in e))return!1;let i=this.lodAt(e.level);if(!i&&1===t){const t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return!1;const r=e.level-i.level,s=i.resolution*this.size[0]/2**r,o=i.resolution*this.size[1]/2**r;return e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*o,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+o,!0}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const i=this.lodAt(t.level);if(null==i)return null;const{resolution:r}=i,s=r*this.size[0],o=r*this.size[1];return e[0]=this.origin.x+t.col*s,e[1]=this.origin.y-(t.row+1)*o,e[2]=e[0]+s,e[3]=e[1]+o,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return r.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const t=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===t)return this;const i=[],s=this.lods.length-t;for(let e=0;e<s;e++){const r=e+t,{scale:s,resolution:o}=r>=0?this.lods[r]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};i.push(new d.A({level:e,scale:s,resolution:o}))}return new r({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:i})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let i=0;i<e.length;i++){const r=e[i];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};(0,s.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],b.prototype,"compressionQuality",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],b.prototype,"dpi",void 0),(0,s.Cg)([(0,a.MZ)({type:String,json:{read:f.read,write:f.write,origins:{"web-scene":{read:!1,write:!1}}}})],b.prototype,"format",void 0),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],b.prototype,"isWrappable",null),(0,s.Cg)([(0,a.MZ)({type:u.A,json:{write:!0}})],b.prototype,"origin",void 0),(0,s.Cg)([(0,w.w)("origin")],b.prototype,"readOrigin",null),(0,s.Cg)([(0,a.MZ)({type:[d.A],value:null,json:{write:!0}})],b.prototype,"lods",null),(0,s.Cg)([(0,a.MZ)({readOnly:!0})],b.prototype,"scales",void 0),(0,s.Cg)([(0,a.MZ)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],b.prototype,"size",void 0),(0,s.Cg)([(0,w.w)("size",["rows","cols"])],b.prototype,"readSize",null),(0,s.Cg)([(0,v.K)("size",{cols:{type:c.jz},rows:{type:c.jz}})],b.prototype,"writeSize",null),(0,s.Cg)([(0,a.MZ)({type:p.A,json:{write:!0}})],b.prototype,"spatialReference",void 0),b=r=(0,s.Cg)([(0,a.$K)("esri.layers.support.TileInfo")],b)},91806(e,t,i){i.d(t,{A:()=>a});var r,s=i(5482),o=i(25482),l=i(91429),n=i(56507);let a=class extends o.o{static{r=this}constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new r({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,s.Cg)([(0,l.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],a.prototype,"cols",void 0),(0,s.Cg)([(0,l.MZ)({type:n.jz,json:{write:!0}})],a.prototype,"level",void 0),(0,s.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],a.prototype,"levelValue",void 0),(0,s.Cg)([(0,l.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],a.prototype,"origin",void 0),(0,s.Cg)([(0,l.MZ)({type:Number,json:{write:!0}})],a.prototype,"resolution",void 0),(0,s.Cg)([(0,l.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],a.prototype,"rows",void 0),(0,s.Cg)([(0,l.MZ)({type:Number,json:{write:!0}})],a.prototype,"scale",void 0),a=r=(0,s.Cg)([(0,l.$K)("esri.layers.support.LOD")],a)}}]);