浏览代码

improve heat map

tags/3.0.0
Caven Chen 2 年前
父节点
当前提交
ea8377f6ec
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入8 次删除
  1. 5
    8
      src/modules/heat-map/HeatMapLayer.js

+ 5
- 8
src/modules/heat-map/HeatMapLayer.js 查看文件

* *
* @private * @private
*/ */
_computeBounds(points) {
_computeBounds() {
Cesium.Rectangle.fromCartographicArray( Cesium.Rectangle.fromCartographicArray(
points.map((item) => Cesium.Cartographic.fromDegrees(item.lng, item.lat)),
this._points.map((item) => Cesium.Cartographic.fromDegrees(item.lng, item.lat)),
this._bounds this._bounds
) )
} }
_computeBoundsInMeter() { _computeBoundsInMeter() {
let swInMeter = WMP.project(Cesium.Rectangle.southwest(this._bounds)) let swInMeter = WMP.project(Cesium.Rectangle.southwest(this._bounds))
let neInMeter = WMP.project(Cesium.Rectangle.northeast(this._bounds)) let neInMeter = WMP.project(Cesium.Rectangle.northeast(this._bounds))
return new Cesium.Rectangle(
this._boundsInMeter = new Cesium.Rectangle(
swInMeter.x, swInMeter.x,
swInMeter.y, swInMeter.y,
neInMeter.x, neInMeter.x,
*/ */
setPoints(points) { setPoints(points) {
this._points = points this._points = points
this._computeBounds(points)
let boundsInMeter = this._computeBoundsInMeter()
if (!Cesium.Rectangle.equals(this._boundsInMeter, boundsInMeter)) {
this._boundsInMeter = boundsInMeter
}
this._computeBounds()
this._computeBoundsInMeter()
if (this._viewer) { if (this._viewer) {
this._scale = Math.min( this._scale = Math.min(
Math.abs(this._boundsInMeter.west - this._boundsInMeter.east) / Math.abs(this._boundsInMeter.west - this._boundsInMeter.east) /

正在加载...
取消
保存