UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.15 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../geometry/Polygon.js";import i from"../../geometry/SpatialReference.js";import{getJsonType as p}from"../../geometry/support/jsonUtils.js";import{srToRESTValue as n}from"../../geometry/support/spatialReferenceUtils.js";import{geometryTypes as m}from"../../geometry/support/typeUtils.js";import{geometryOperationLengthUnitKebabDict as u}from"./geometryOperationLengthUnit.js";let a=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:u.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}})],a.prototype,"bufferSpatialReference",void 0),e([o({type:[Number],json:{write:!0}})],a.prototype,"distances",void 0),e([o({type:Boolean,json:{write:!0}})],a.prototype,"geodesic",void 0),e([o({types:[m],json:{write:!0}})],a.prototype,"geometries",void 0),e([o({type:i,json:{write:!0}})],a.prototype,"outSpatialReference",void 0),e([o({type:Boolean,json:{write:!0}})],a.prototype,"unionResults",void 0),e([o({type:String,json:{write:!0}})],a.prototype,"unit",void 0),a=e([r("esri.rest.support.BufferParameters")],a);const c=a;export{c as default};