UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 3.08 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../Color.js";import{clone as o}from"../core/lang.js";import{property as i,subclass as r}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as s}from"../layers/support/fieldUtils.js";import l from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import a from"./support/AttributeColorInfo.js";import u from"./support/DotDensityLegendOptions.js";import p from"../symbols/SimpleFillSymbol.js";import d from"../symbols/SimpleLineSymbol.js";import{enumeration as h}from"../core/accessorSupport/decorators/enumeration.js";var y;let c=y=class extends(n(l)){constructor(e){super(e),this.attributes=null,this.backgroundColor=new t([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new d,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(e){if(null==this.referenceScale)return this.dotValue;const t=e/this.referenceScale*this.dotValue;return t<1?1:t}getSymbol(){return new p({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return JSON.stringify(this.outline)}get visualVariables(){return super.visualVariables}set visualVariables(e){super.visualVariables=e}clone(){return new y({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),seed:o(this.seed),visualVariables:o(this.visualVariables),authoringInfo:o(this.authoringInfo)})}getControllerHash(){const e=this.attributes?.map(e=>e.field||e.valueExpression||"");return`${e}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const o of this.attributes??[])o.valueExpression&&await s(e,t,null,o.valueExpression),o.field&&e.add(o.field)}};e([i({type:[a],json:{write:!0}})],c.prototype,"attributes",void 0),e([i({type:t,json:{write:!0}})],c.prototype,"backgroundColor",void 0),e([i({type:Boolean,json:{write:!0}})],c.prototype,"dotBlendingEnabled",void 0),e([i({type:String,json:{write:!1}})],c.prototype,"dotShape",void 0),e([i({type:Number,json:{write:!0}})],c.prototype,"dotSize",void 0),e([i({type:u,json:{write:!0}})],c.prototype,"legendOptions",void 0),e([i({type:d,json:{default:null,write:!0}})],c.prototype,"outline",void 0),e([i({type:Number,json:{write:!0}})],c.prototype,"dotValue",void 0),e([i({type:Number,json:{write:!0}})],c.prototype,"referenceScale",void 0),e([i({type:Number,json:{write:!0}})],c.prototype,"seed",void 0),e([h({dotDensity:"dot-density"})],c.prototype,"type",void 0),c=y=e([r("esri.renderers.DotDensityRenderer")],c);export{c as default};