@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.47 kB
JavaScript
/*
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 r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import t from"../../core/Warning.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Polygon.js";import{canProjectWithoutEngine as n,projectPolygon as a}from"../../geometry/projectionUtils.js";var c;let p=c=class extends(o.JSONSupportMixin(r.ofType(i))){constructor(e){super(e)}clone(){return new c(this.items.map((e=>e.clone())))}write(e,r){return this.toJSON(r)}toJSON(e){const r=e?.layer?.spatialReference;return r?this.toArray().map((o=>{if(!r.equals(o.spatialReference)){if(!n(o.spatialReference,r))return e?.messages?.push(new t("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),null;const s=new i;a(o,s,r),o=s}const s=o.toJSON(e);return delete s.spatialReference,s})).filter((e=>null!=e)):this.toArray().map((r=>r.toJSON(e)))}static fromJSON(e,r){const o=new c;return e.forEach((e=>o.add(i.fromJSON(e,r)))),o}};p=c=e([s("esri.layers.support.PolygonCollection")],p);const l=p;export{l as default};