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.
 
 

20 lines
8.5 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/string ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./Geometry ./Point ./SpatialReference ./support/contains ./support/intersectsBase ./support/spatialReferenceUtils ./support/webMercatorUtils".split(" "),function(k,D,l,h,I,J,E,F,G,z,C,H,w,t){function u(a,b,c){return null==b?c:null==c?b:a(b,c)}function A(a,b){const [c,f]=b.valid;b=2*f;var e=0;a>f?(e=Math.ceil(Math.abs(a-f)/b),
a-=e*b):a<c&&(e=Math.ceil(Math.abs(a-c)/b),a+=e*b,e=-e);return{x:a,frameId:e}}var p;h=p=class extends F{constructor(...a){super(...a);this.type="extent";this.ymin=this.xmin=0;this.zmin=this.mmin=void 0;this.ymax=this.xmax=0;this.zmax=this.mmax=void 0}normalizeCtorArgs(a,b,c,f,e){return!a||"esri.geometry.SpatialReference"!==a.declaredClass&&null==a.wkid?"object"===typeof a?(a.spatialReference=null==a.spatialReference?z.WGS84:a.spatialReference,a):{xmin:a,ymin:b,xmax:c,ymax:f,spatialReference:null==
e?z.WGS84:e}:{spatialReference:a,xmin:0,ymin:0,xmax:0,ymax:0}}static fromBounds(a,b){return new p({xmin:a[0],ymin:a[1],xmax:a[2],ymax:a[3],spatialReference:b})}static fromPoint(a){return new p({xmin:a.x,ymin:a.y,zmin:a.z,xmax:a.x,ymax:a.y,zmax:a.z,spatialReference:a.spatialReference})}get cache(){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");return{}}get center(){const a=new G({x:.5*(this.xmin+this.xmax),y:.5*(this.ymin+this.ymax),spatialReference:this.spatialReference});this.hasZ&&(a.z=.5*(this.zmin+this.zmax));this.hasM&&(a.m=.5*(this.mmin+this.mmax));return a}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(a){const b=
this.center;return null!=a.z&&this.hasZ?this.offset(a.x-b.x,a.y-b.y,a.z-b.z):this.offset(a.x-b.x,a.y-b.y)}clone(){const a=new p;a.xmin=this.xmin;a.ymin=this.ymin;a.xmax=this.xmax;a.ymax=this.ymax;a.spatialReference=this.spatialReference;null!=this.zmin&&(a.zmin=this.zmin,a.zmax=this.zmax);null!=this.mmin&&(a.mmin=this.mmin,a.mmax=this.mmax);return a}contains(a){if(!a)return!1;const b=this.spatialReference,c=a.spatialReference;b&&c&&!b.equals(c)&&t.canProject(b,c)&&(a=b.isWebMercator?t.geographicToWebMercator(a):
t.webMercatorToGeographic(a,!0));return"point"===a.type?C.extentContainsPoint(this,a):"extent"===a.type?C.extentContainsExtent(this,a):!1}equals(a){if(this===a)return!0;if(null==a)return!1;const b=this.spatialReference,c=a.spatialReference;b&&c&&!b.equals(c)&&t.canProject(b,c)&&(a=b.isWebMercator?t.geographicToWebMercator(a):t.webMercatorToGeographic(a,!0));return this.xmin===a.xmin&&this.ymin===a.ymin&&this.zmin===a.zmin&&this.mmin===a.mmin&&this.xmax===a.xmax&&this.ymax===a.ymax&&this.zmax===a.zmax&&
this.mmax===a.mmax}expand(a){a=.5*(1-a);var b=this.width*a;const c=this.height*a;this.xmin+=b;this.ymin+=c;this.xmax-=b;this.ymax-=c;this.hasZ&&(b=(this.zmax-this.zmin)*a,this.zmin+=b,this.zmax-=b);this.hasM&&(a*=this.mmax-this.mmin,this.mmin+=a,this.mmax-=a);return this}intersects(a){if(null==a)return!1;"mesh"===a.type&&(a=a.extent);const b=this.spatialReference,c=a.spatialReference;b&&c&&!w.equals(b,c)&&t.canProject(b,c)&&(a=b.isWebMercator?t.geographicToWebMercator(a):t.webMercatorToGeographic(a,
!0));return H.getFeatureExtentIntersector(a.type)(this,a)}normalize(){const a=this._normalize(!1,!0);return Array.isArray(a)?a:[a]}offset(a,b,c){this.xmin+=a;this.ymin+=b;this.xmax+=a;this.ymax+=b;null!=c&&(this.zmin+=c,this.zmax+=c);return this}shiftCentralMeridian(){return this._normalize(!0)}union(a){if(this===a)return this;this.xmin=Math.min(this.xmin,a.xmin);this.ymin=Math.min(this.ymin,a.ymin);this.xmax=Math.max(this.xmax,a.xmax);this.ymax=Math.max(this.ymax,a.ymax);if(this.hasZ||a.hasZ)this.zmin=
u(Math.min,this.zmin,a.zmin),this.zmax=u(Math.max,this.zmax,a.zmax);if(this.hasM||a.hasM)this.mmin=u(Math.min,this.mmin,a.mmin),this.mmax=u(Math.max,this.mmax,a.mmax);return this}intersection(a){if(this===a)return this;if(null==a||!this.intersects(a))return null;this.xmin=Math.max(this.xmin,a.xmin);this.ymin=Math.max(this.ymin,a.ymin);this.xmax=Math.min(this.xmax,a.xmax);this.ymax=Math.min(this.ymax,a.ymax);if(this.hasZ||a.hasZ)this.zmin=u(Math.max,this.zmin,a.zmin),this.zmax=u(Math.min,this.zmax,
a.zmax);if(this.hasM||a.hasM)this.mmin=u(Math.max,this.mmin,a.mmin),this.mmax=u(Math.min,this.mmax,a.mmax);return this}toJSON(a){return this.write({},a)}_shiftCM(a=w.getInfo(this.spatialReference)){if(!a||!this.spatialReference)return this;const b=this.spatialReference,c=this._getCM(a);if(c){const f=b.isWebMercator?t.webMercatorToGeographic(c):c;this.xmin-=c.x;this.xmax-=c.x;b.isWebMercator||(f.x=A(f.x,a).x);this.spatialReference=new z(D.replace((b.isWGS84?a.altTemplate:null)??a.wkTemplate,{Central_Meridian:f.x}))}return this}_getCM(a){let b=
null;const [c,f]=a.valid;a=this.xmin;const e=this.xmax;a>=c&&a<=f&&e>=c&&e<=f||(b=this.center);return b}_normalize(a,b,c){const f=this.spatialReference;if(!f)return this;c=c??w.getInfo(f);if(null==c)return this;const e=this._getParts(c).map(d=>d.extent);if(2>e.length)return e[0]||this;if(2<e.length)return a?this._shiftCM(c):this.set({xmin:c.valid[0],xmax:c.valid[1]});if(a)return this._shiftCM(c);if(b)return e;let g=!0,m=!0;e.forEach(d=>{d.hasZ||(g=!1);d.hasM||(m=!1)});return{rings:e.map(d=>{const q=
[[d.xmin,d.ymin],[d.xmin,d.ymax],[d.xmax,d.ymax],[d.xmax,d.ymin],[d.xmin,d.ymin]];if(g){var n=(d.zmax-d.zmin)/2;for(let r=0;r<q.length;r++)q[r].push(n)}if(m)for(d=(d.mmax-d.mmin)/2,n=0;n<q.length;n++)q[n].push(d);return q}),hasZ:g,hasM:m,spatialReference:f}}_getParts(a){let b=this.cache._parts;if(!b){b=[];const {ymin:n,ymax:r,spatialReference:v}=this;var c=this.width,f=this.xmin,e=this.xmax;a=a||w.getInfo(v);const [B,x]=a.valid;var g=A(this.xmin,a);var m=g.x,d=g.frameId;g=A(this.xmax,a);a=g.x;g=g.frameId;
var q=m===a&&0<c;if(c>2*x){c=new p(f<e?m:a,n,x,r,v);f=new p(B,n,f<e?a:m,r,v);e=new p(0,n,x,r,v);m=new p(B,n,0,r,v);a=[];q=[];c.contains(e)&&a.push(d);c.contains(m)&&q.push(d);f.contains(e)&&a.push(g);f.contains(m)&&q.push(g);for(let y=d+1;y<g;y++)a.push(y),q.push(y);b.push({extent:c,frameIds:[d]},{extent:f,frameIds:[g]},{extent:e,frameIds:a},{extent:m,frameIds:q})}else m>a||q?b.push({extent:new p(m,n,x,r,v),frameIds:[d]},{extent:new p(B,n,a,r,v),frameIds:[g]}):b.push({extent:new p(m,n,a,r,v),frameIds:[d]});
this.cache._parts=b}g=this.hasZ;c=this.hasM;if(g||c)for(d={},g&&(d.zmin=this.zmin,d.zmax=this.zmax),c&&(d.mmin=this.mmin,d.mmax=this.mmax),g=0;g<b.length;g++)b[g].extent.set(d);return b}};k.__decorate([l.property({readOnly:!0})],h.prototype,"cache",null);k.__decorate([l.property({readOnly:!0})],h.prototype,"center",null);k.__decorate([l.property({readOnly:!0})],h.prototype,"extent",null);k.__decorate([l.property({readOnly:!0,json:{write:{enabled:!1,overridePolicy:null}}})],h.prototype,"hasM",null);
k.__decorate([l.property({readOnly:!0,json:{write:{enabled:!1,overridePolicy:null}}})],h.prototype,"hasZ",null);k.__decorate([l.property({readOnly:!0})],h.prototype,"height",null);k.__decorate([l.property({readOnly:!0})],h.prototype,"width",null);k.__decorate([l.property({type:Number,json:{type:[Number,String],write:{enabled:!0,allowNull:!0}}})],h.prototype,"xmin",void 0);k.__decorate([l.property({type:Number,json:{write:!0}})],h.prototype,"ymin",void 0);k.__decorate([l.property({type:Number,json:{origins:{"web-scene":{write:!1}},
write:{overridePolicy(){return{enabled:this.hasM}}}}})],h.prototype,"mmin",void 0);k.__decorate([l.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy(){return{enabled:this.hasZ}}}}})],h.prototype,"zmin",void 0);k.__decorate([l.property({type:Number,json:{write:!0}})],h.prototype,"xmax",void 0);k.__decorate([l.property({type:Number,json:{write:!0}})],h.prototype,"ymax",void 0);k.__decorate([l.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy(){return{enabled:this.hasM}}}}})],
h.prototype,"mmax",void 0);k.__decorate([l.property({type:Number,json:{origins:{"web-scene":{write:!1}},write:{overridePolicy(){return{enabled:this.hasZ}}}}})],h.prototype,"zmax",void 0);h=p=k.__decorate([E.subclass("esri.geometry.Extent")],h);h.prototype.toJSON.isDefaultToJSON=!0;return h});