Heatmap

Heatmap

new Heatmap(parameters)

Description:
  • 热力图,可设置范围大小,通过data设置热力图数据
Source:
  • objects/other/Heatmap.js, line8
Example
const data=[{x:0,y:0,value:100},{x:10,y:10,value:50},{x:20,y:20,value:200},{x:50,y:50,value:100},......];
const heatmap = new Heatmap({
     width:1000,
     height:500,
     data:data,
     center:{x:112.13,y:39.435,z:1},
     size:{x:1000,y:500,z:1}
});
engine.addToScene(heatmap);
Parameters:
Name Type Description
parameters object 参数
Properties
Name Type Description
kind String 热力图的类型,可选值["texture","cube","cone","particle"],默认值texture;
container HTMLDocument 容器,可选,默认值null;
canvas HTMLDocument 画布,可选,默认值null;
width number 画布的宽,单位是像素,默认是512
height number 画布的高,单位是像素,默认是512
min string 定义数据的最小值,默认是undefined
max number 定义数据的最大值,默认是undefined
data object 数据,[{x,y,value,longitude,latitude},{x,y,value,longitude,latitude}] 其中x代表canvas的横坐标位置,可选,范围0-width,y代表canvas的纵坐标位置,可选,范围0-height,value是具体值,longitude是经度坐标,可选,latitude是纬度坐标,可选
xName object 如果横坐标名字不是x,则需给出具体的横坐标名字,默认值undefined;
yName object 如果纵坐标名字不是y,则需给出具体的纵坐标名字,默认值undefined;
valueName object 如果值的名字不是value,则需给出具体的值名字,默认值undefined;
backgroundColor string 背景色,默认值"rgba(0,0,0,.95)";
gradient object 渐变色,kind为particle时无效,其他情况有效 默认值{ 0.25: "rgb(0,0,255)", 0.55: "rgb(0,255,0)", 0.85: "yellow", 1.0: "rgb(255,0,0)"};
radius object 每个值的作用范围;
opacity object 整体透明度,设置改值后,minOpacity和maxOpacity不起作用;
minOpacity object 最小透明度,和值挂钩;
maxOpacity object 最大透明度,和值挂钩;
size object 几何尺寸,单位是米,如果data里面有longitude,latitude值,可以不使用size;
Properties
Name Type Description
x number x方向几何长度
y number y方向几何长度
center object 中心点位置,单位是经纬度,如果data里面有longitude,latitude值,可以不使用center;
Properties
Name Type Description
x object 几何中心经度
y object 几何中心纬度
z object 几何中心高度
minHeight object 最小高度值,和值挂钩,默认值0;
maxHeight object 最大高度值,和值挂钩,默认值500;
duration object 变化过渡时间, 单位秒, 默认值1;
particle object kind为particle时,设置粒子参数;
Properties
Name Type Description
scaleBoxXY number 粒子缩放,默认值1,粒子缩放为1时,长宽约为5cm;
noiseStrength number 噪声强度,默认值0,用于粒子动画;
noiseMap string 噪声贴图,默认noiseMap;
grayPower string 热力灰度图强度,默认1,不可为0;
maxHeight string 粒子最高高度,默认10,单位2dm;
countX number 粒子X轴栅格分辨率。默认400;
countY number 粒子Y轴栅格分辨率。默认400;

Extends

Members

(readonly) animateNeedsUpdate

Source:
  • objects/Shape/Shape.js, line814
Inherited From:
Properties:
Name Type Description
animateNeedsUpdate Boolean 动画是否变化

depthTest

Source:
  • objects/Shape/Shape.js, line398
Inherited From:
Default Value:
  • true
Properties:
Name Type Description
depthTest boolean 是否开启深度测试

map

Description:
  • 获取贴图
Source:
  • objects/Shape/Shape.js, line134
Overrides:
获取贴图

(readonly) materialNeedsUpdate

Source:
  • objects/Shape/Shape.js, line802
Overrides:
Properties:
Name Type Description
materialNeedsUpdate Boolean 记录材质是否变化

(readonly) matrixNeedsUpdate

Source:
  • objects/Shape/Shape.js, line796
Inherited From:
Properties:
Name Type Description
matrixNeedsUpdate Boolean 记录空间是否变化

transparent

Source:
  • objects/Shape/Shape.js, line393
Inherited From:
Default Value:
  • opacity < 1.0
Properties:
Name Type Description
transparent boolean 是否透明

visible

Description:
  • 获取可见性状态
Source:
  • objects/Shape/Shape.js, line113
Overrides:
获取可见性状态

(readonly) visibleNeedsUpdate

Source:
  • objects/Shape/Shape.js, line808
Inherited From:
Properties:
Name Type Description
visibleNeedsUpdate Boolean 记录显隐是否变化

Methods

animate(options) → {TWEEN.Tween}

Description:
  • 动画函数,to中的animateOffset表示位置偏移单位cm
Source:
  • objects/Shape/Shape.js, line828
Inherited From:
Parameters:
Name Type Description
options object {from, to, duration, easing, loop}
Properties
Name Type Description
from object 起始值{position:null,rotation:null,scale:null} 可不设置,不设置就是当前状态
to object 结束值{position:{x,y,z},rotation:{roll,pitch,yaw},scale:{x,y,z},animateOffset:{x,y,z}}
duration number 动画持续时间,默认3000豪秒,单位豪秒
easing string 缓动函数 默认Linear,可选 Quadratic,Cubic,Sinusoidal,Exponential
loop boolean 是否循环,默认false
stayEnd boolean 动画结束后是否停留在最后一帧的位置,默认true
Returns:
返回Tween对象,可以调用stop()方法停止动画,onUpdate的时候会返回一个0-1的渐变值
Type
TWEEN.Tween

getConfig() → {object}

Description:
  • 获取绘制heatmap所需参数
Source:
  • objects/other/Heatmap.js, line324
Returns:
Type
object

getGeojsonData() → {array|boolean}

Description:
  • 根据热力图获取实际数据值并返回geojson
Source:
  • objects/other/Heatmap.js, line356
Returns:
Type
array | boolean

init()

Description:
  • 初始化热力图内容
Source:
  • objects/other/Heatmap.js, line229

repaint()

Description:
  • 重新绘制热力图,参数更改之后需要调用一次该函数
Source:
  • objects/other/Heatmap.js, line344

setData()

Description:
  • 重写父类方法
Source:
  • objects/other/Heatmap.js, line315
Overrides:

stopAnimate(delayTime)

Description:
  • 停止动画
Source:
  • objects/Shape/Shape.js, line891
Inherited From:
Parameters:
Name Type Default Description
delayTime 1000 延迟时间,默认为1000毫秒