2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
import{bm as $,dO as w,bn as I,dP as T,dp as O,dq as E,dr as M,dn as R,dQ as F,dR as P,bv as L,dF as b,a$ as g,dS as j,ar as f,ab as q,dT as U,dU as J,dV as N,s as v,v as A,A as i,B as n,dW as x,a8 as _,a9 as k,du as V,C as z,bq as B,dX as C}from"./index-b5c8f851.js";import{i as W}from"./scaleUtils-7ebacf58.js";import{E as Z,f as D,X as G}from"./SublayersOwner-8d05f713.js";import{m as H}from"./ExportImageParameters-c809fd97.js";import{t as K}from"./imageBitmapUtils-e0a2d322.js";import{e as S}from"./sublayerUtils-6837c2eb.js";import"./QueryTask-d8c13580.js";import"./executeForIds-8a8c155e.js";import"./query-cd419ad0.js";import"./pbfQueryUtils-e46c5add.js";import"./pbf-eb90fa42.js";import"./OptimizedGeometry-d94e541f.js";import"./OptimizedFeatureSet-1d1ac4b9.js";import"./executeQueryJSON-b554ead2.js";import"./executeQueryPBF-95281324.js";import"./featureConversionUtils-6aca8295.js";import"./floorFilterUtils-080a7cd2.js";let s=class extends $(w(I(Z(D(T(O(E(M(R(F(P(B)))))))))))){constructor(...e){super(...e),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}normalizeCtorArgs(e,a){return typeof e=="string"?{url:e,...a}:e}load(e){const a=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(L).then(()=>this._fetchService(a))),Promise.resolve(this)}readImageFormat(e,a){const l=a.supportedImageFormatTypes;return l&&l.includes("PNG32")?"png32":"png24"}writeSublayers(e,a,l,t){var h;if(!this.loaded||!e)return;const o=e.slice().reverse().flatten(({sublayers:r})=>r&&r.toArray().reverse()).toArray();let p=!1;if(this.capabilities&&this.capabilities.operations.supportsExportMap&&((h=this.capabilities.exportMap)!=null&&h.supportsDynamicLayers)){const r=b(t.origin);if(r===g.PORTAL_ITEM){const d=this.createSublayersForOrigin("service").sublayers;p=S(o,d,g.SERVICE)}else if(r>g.PORTAL_ITEM){const d=this.createSublayersForOrigin("portal-item");p=S(o,d.sublayers,b(d.origin))}}const m=[],y={writeSublayerStructure:p,...t};let c=p;o.forEach(r=>{const d=r.write({},y);m.push(d),c=c||r.originOf("visible")==="user"}),m.some(r=>Object.keys(r).length>1)&&(a.layers=m),c&&(a.visibleLayers=o.filter(r=>r.visible).map(r=>r.id))}createExportImageParameters(e,a,l,t){const o=(t==null?void 0:t.pixelRatio)||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian());const p=new H({layer:this,floors:t==null?void 0:t.floors,scale:W({extent:e,width:a})*o}),m=p.toJSON();p.destroy();const y=!(t!=null&&t.rotation)||this.version<10.3?{}:{rotation:-t.rotation},c=e==null?void 0:e.spatialReference,h=j(c);m.dpi*=o;const r={};if(t!=null&&t.timeExtent){const{start:d,end:u}=t.timeExtent.toJSON();r.time=d&&u&&d===u?""+d:`${d??"null"},${u??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(r.time="null,null");return{bbox:e&&e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:h,imageSR:h,size:a+","+l,...m,...y,...r}}async fetchImage(e,a,l,t){const{data:o}=await this._fetchImage("image",e,a,l,t);return o}async fetchImageBitmap(e,a,l,t){const{data:o,url:p}=await this._fetchImage("blob",e,a,l,t);return K(o,p,t==null?void 0:t.signal)}async fetchRecomputedExtents(e={}){const a={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:l}=await f(this.url,a),{extent:t,fullExtent:o,timeExtent:p}=l,m=t||o;return{fullExtent:m&&q.fromJSON(m),timeExtent:p&&U.fromJSON({start:p[0],end:p[1]})}}loadAll(){return J(this,e=>{e(this.allSublayers)})}serviceSupportsSpatialReference(e){return N(this,e)}async _fetchImage(e,a,l,t,o){var y,c,h;const p={responseType:e,signal:(o==null?void 0:o.signal)??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(a,l,t,o),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(((y=p.query)==null?void 0:y.dynamicLayers)!=null&&!((h=(c=this.capabilities)==null?void 0:c.exportMap)!=null&&h.supportsDynamicLayers))throw new v("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:p.query});try{const{data:r}=await f(m,p);return{data:r,url:m}}catch(r){throw A(r)?r:new v("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:r})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:a,ssl:l}=await f(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});l&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=a,this.read(a,{origin:"service",url:this.parsedUrl})}};i([n(x("dateFieldsTimeReference"))],s.prototype,"dateFieldsTimeZone",void 0),i([n({type:Boolean})],s.prototype,"datesInUnknownTimezone",void 0),i([n()],s.prototype,"dpi",void 0),i([n()],s.prototype,"gdbVersion",void 0),i([n()],s.prototype,"imageFormat",void 0),i([_("imageFormat",["supportedImageFormatTypes"])],s.prototype,"readImageFormat",null),i([n({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],s.prototype,"imageMaxHeight",void 0),i([n({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],s.prototype,"imageMaxWidth",void 0),i([n()],s.prototype,"imageTransparency",void 0),i([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],s.prototype,"isReference",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"labelsVisible",void 0),i([n({type:["ArcGISMapServiceLayer"]})],s.prototype,"operationalLayerType",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"popupEnabled",void 0),i([n(x("preferredTimeReference"))],s.prototype,"preferredTimeZone",void 0),i([n()],s.prototype,"sourceJSON",void 0),i([n({json:{write:{ignoreOrigin:!0}}})],s.prototype,"sublayers",void 0),i([k("sublayers",{layers:{type:[G]},visibleLayers:{type:[C]}})],s.prototype,"writeSublayers",null),i([n({type:["show","hide","hide-children"]})],s.prototype,"listMode",void 0),i([n({json:{read:!1},readOnly:!0,value:"map-image"})],s.prototype,"type",void 0),i([n(V)],s.prototype,"url",void 0),s=i([z("esri.layers.MapImageLayer")],s);const ye=s;export{ye as default};
|