Browse Source

improve heat map

tags/3.0.0
Caven Chen 2 years ago
parent
commit
ea8377f6ec
No account linked to committer's email address
1 changed files with 5 additions and 8 deletions
  1. 5
    8
      src/modules/heat-map/HeatMapLayer.js

+ 5
- 8
src/modules/heat-map/HeatMapLayer.js View File

@@ -122,9 +122,9 @@ class HeatMapLayer extends Layer {
*
* @private
*/
_computeBounds(points) {
_computeBounds() {
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
)
}
@@ -137,7 +137,7 @@ class HeatMapLayer extends Layer {
_computeBoundsInMeter() {
let swInMeter = WMP.project(Cesium.Rectangle.southwest(this._bounds))
let neInMeter = WMP.project(Cesium.Rectangle.northeast(this._bounds))
return new Cesium.Rectangle(
this._boundsInMeter = new Cesium.Rectangle(
swInMeter.x,
swInMeter.y,
neInMeter.x,
@@ -202,11 +202,8 @@ class HeatMapLayer extends Layer {
*/
setPoints(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) {
this._scale = Math.min(
Math.abs(this._boundsInMeter.west - this._boundsInMeter.east) /

Loading…
Cancel
Save