UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 16.4 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5],{5443(t,e,i){i.d(e,{A:()=>y});var s,n=i(5482),r=i(799),h=i(91429),a=i(91075),m=i(86738),o=i(16930),c=i(94078),l=i(12176),u=i(21325),x=i(28735);function f(t,e,i){return null==e?i:null==i?e:t(e,i)}let y=s=class extends a.A{constructor(...t){super(...t),this.type="extent",this.xmin=0,this.ymin=0,this.mmin=void 0,this.zmin=void 0,this.xmax=0,this.ymax=0,this.mmax=void 0,this.zmax=void 0}normalizeCtorArgs(t,e,i,s,n){return function(t){return t&&("esri.geometry.SpatialReference"===t.declaredClass||null!=t.wkid)}(t)?{spatialReference:t,xmin:0,ymin:0,xmax:0,ymax:0}:"object"==typeof t?(t.spatialReference=null==t.spatialReference?o.A.WGS84:t.spatialReference,t):{xmin:t,ymin:e,xmax:i,ymax:s,spatialReference:n??o.A.WGS84}}static fromPoint(t){return new s({xmin:t.x,ymin:t.y,zmin:t.z,xmax:t.x,ymax:t.y,zmax:t.z,spatialReference:t.spatialReference})}get cache(){return this.commitProperty("xmin"),this.commitProperty("ymin"),this.commitProperty("zmin"),this.commitProperty("mmin"),this.commitProperty("xmax"),this.commitProperty("ymax"),this.commitProperty("zmax"),this.commitProperty("mmax"),this.commitProperty("spatialReference"),{}}get center(){const t=new m.A({x:.5*(this.xmin+this.xmax),y:.5*(this.ymin+this.ymax),spatialReference:this.spatialReference});return this.hasZ&&(t.z=.5*(this.zmin+this.zmax)),this.hasM&&(t.m=.5*(this.mmin+this.mmax)),t}get extent(){return this.clone()}get hasM(){return null!=this.mmin&&null!=this.mmax}get hasZ(){return null!=this.zmin&&null!=this.zmax}get height(){return Math.abs(this.ymax-this.ymin)}get width(){return Math.abs(this.xmax-this.xmin)}centerAt(t){const e=this.center;return null!=t.z&&this.hasZ?this.offset(t.x-e.x,t.y-e.y,t.z-e.z):this.offset(t.x-e.x,t.y-e.y)}clone(){const t=new s;return t.xmin=this.xmin,t.ymin=this.ymin,t.xmax=this.xmax,t.ymax=this.ymax,t.spatialReference=this.spatialReference,null!=this.zmin&&(t.zmin=this.zmin,t.zmax=this.zmax),null!=this.mmin&&(t.mmin=this.mmin,t.mmax=this.mmax),t}contains(t){if(!t)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&(0,x.y7)(e,i)&&(t=e.isWebMercator?(0,x.Gh)(t):(0,x.ci)(t,!0)),"point"===t.type?(0,c.qz)(this,t):"extent"===t.type&&(0,c.gH)(this,t)}equals(t){if(this===t)return!0;if(null==t)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&(0,x.y7)(e,i)&&(t=e.isWebMercator?(0,x.Gh)(t):(0,x.ci)(t,!0)),this.xmin===t.xmin&&this.ymin===t.ymin&&this.zmin===t.zmin&&this.mmin===t.mmin&&this.xmax===t.xmax&&this.ymax===t.ymax&&this.zmax===t.zmax&&this.mmax===t.mmax}expand(t){const e=.5*(1-t),i=this.width*e,s=this.height*e;if(this.xmin+=i,this.ymin+=s,this.xmax-=i,this.ymax-=s,this.hasZ){const t=(this.zmax-this.zmin)*e;this.zmin+=t,this.zmax-=t}if(this.hasM){const t=(this.mmax-this.mmin)*e;this.mmin+=t,this.mmax-=t}return this}intersects(t){if(null==t)return!1;"mesh"===t.type&&(t=t.extent);const e=this.spatialReference,i=t.spatialReference;return e&&i&&!(0,u.aI)(e,i)&&(0,x.y7)(e,i)&&(t=e.isWebMercator?(0,x.Gh)(t):(0,x.ci)(t,!0)),(0,l.xK)(t.type)(this,t)}normalize(){const t=this._normalize(!1,!0);return Array.isArray(t)?t:[t]}offset(t,e,i){return this.xmin+=t,this.ymin+=e,this.xmax+=t,this.ymax+=e,null!=i&&(this.zmin+=i,this.zmax+=i),this}shiftCentralMeridian(){return this._normalize(!0)}union(t){return this===t||(this.xmin=Math.min(this.xmin,t.xmin),this.ymin=Math.min(this.ymin,t.ymin),this.xmax=Math.max(this.xmax,t.xmax),this.ymax=Math.max(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=f(Math.min,this.zmin,t.zmin),this.zmax=f(Math.max,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=f(Math.min,this.mmin,t.mmin),this.mmax=f(Math.max,this.mmax,t.mmax))),this}intersection(t){return this===t?this:null!=t&&this.intersects(t)?(this.xmin=Math.max(this.xmin,t.xmin),this.ymin=Math.max(this.ymin,t.ymin),this.xmax=Math.min(this.xmax,t.xmax),this.ymax=Math.min(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=f(Math.max,this.zmin,t.zmin),this.zmax=f(Math.min,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=f(Math.max,this.mmin,t.mmin),this.mmax=f(Math.min,this.mmax,t.mmax)),this):null}toJSON(t){return this.write({},t)}_shiftCM(t=(0,u.Vp)(this.spatialReference)){if(!t||!this.spatialReference)return this;const e=this.spatialReference,i=this._getCM(t);if(i){const s=e.isWebMercator?(0,x.ci)(i):i;this.xmin-=i.x,this.xmax-=i.x,e.isWebMercator||(s.x=p(s.x,t).x),this.spatialReference=new o.A((0,r.HC)((e.isWGS84?t.altTemplate:null)??t.wkTemplate,{Central_Meridian:s.x}))}return this}_getCM(t){let e=null;const[i,s]=t.valid,n=this.xmin,r=this.xmax;return n>=i&&n<=s&&r>=i&&r<=s||(e=this.center),e}_normalize(t,e,i){const s=this.spatialReference;if(!s)return this;const n=i??(0,u.Vp)(s);if(null==n)return this;const r=this._getParts(n).map(t=>t.extent);if(r.length<2)return r[0]||this;if(r.length>2)return t?this._shiftCM(n):this.set({xmin:n.valid[0],xmax:n.valid[1]});if(t)return this._shiftCM(n);if(e)return r;let h=!0,a=!0;return r.forEach(t=>{t.hasZ||(h=!1),t.hasM||(a=!1)}),{rings:r.map(t=>{const e=[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]];if(h){const i=(t.zmax-t.zmin)/2;for(let t=0;t<e.length;t++)e[t].push(i)}if(a){const i=(t.mmax-t.mmin)/2;for(let t=0;t<e.length;t++)e[t].push(i)}return e}),hasZ:h,hasM:a,spatialReference:s}}_getParts(t){let e=this.cache._parts;if(!e){e=[];const{ymin:i,ymax:n,spatialReference:r}=this,h=this.width,a=this.xmin,m=this.xmax;let o;t=t||(0,u.Vp)(r);const[c,l]=t.valid;o=p(this.xmin,t);const x=o.x,f=o.frameId;o=p(this.xmax,t);const y=o.x,z=o.frameId,d=x===y&&h>0;if(h>2*l){const t=new s(a<m?x:y,i,l,n,r),h=new s(c,i,a<m?y:x,n,r),o=new s(0,i,l,n,r),u=new s(c,i,0,n,r),p=[],d=[];t.contains(o)&&p.push(f),t.contains(u)&&d.push(f),h.contains(o)&&p.push(z),h.contains(u)&&d.push(z);for(let t=f+1;t<z;t++)p.push(t),d.push(t);e.push({extent:t,frameIds:[f]},{extent:h,frameIds:[z]},{extent:o,frameIds:p},{extent:u,frameIds:d})}else x>y||d?e.push({extent:new s(x,i,l,n,r),frameIds:[f]},{extent:new s(c,i,y,n,r),frameIds:[z]}):e.push({extent:new s(x,i,y,n,r),frameIds:[f]});this.cache._parts=e}const i=this.hasZ,n=this.hasM;if(i||n){const t={};i&&(t.zmin=this.zmin,t.zmax=this.zmax),n&&(t.mmin=this.mmin,t.mmax=this.mmax);for(let i=0;i<e.length;i++)e[i].extent.set(t)}return e}};function p(t,e){const[i,s]=e.valid,n=2*s;let r,h=0;return t>s?(r=Math.ceil(Math.abs(t-s)/n),t-=r*n,h=r):t<i&&(r=Math.ceil(Math.abs(t-i)/n),t+=r*n,h=-r),{x:t,frameId:h}}(0,n.Cg)([(0,h.MZ)({readOnly:!0})],y.prototype,"cache",null),(0,n.Cg)([(0,h.MZ)({readOnly:!0})],y.prototype,"center",null),(0,n.Cg)([(0,h.MZ)({readOnly:!0})],y.prototype,"extent",null),(0,n.Cg)([(0,h.MZ)({readOnly:!0,json:{write:{enabled:!1,overridePolicy:null}}})],y.prototype,"hasM",null),(0,n.Cg)([(0,h.MZ)({readOnly:!0,json:{write:{enabled:!1,overridePolicy:null}}})],y.prototype,"hasZ",null),(0,n.Cg)([(0,h.MZ)({readOnly:!0})],y.prototype,"height",null),(0,n.Cg)([(0,h.MZ)({type:o.A,json:{write:!0},value:o.A.WGS84})],y.prototype,"spatialReference",void 0),(0,n.Cg)([(0,h.MZ)({readOnly:!0})],y.prototype,"width",null),(0,n.Cg)([(0,h.MZ)({type:Number,json:{type:[Number,String],write:{enabled:!0,allowNull:!0}}})],y.prototype,"xmin",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{write:!0}})],y.prototype,"ymin",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{origins:{"web-scene":{write:!1}},read:t=>t??void 0,write:{overridePolicy(){return{enabled:this.hasM}}}}})],y.prototype,"mmin",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy(){return{enabled:this.hasZ}}}}})],y.prototype,"zmin",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{write:!0}})],y.prototype,"xmax",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{write:!0}})],y.prototype,"ymax",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{origins:{"web-scene":{write:!1}},read:t=>t??void 0,write:{overridePolicy(){return{enabled:this.hasM}}}}})],y.prototype,"mmax",void 0),(0,n.Cg)([(0,h.MZ)({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy(){return{enabled:this.hasZ}}}}})],y.prototype,"zmax",void 0),y=s=(0,n.Cg)([(0,h.$K)("esri.geometry.Extent")],y),y.prototype.toJSON.isDefaultToJSON=!0},12176(t,e,i){i.d(e,{Ql:()=>p,fA:()=>x,xB:()=>r,xK:()=>z});var s=i(94078);function n(t,e){return(0,s.qz)(t,e)}function r(t,e){const i=t.hasZ&&e.hasZ;let s,n,r;if(t.xmin<=e.xmin){if(s=e.xmin,t.xmax<s)return!1}else if(s=t.xmin,e.xmax<s)return!1;if(t.ymin<=e.ymin){if(n=e.ymin,t.ymax<n)return!1}else if(n=t.ymin,e.ymax<n)return!1;if(i&&e.hasZ)if(t.zmin<=e.zmin){if(r=e.zmin,t.zmax<r)return!1}else if(r=t.zmin,e.zmax<r)return!1;return!0}function h(t,e){const{points:i,hasZ:n}=e,r=n?s.F8:s.CW;for(const e of i)if(r(t,e))return!0;return!1}const a=[0,0],m=[0,0],o=[0,0],c=[0,0],l=[a,m,o,c],u=[[o,a],[a,m],[m,c],[c,o]];function x(t,e){return function(t,e){a[0]=t.xmin,a[1]=t.ymax,m[0]=t.xmax,m[1]=t.ymax,o[0]=t.xmin,o[1]=t.ymin,c[0]=t.xmax,c[1]=t.ymin;for(const t of l)if((0,s.t1)(e,t))return!0;for(const i of e){if(!i.length)continue;let e=i[0];if((0,s.CW)(t,e))return!0;for(let n=1;n<i.length;n++){const r=i[n];if((0,s.CW)(t,r)||y(e,r,u))return!0;e=r}}return!1}(t,e.rings)}function f(t,e){a[0]=t.xmin,a[1]=t.ymax,m[0]=t.xmax,m[1]=t.ymax,o[0]=t.xmin,o[1]=t.ymin,c[0]=t.xmax,c[1]=t.ymin;const i=e.paths;for(const e of i){if(!i.length)continue;let n=e[0];if((0,s.CW)(t,n))return!0;for(let i=1;i<e.length;i++){const r=e[i];if((0,s.CW)(t,r)||y(n,r,u))return!0;n=r}}return!1}function y(t,e,i){for(let s=0;s<i.length;s++)if(p(t,e,i[s][0],i[s][1]))return!0;return!1}function p(t,e,i,s,n){const[r,h]=t,[a,m]=e,[o,c]=i,[l,u]=s,x=l-o,f=r-o,y=a-r,p=u-c,z=h-c,d=m-h,_=p*y-x*d;if(0===_)return!1;const g=(x*z-p*f)/_,M=(y*z-d*f)/_;return g>=0&&g<=1&&M>=0&&M<=1&&(n&&(n[0]=r+g*(a-r),n[1]=h+g*(m-h)),!0)}function z(t){switch(t){case"esriGeometryEnvelope":case"extent":return r;case"esriGeometryMultipoint":case"multipoint":return h;case"esriGeometryPoint":case"point":return n;case"esriGeometryMultiPatch":case"multipatch":case"esriGeometryPolygon":case"polygon":return x;case"esriGeometryPolyline":case"polyline":return f}}},44123(t,e,i){i.d(e,{WhereClauseCache:()=>r});var s=i(66344),n=i(89696);class r{constructor(t,e){this._cache=new s.q(t),this._invalidCache=new s.q(e)}get(t,e){const i=`${e?.uid}:${t}`,s=this._cache.get(i);if(s)return s;if(null!=this._invalidCache.get(i))return null;try{const s=n.A.create(t,{fieldsIndex:e});return this._cache.put(i,s),s}catch(t){return this._invalidCache.put(i,t),null}}getError(t,e){const i=`${e?.uid}:${t}`;return this._invalidCache.get(i)??null}}},66344(t,e,i){i.d(e,{q:()=>a});const s=!!(0,i(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class n{get size(){return this._size}constructor(t=10485760){this._maxSize=t,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._users=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._users.clear(),this._db.clear()}register(t){this._users.set(t.id.slice(0,-1),t)}deregister(t){this.clear(t),this._sizeLimits.delete(t),this._users.delete(t.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,e){const i=this._db.get(t.id+e);return i?.size??0}put(t,e,i,n,h){e=t.id+e;const a=this._db.get(e);if(a&&(this._size-=a.size,t.size-=a.size,this._db.delete(e),a.entry!==i&&this._notifyRemove(e,a.entry,a.size,0)),n>this._maxSize)return void this._notifyRemove(e,i,n,0);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!n||n<0)return s||console.warn(`Refusing to cache entry with size ${n} for key ${e}`),void this._notifyRemove(e,i,0,0);const m=1+Math.max(h,-4)- -3;this._db.set(e,new r(i,n,m)),this._size+=n,t.size+=n,this._checkSize()}updateSize(t,e){e=t.id+e;const i=this._db.get(e);if(!i)return;this._size-=i.size,t.size-=i.size;let s=i.entry.usedMemory;for(;s>this._maxSize;){const t=this._notifyRemove(e,i.entry,s,1);if(!(null!=t&&t>0))return void this._db.delete(e);s=t}i.size=s,this._size+=s,t.size+=s,this._checkSize()}pop(t,e){e=t.id+e;const i=this._db.get(e);if(i)return this._size-=i.size,t.size-=i.size,this._db.delete(e),++this._hit,i.entry;++this._miss}get(t,e){e=t.id+e;const i=this._db.get(e);if(void 0!==i)return this._db.delete(e),i.lives=i.lifetime,this._db.set(e,i),++this._hit,i.entry;++this._miss}peek(t,e){const i=this._db.get(t.id+e);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},e={},i=new Array;this._db.forEach((t,s)=>{const n=t.lifetime;i[n]=(i[n]||0)+t.size,this._users.forEach(i=>{const{id:n,name:r}=i;if(s.startsWith(n)){const i=e[r]||0;e[r]=i+t.size}})});const s={};this._users.forEach(t=>{const i=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const n=e[i]||0;e[i]=n,s[i]=Math.round(100*t.hitRate)+"%"}else s[i]="0%"});const n=Object.keys(e);n.sort((t,i)=>e[i]-e[t]),n.forEach(i=>t[i]=Math.round(e[i]/2**20)+"MB / "+s[i]);for(let e=i.length-1;e>=0;--e){const s=i[e];s&&(t["Priority "+(e+-3-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forEach(t=>t.resetHitRate())}clear(t){const e=t.id;this._db.forEach((t,i)=>{i.startsWith(e)&&(this._size-=t.size,this._db.delete(i),this._notifyRemove(i,t.entry,t.size,0))}),t.size=0}clearAll(){this._db.forEach((t,e)=>this._notifyRemove(e,t.entry,t.size,0)),this._users.forEach(t=>t.size=0),this._size=0,this._db.clear()}*values(t){for(const[e,i]of this._db)e.startsWith(t.id)&&(yield i.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,i,s){const n=this._users.get(t.split(h)[0])?.removeFunc,r=n?.(e,s,i);return"number"==typeof r?r:null}_checkSize(){this._sizeLimits.forEach((t,e)=>this._checkSizeLimits(t,e)),this._checkSizeLimits(this.maxSize)}setMaxSize(t,e){null==e||e<=0?this._sizeLimits.delete(t):this._sizeLimits.set(t,e)}_checkSizeLimits(t,e){const i=e??this;if(i.size<=t)return;const s=e?.id;let n=!0;for(;n;){n=!1;for(const[r,a]of this._db)if(0===a.lifetime&&(!s||r.startsWith(s))){const s=e??this._users.get(r.split(h)[0]);if(this._purgeItem(r,a,s),i.size<=.9*t)return;n||=this._db.has(r)}}for(const[n,r]of this._db)if(!s||n.startsWith(s)){const s=e??this._users.get(n.split(h)[0]);if(this._purgeItem(n,r,s),i.size<=.9*t)return}}_purgeItem(t,e,i){if(this._db.delete(t),e.lives<=1){this._size-=e.size,i&&(i.size-=e.size);const s=this._notifyRemove(t,e.entry,e.size,1);null!=s&&s>0&&(this._size+=s,i&&(i.size+=s),e.lives=e.lifetime,e.size=s,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}new n(0);class r{constructor(t,e,i){this.entry=t,this.size=e,this.lifetime=i,this.lives=i}}const h=":";class a{constructor(t,e){this.removeFunc=e,this._storage=new n,this.id="",this.name="",this.size=0,this._storage.maxSize=t,this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy(),this._storage=null}put(t,e,i=1){this._storage.put(this,t,e,i,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}},94078(t,e,i){i.d(e,{CW:()=>a,F8:()=>m,gH:()=>h,m3:()=>c,qz:()=>n,rL:()=>r,t1:()=>l});const s=[0,0];function n(t,e){return null!=e&&o(t,e.x,e.y,e.z)}function r(t,e){if(!e.points?.length)return!1;for(const i of e.points)if(!a(t,i))return!1;return!0}function h(t,e){const{xmin:i,ymin:s,zmin:n,xmax:r,ymax:h,zmax:a}=e;return t.hasZ&&e.hasZ?o(t,i,s,n)&&o(t,i,h,n)&&o(t,r,h,n)&&o(t,r,s,n)&&o(t,i,s,a)&&o(t,i,h,a)&&o(t,r,h,a)&&o(t,r,s,a):o(t,i,s)&&o(t,i,h)&&o(t,r,h)&&o(t,r,s)}function a(t,e){return o(t,e[0],e[1])}function m(t,e){return o(t,e[0],e[1],e[2])}function o(t,e,i,s){return e>=t.xmin&&e<=t.xmax&&i>=t.ymin&&i<=t.ymax&&(null==s||!t.hasZ||s>=t.zmin&&s<=t.zmax)}function c(t,e){return s[1]=e.y,s[0]=e.x,function(t,e){return l(t.rings,e)}(t,s)}function l(t,e){if(!t||t.length<1)return!1;if(function(t){return!Array.isArray(t[0][0])}(t))return u(!1,t,e);let i=!1;for(let s=0,n=t.length;s<n;s++)i=u(i,t[s],e);return i}function u(t,e,i){const[s,n]=i;let r=t,h=0;for(let t=0,i=e.length;t<i;t++){h++,h===i&&(h=0);const[a,m]=e[t],[o,c]=e[h];(m<n&&c>=n||c<n&&m>=n)&&a+(n-m)/(c-m)*(o-a)<s&&(r=!r)}return r}}}]);