UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.8 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as s,subclass as n}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Extent.js";import r from"../../geometry/Geometry.js";import i from"../../geometry/Polygon.js";import{fromJSON as a}from"../../geometry/support/jsonUtils.js";import l from"./DimensionalDefinition.js";var m;const p={base:r,key:"type",typeMap:{extent:o,polygon:i}};let u=m=class extends t{constructor(e){super(e),this.areaOfInterest=null,this.subsetDefinitions=null}get dimensions(){const{subsetDefinitions:e}=this;if(null==e||0===e.length)return[];const t=new Map;e.forEach(e=>{if(!e.dimensionName)return;let s,n;if(Array.isArray(e.values[0])){const t=e.values;s=t[0][0],n=t[e.values.length-1][1]}else{const t=e.values;s=t[0],n=t[e.values.length-1]}if(t.has(e.dimensionName)){const o=t.get(e.dimensionName);o[0]=Math.min(s,o[0]),o[1]=Math.max(n,o[1])}else t.set(e.dimensionName,[s,n])});const s=[];for(const n of t)s.push({name:n[0],extent:n[1]});return s}get variables(){const{subsetDefinitions:e}=this;if(null==e||0===e.length)return[];const t=new Set;return e.forEach(e=>{e.variableName&&t.add(e.variableName)}),[...t]}clone(){const e=this.subsetDefinitions?.map(e=>e.clone()),t=this.areaOfInterest?this.areaOfInterest.clone():this.areaOfInterest;return new m({areaOfInterest:t,subsetDefinitions:e})}};e([s({types:p,json:{read:a,write:!0}})],u.prototype,"areaOfInterest",void 0),e([s({readOnly:!0})],u.prototype,"dimensions",null),e([s({readOnly:!0})],u.prototype,"variables",null),e([s({type:[l],json:{write:!0}})],u.prototype,"subsetDefinitions",void 0),u=m=e([n("esri.layers.support.MultidimensionalSubset")],u);export{u as default};