UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.13 kB
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import{JSONMap as o}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 i}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../geometry/Polygon.js";import p from"../../geometry/SpatialReference.js";import{getJsonType as a}from"../../geometry/support/jsonUtils.js";const c=new o({9001:"meters",9002:"feet",9036:"kilometers",9093:"miles",109012:"nautical-miles",109001:"yards"});let u=class extends s{constructor(e){super(e),this.bufferSpatialReference=null,this.distances=null,this.geodesic=!1,this.geometries=null,this.outSpatialReference=null,this.unionResults=!1,this.unit=null}toJSON(){const e={unit:c.toJSON(this.unit),unionResults:this.unionResults,geodesic:this.geodesic},t=this.distances,o=this.outSpatialReference,s=this.bufferSpatialReference,r=this.geometries;if(r&&r.length>0){const t=r.map((e=>(e="extent"===e.type?n.fromExtent(e):e).toJSON())),o="extent"===r[0].type?"esriGeometryPolygon":a(r[0]);e.geometries=JSON.stringify({geometryType:o,geometries:t}),e.inSR=r[0].spatialReference.wkid?r[0].spatialReference.wkid:JSON.stringify(r[0].spatialReference.toJSON())}return t&&(e.distances=t.join(",")),o&&(e.outSR=o.wkid?o.wkid:JSON.stringify(o.toJSON())),s&&(e.bufferSR=s.wkid?s.wkid:JSON.stringify(s.toJSON())),e}};e([r({type:p,json:{write:!0}})],u.prototype,"bufferSpatialReference",void 0),e([r({type:[Number],json:{write:!0}})],u.prototype,"distances",void 0),e([r({type:Boolean,json:{write:!0}})],u.prototype,"geodesic",void 0),e([r({types:[t],json:{write:!0}})],u.prototype,"geometries",void 0),e([r({type:p,json:{write:!0}})],u.prototype,"outSpatialReference",void 0),e([r({type:Boolean,json:{write:!0}})],u.prototype,"unionResults",void 0),e([r({type:String,json:{write:!0}})],u.prototype,"unit",void 0),u=e([i("esri.rest.support.BufferParameters")],u);const l=u;export{l as default};