Constructor
new HeatMap(options)
Example
var heatMapInstance = null;
Cesium.Resource.fetchJson({
url : "../SampleData/Json/heatMapData.json"
}).then(function(data) {
heatMapInstance = new HczjEarth.HeatMap({
viewer : mainControl.viewer,
radiusFactor : 150,
data : data,
minValue : 0,
maxValue : 100,
xFieldName: "lng",
yFieldName: "lat"
})
}).otherwise(function(evt) {
console.log("加载热力图数据失败!");
heatMapInstance = null;
});
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 包含以下数据的对象:
Properties
|
Members
show :Boolean
- Default Value:
- true
获取或设置热力图是否显示。
Type:
- Boolean
Methods
_calculateBoundingBox(data) → {Object}
计算包含所有数据的经纬度坐标范围。
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | 数据。 |
Returns:
包含所有数据的经纬度范围对象。
- Type
- Object
_calculateValuesRange(data) → {Object}
计算权重值范围。
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | 数据。 |
Returns:
包含最小和最大权重的对象。
- Type
- Object
_calculateWidthAndHeight(mbounds)
计算Canvas宽度和高度。
Parameters:
Name | Type | Description |
---|---|---|
mbounds |
Object |
_createContainer(width, height, id)
创建Canvas的div容器。
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | 宽度。 |
height |
Number | 高度。 |
id |
String | ID。 |
_createHeatMapLayer() → {Cesium.ImageryLayer}
创建热力图图层。
Returns:
显示的热力图图层。
- Type
- Cesium.ImageryLayer
_deg2rad(d) → {Number}
将角度转换成弧度。
Parameters:
Name | Type | Description |
---|---|---|
d |
Number | 角度值。 |
Returns:
弧度值。
- Type
- Number
_mercatorPointToHeatmapPoint(p)
将墨卡托位置转换为相应的热力图位置。
Parameters:
Name | Type | Description |
---|---|---|
p |
Object | 墨卡托位置。 |
Returns:
热力图位置。
_mercatorToWgs84(p)
将墨卡托位置转换为WGS84位置。
Parameters:
Name | Type | Description |
---|---|---|
p |
Object | 墨卡托位置。 |
Returns:
WGS84位置。
_mercatorToWgs84BoundingBox(mbounds) → {Object}
将一个墨卡托包围盒转换为一个WGS84包围盒。
Parameters:
Name | Type | Description |
---|---|---|
mbounds |
Object | 墨卡托包围盒。例如:{north, east, south, west}。 |
Returns:
WGS84包围盒。例如:{north, east, south, west}。
- Type
- Object
_rad2deg(r) → {Number}
将弧度转换成角度。
Parameters:
Name | Type | Description |
---|---|---|
r |
Number | 弧度值。 |
Returns:
角度值。
- Type
- Number
_setWGS84Data(min, max, data)
设置WGS84坐标下的经纬度和权重数组。
Parameters:
Name | Type | Description |
---|---|---|
min |
Number | 允许的权重最小值。 |
max |
Number | 允许的权重最大值。 |
data |
Object | 经纬度和权重数组 |
_wgs84PointToHeatmapPoint(p)
将WGS84位置转换为相应的热力图位置。
Parameters:
Name | Type | Description |
---|---|---|
p |
Object | WGS84位置。 |
Returns:
热力图位置。
_wgs84ToMercator(p)
将WGS84位置转换为墨卡托位置。
Parameters:
Name | Type | Description |
---|---|---|
p |
Object | WGS84位置。 |
Returns:
墨卡托位置。
_wgs84ToMercatorBoundingBox(bb) → {Object}
将一个WGS84包围盒转换为一个墨卡托包围盒。
Parameters:
Name | Type | Description |
---|---|---|
bb |
Object | WGS84包围盒。例如:{north, east, south, west}。 |
Returns:
墨卡托包围盒。例如:{north, east, south, west}。
- Type
- Object
destroy()
销毁此热力图实例
lookHeatMap(boundsopt)
设置相机看向热力图。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bounds |
Object |
<optional> |
经纬度范围。 注意:若不指定,则使用热力图经纬度范围,但若经度坐标绝对值之和超过180,将出现不可预料之后果。 |
updateData(options, minValueopt, maxValueopt, data)
更新热力图数据。
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object | ||
minValue |
Number |
<optional> |
允许的权重最小值。 |
maxValue |
Number |
<optional> |
允许的权重最大值。 |
data |
Object | 要更新的数据。 |