UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.91 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as o,subclass as r}from"../../core/accessorSupport/decorators.js";import s from"../../geometry/Polygon.js";import i from"../../geometry/SpatialReference.js";import{getJsonType as p}from"../../geometry/support/jsonTypeUtils.js";import{srToRESTValue as n}from"../../geometry/support/spatialReferenceUtils.js";import{geometryTypes as u}from"../../geometry/support/typeUtils.js";import{geometryOperationLengthUnitKebabDict as l}from"./geometryOperationLengthUnit.js";let m=class extends t{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:l.toJSON(this.unit),unionResults:this.unionResults,geodesic:this.geodesic},t=this.distances,o=this.outSpatialReference,r=this.bufferSpatialReference,i=this.geometries;if(i&&i.length>0){const t=i.map(e=>(e="extent"===e.type?s.fromExtent(e):e).toJSON()),o="extent"===i[0].type?"esriGeometryPolygon":p(i[0]);e.geometries=JSON.stringify({geometryType:o,geometries:t}),e.inSR=n(i[0].spatialReference)}return t&&(e.distances=t.join(",")),o&&(e.outSR=n(o)),r&&(e.bufferSR=n(r)),e}};e([o({type:i,json:{write:!0}})],m.prototype,"bufferSpatialReference",void 0),e([o({type:[Number],json:{write:!0}})],m.prototype,"distances",void 0),e([o({type:Boolean,json:{write:!0}})],m.prototype,"geodesic",void 0),e([o({types:[u],json:{write:!0}})],m.prototype,"geometries",void 0),e([o({type:i,json:{write:!0}})],m.prototype,"outSpatialReference",void 0),e([o({type:Boolean,json:{write:!0}})],m.prototype,"unionResults",void 0),e([o({type:String,json:{write:!0}})],m.prototype,"unit",void 0),m=e([r("esri.rest.support.BufferParameters")],m);const a=m;export{a as default};