UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 1.83 kB
import{_ as e}from"../../chunks/tslib.es6.js";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Polygon.js";const a=new t({preserveShape:"preserve-shape",planar:"planar",geodesic:"geodesic"}),n=new t({esriAcres:"acres",esriHectares:"hectares",esriSquareMiles:"square-miles",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareFeet:"square-feet",esriSquareYards:"square-yards",esriAres:"ares"}),p=new t({9001:"meters",9002:"feet",9036:"kilometers",9093:"miles",109012:"nautical-miles",109001:"yards"});let l=class extends s{constructor(e){super(e),this.areaUnit=null,this.calculationType=null,this.lengthUnit=null,this.polygons=null}toJSON(){const e={};if(this.polygons&&this.polygons.length>0){const t=this.polygons.map((e=>e.toJSON()));e.polygons=JSON.stringify(t);const s=this.polygons[0].spatialReference;e.sr=s.wkid?s.wkid:JSON.stringify(s.toJSON())}if(this.lengthUnit&&(e.lengthUnit=p.toJSON(this.lengthUnit)),this.areaUnit){const t=n.toJSON(this.areaUnit);e.areaUnit="string"==typeof t?JSON.stringify({areaUnit:t}):t}return this.calculationType&&(e.calculationType=a.toJSON(this.calculationType)),e}};e([r({type:String,json:{write:!0}})],l.prototype,"areaUnit",void 0),e([r({type:String,json:{write:!0}})],l.prototype,"calculationType",void 0),e([r({type:String,json:{write:!0}})],l.prototype,"lengthUnit",void 0),e([r({type:[i],json:{write:!0}})],l.prototype,"polygons",void 0),l=e([o("esri.rest.support.AreasAndLengthsParameters")],l);const c=l;export{c as default};