geosolution/math~HeatmapModel(options)

Summary

Methods:
addMathCell

添加热力点Heatpoint对象

destroy

销毁对象

getAllMathCells

获取组成该数学模型的所有对应元素module:geosolution/cell

getBaseColor

获取热力点module:geosolution/cell~Heatpoint的value为minValue时对应的颜色。

getColorArray

获取当前热力图的等级颜色

getMathCellById

根据唯一标识符获取组成该数学模型的元素module:geosolution/cell

getMaxHeatValue

获取该热力图模型使用的最大热力值

getMinHeatValue

获取热力图模型使用的最小热力值。

getSize

获取热力图模型中单个热力点module:geosolution/cell~Heatpoint的半径值。

getVisibility

获取地理解决方案模型的可见性

removeAll

清空该数学模型中所有的组成元素

removeMathCellById

根据该数学模型组成元素的唯一标识符,将对应的元素从数学模型中移除

setBaseColor

设置热力点module:geosolution/cell~Heatpoint的value为minValue时对应的颜色。该颜色涉及到等级配置色的渐变。

setColorByLevel

设置对应热度层级的颜色

setMaxHeatValue

设置最大热力值,该方法不调用则默认使用组成热力图模型中所有热力点module:geosolution/cell~Heatpoint的最大值。

setMinHeatValue

设置最小热力值,该方法不调用则默认使用组成热力图模型中所有热力点module:geosolution/cell~Heatpoint的最小值。

setSize

设置热力图模型中单个热力点module:geosolution/cell~Heatpoint的半径值。

setVisibility

设置模型对象的可见性

updateDrawData

更新绘制数据接口。当组成热力图模型的热力点module:geosolution/cell~Heatpoint更新时调用。
注:
添加、删除、修改单个热力点建议调用updateDrawData(Heatpoint.getId());
多个时建议调用updateDrawData()。前者为按标识符更新,后者为全量更新。

Constructor

new HeatmapModel(options)

热力图模型HeatmapModel的构建函数

Parameters:
Name Type Description
options Object

可选参数。

Name Type Description
size Number

单个热力点所覆盖的半径,像素单位。大于0时有效,小于等于0或者不提供时采用默认值,默认值为20。

colors Array.<module:style~Color>

长度为4的数组,元素为hmap.style.Color类型,分别对应阈值0.25,0.50,0.75,1.0的颜色(比如某处热力/(最大热力-最小热力)的值为0.30,则该处显示数组的第一个颜色和第二个颜色的过渡色)。默认值[new hmap.style.Color(0,0,255,1),new hmap.style.Color(0,255,0,1),new hmap.style.Color(255,255,0,1),new hmap.style.Color(255,0,0,1)];

Throws:

无参数校验,参数类型错误时,方法内部报错。

Example
let heatmap=new geosolution.math.HeatmapModel({
     size:40,
     colors:[new hmap.style.Color(0,0,255,1),new hmap.style.Color(0,255,0,1),new hmap.style.Color(255,255,0.0,1),new hmap.style.Color(255,0,0,1)]
});

Methods

addMathCell(mathCell)

添加热力点Heatpoint对象

Parameters:
Name Type Description
mathCell module:geosolution/cell~Heatpoint

Heatpoint对象

destroy()

销毁对象

getAllMathCells() → {Array.<module:geosolution/cell>}

获取组成该数学模型的所有对应元素module:geosolution/cell

Returns:
Array.<module:geosolution/cell> -

组成该数学模型的对应元素构成的数组

getBaseColor() → {module:style~Color}

获取热力点module:geosolution/cell~Heatpoint的value为minValue时对应的颜色。

Returns:
module:style~Color -

返回热力点的value为minValue时对应的颜色

getColorArray() → {Array.<module:style~Color>}

获取当前热力图的等级颜色

Returns:
Array.<module:style~Color> -

返回各等级的RGBA颜色数组,颜色数组索引增大,表示热力图的等级也增大

Example
let colors = Heatmap.getColorArray();

getMathCellById(id) → {Object|null}

根据唯一标识符获取组成该数学模型的元素module:geosolution/cell

Parameters:
Name Type Description
id String

元素对象module:geosolution/cell的唯一标识符

Returns:
Object | null -

当id在该数学模型中存在时返回对应的元素对象module:geosolution/cell,不存在则返回null

getMaxHeatValue() → {Number}

获取该热力图模型使用的最大热力值

Returns:
Number -

热力值

getMinHeatValue() → {Number}

获取热力图模型使用的最小热力值。

Returns:
Number -

热力值

getSize() → {Number}

获取热力图模型中单个热力点module:geosolution/cell~Heatpoint的半径值。

Returns:
Number -

半径值。

getVisibility() → {Boolean}

获取地理解决方案模型的可见性

Returns:
Boolean

removeAll()

清空该数学模型中所有的组成元素

removeMathCellById(id)

根据该数学模型组成元素的唯一标识符,将对应的元素从数学模型中移除

Parameters:
Name Type Description
id String

组成元素的唯一标识符

setBaseColor(color)

设置热力点module:geosolution/cell~Heatpoint的value为minValue时对应的颜色。该颜色涉及到等级配置色的渐变。

Parameters:
Name Type Description
color module:style~Color

颜色值

setColorByLevel(color, lev)

设置对应热度层级的颜色

Parameters:
Name Type Description
color module:style~Color

颜色值

lev Number

热度层级,大于等于0小于4的整数值

Example
heatmap.setColorByLevel(new hmap.style.Color(255,200,0,1),1);
heatmap.redraw();
注:如初始化后heatmap后更改层级颜色,需要覆盖原来的颜色板,故调用重绘后方有效

setMaxHeatValue(value)

设置最大热力值,该方法不调用则默认使用组成热力图模型中所有热力点module:geosolution/cell~Heatpoint的最大值。

Parameters:
Name Type Description
value Number

热力值,要求大于minValue。

setMinHeatValue(value)

设置最小热力值,该方法不调用则默认使用组成热力图模型中所有热力点module:geosolution/cell~Heatpoint的最小值。

Parameters:
Name Type Description
value Number

热力值,要求大于0,小于maxValue。

setSize(size)

设置热力图模型中单个热力点module:geosolution/cell~Heatpoint的半径值。

Parameters:
Name Type Description
size Number

半径值。

setVisibility(visible)

设置模型对象的可见性

Parameters:
Name Type Description
visible Boolean

是否可见。默认true。

updateDrawData(id)

更新绘制数据接口。当组成热力图模型的热力点module:geosolution/cell~Heatpoint更新时调用。
注:
添加、删除、修改单个热力点建议调用updateDrawData(Heatpoint.getId());
多个时建议调用updateDrawData()。前者为按标识符更新,后者为全量更新。

Parameters:
Name Type Description
id String

热力点对象的唯一标识符