UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 4.54 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 t}from"../chunks/tslib.es6.js";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as o}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{collectField as p,collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import m from"./support/AuthoringInfo.js";import u from"./support/HeatmapColorStop.js";import{HeatmapLegendOptions as y}from"./support/HeatmapLegendOptions.js";import{kernelDensityRadiusPtToGaussianBlurRadiusPx as h,gaussianBlurRadiusPxToKernelDensityRadiusPt as c,magicKernelDensityRadiusInflationFactor as d}from"./support/heatmapUtils.js";import x from"../symbols/SimpleMarkerSymbol.js";var g;function f(t){if(null!=t){const{maxDensity:e,minDensity:i,radius:s}=t;if(null!=e||null!=i||null!=s){const{blurRadius:e,maxPixelIntensity:i,minPixelIntensity:s,...r}=t;return r}}return t}let w=g=class extends a{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new u({ratio:0,color:new e("rgba(255, 140, 0, 0)")}),new u({ratio:.75,color:new e("rgba(255, 140, 0, 1)")}),new u({ratio:.9,color:new e("rgba(255, 0, 0, 1)")})],this.field=null,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.radius=18,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null}normalizeCtorArgs(t){return f(t)}get blurRadius(){return h(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",c(t)),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity)}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity)}get _pixelIntensityToDensity(){return 24/(d**2*this.blurRadius**4)}read(t,e){t=f(t),super.read(t,e)}getSymbol(){return new x}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,s=this.valueExpression;i&&"string"==typeof i&&p(t,e,i),s&&"string"==typeof s&&await l(t,e,s)}getAttributeHash(){return""}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new g({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:i(this.colorStops),field:this.field,legendOptions:i(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};t([r({type:m,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],w.prototype,"authoringInfo",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"blurRadius",null),t([r({type:[u],json:{write:{isRequired:!0}}})],w.prototype,"colorStops",void 0),t([r({type:String,json:{write:!0}})],w.prototype,"field",void 0),t([r({type:y,json:{write:!0}})],w.prototype,"legendOptions",void 0),t([r({type:Number,json:{write:!0}})],w.prototype,"maxDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"maxPixelIntensity",null),t([r({type:Number,json:{write:!0}})],w.prototype,"minDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"minPixelIntensity",null),t([r({type:Number,cast:s,json:{write:!0}})],w.prototype,"radius",void 0),t([r({type:Number,range:{min:0},json:{default:0,write:!0}})],w.prototype,"referenceScale",void 0),t([o({heatmap:"heatmap"})],w.prototype,"type",void 0),t([r({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],w.prototype,"valueExpression",void 0),t([r({type:String})],w.prototype,"valueExpressionTitle",void 0),t([r({readOnly:!0})],w.prototype,"_pixelIntensityToDensity",null),w=g=t([n("esri.renderers.HeatmapRenderer")],w);export{w as default};