@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.49 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"./Analysis.js";import t from"./SlicePlane.js";import{SliceAnalysisExcludedLayer as o}from"./Slice/SliceAnalysisExcludedLayer.js";import s from"../core/Collection.js";import{referenceSetter as l,castForReferenceSetter as a}from"../core/collectionUtils.js";import{equalsShallow as i}from"../core/lang.js";import{equalsMaybe as d}from"../core/maybe.js";import{property as c,subclass as n}from"../core/accessorSupport/decorators.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";let y=class extends r{constructor(e){super(e),this.type="slice",this.tiltEnabled=!1,this.shape=null,this.excludeGroundSurface=!1}get excludedLayers(){return this._get("excludedLayers")||new s}set excludedLayers(e){this._set("excludedLayers",l(e,this._get("excludedLayers")))}writeExcludedLayers(e,r,t,s){0!==e.length&&(r[t]=e.toArray().map(e=>o.fromLayer(e).toJSON(s)))}readExcludedLayers(e,r,t){const s=t?.initiator;s&&t?.hooks?.onAfterLoad(async()=>{for(const r of e){const{layerId:e,sublayerId:l}=o.fromJSON(r,t),a=s.allLayers.find(({id:r})=>r===e);if(a)if(null!=l&&"allSublayers"in a){await a.load();const e=a.allSublayers.find(({id:e})=>e===l);e&&"type"in e&&"building-component"===e.type&&this.excludedLayers.add(e)}else this.excludedLayers.add(a)}})}get valid(){return null!=this.shape?.position}equals(e){return this===e||super.equals(e)&&d(this.shape,e.shape)&&this.tiltEnabled===e.tiltEnabled&&i(this.excludedLayers.toArray(),e.excludedLayers.toArray())&&this.excludeGroundSurface===e.excludeGroundSurface}clear(){this.shape=null}};e([c({type:["slice"],json:{read:!1,write:{isRequired:!0}}})],y.prototype,"type",void 0),e([c({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],y.prototype,"tiltEnabled",void 0),e([c({types:{key:"type",base:null,typeMap:{plane:t},defaultKeyValue:"plane"},json:{write:{isRequired:!0}}})],y.prototype,"shape",void 0),e([c({cast:a,clonable:e=>e.slice(),json:{type:[o],write:!0}})],y.prototype,"excludedLayers",null),e([u("excludedLayers")],y.prototype,"writeExcludedLayers",null),e([p("excludedLayers")],y.prototype,"readExcludedLayers",null),e([c({type:Boolean,nonNullable:!0,json:{write:!0}})],y.prototype,"excludeGroundSurface",void 0),e([c({readOnly:!0})],y.prototype,"valid",null),y=e([n("esri.analysis.SliceAnalysis")],y);const f=y;export{f as default};