UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 3.97 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 r from"../../PopupTemplate.js";import t from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{setDeepValue as s}from"../../core/object.js";import{toPt as i}from"../../core/screenUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureNumber as l}from"../../core/accessorSupport/ensureType.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import d from"./AggregateField.js";import{popupEnabled as m,labelsVisible as c}from"./commonProperties.js";import{createDefaultRenderer as f}from"./featureLayerUtils.js";import y from"./LabelClass.js";import b from"../../renderers/SimpleRenderer.js";import{read as h}from"../../renderers/support/jsonUtils.js";import{rendererTypes as j}from"../../renderers/support/typeUtils.js";import{symbolTypesCluster as g}from"../../symbols/support/typeUtils.js";var S;function w(e){return"simple"===e.type&&!e.visualVariables?.length}let I=S=class extends t{constructor(e){super(e),this.type="cluster",this.clusterRadius=i("80px"),this.clusterMinSize=i("12px"),this.clusterMaxSize=i("50px"),this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.renderer=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=[]}readRenderer(e,r,t){const o=r.drawingInfo?.renderer;return o?.authoringInfo?.isAutoGenerated?null:o?w(o)?null:h(o,r,t)??void 0:f(r,t)}readSymbol(e,r,t){const o=r.drawingInfo?.renderer;if(o?.authoringInfo?.isAutoGenerated)return null;if(o&&w(o)){const e=h(o,r,t);return e?.symbol}return null}writeSymbol(e,r,t,o){const s=this.renderer?.authoringInfo?.isAutoGenerated;if(!this.renderer||s){const t=new b({symbol:e});r.drawingInfo={renderer:t.write({},o)}}}writeFields(e,r,t){const o=e.filter((e=>"avg_angle"!==e.statisticType)).map((e=>e.toJSON()));s(t,o,r)}readFields(e,r,t){return e.filter((e=>!e.isAutoGenerated)).map((e=>d.fromJSON(e)))}clone(){return new S({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:o(this.labelingInfo),labelsVisible:this.labelsVisible,fields:o(this.fields),maxScale:this.maxScale,renderer:o(this.renderer),symbol:o(this.symbol),popupEnabled:this.popupEnabled,popupTemplate:o(this.popupTemplate)})}};e([p({type:["cluster"],readOnly:!0,json:{write:!0}})],I.prototype,"type",void 0),e([p({cast:e=>"auto"===e?e:l(i(e)),json:{write:!0}})],I.prototype,"clusterRadius",void 0),e([p({type:Number,cast:i,json:{write:!0}})],I.prototype,"clusterMinSize",void 0),e([p({type:Number,cast:i,json:{write:!0}})],I.prototype,"clusterMaxSize",void 0),e([p({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],I.prototype,"maxScale",void 0),e([p(m)],I.prototype,"popupEnabled",void 0),e([p({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],I.prototype,"popupTemplate",void 0),e([p({types:j,json:{write:{target:"drawingInfo.renderer"}}})],I.prototype,"renderer",void 0),e([n("renderer",["drawingInfo.renderer"])],I.prototype,"readRenderer",null),e([p({types:g})],I.prototype,"symbol",void 0),e([n("symbol",["drawingInfo.renderer"])],I.prototype,"readSymbol",null),e([u("symbol")],I.prototype,"writeSymbol",null),e([p({type:[y],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],I.prototype,"labelingInfo",void 0),e([p(c)],I.prototype,"labelsVisible",void 0),e([p({type:[d],json:{write:!0}})],I.prototype,"fields",void 0),e([u("fields")],I.prototype,"writeFields",null),e([n("fields")],I.prototype,"readFields",null),I=S=e([a("esri.layers.support.FeatureReductionCluster")],I);export{I as default};