Sfoglia il codice sorgente

add flyToBounds and zoomToBounds

tags/2.15.0
Caven Chen 3 anni fa
parent
commit
8511036315
1 ha cambiato i file con 54 aggiunte e 0 eliminazioni
  1. 54
    0
      modules/viewer/Viewer.js

+ 54
- 0
modules/viewer/Viewer.js Vedi File

@@ -551,6 +551,60 @@ class Viewer {
return this
}

/**
* Camera fly to bounds
* @param bounds
* @param heading
* @param pitch
* @param roll
* @param completeCallback
* @param duration
* @return {Viewer}
*/
flyToBounds(
bounds,
{ heading = 0, pitch = 0, roll = 0 },
completeCallback,
duration
) {
if (!bounds) {
return this
}
if (!Array.isArray(bounds)) {
bounds = bounds.split(',')
}
this.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(
bounds[0],
bounds[1],
bounds[2],
bounds[3]
),
orientation: {
heading: Cesium.Math.toRadians(heading),
pitch: Cesium.Math.toRadians(pitch),
roll: Cesium.Math.toRadians(roll)
},
complete: completeCallback,
duration: duration
})
return this
}

/**
*
* @param bounds
* @param heading
* @param pitch
* @param roll
* @param completeCallback
* @return {Viewer}
*/
zoomToBounds(bounds, { heading = 0, pitch = 0, roll = 0 }, completeCallback) {
this.flyToBounds(bounds, { heading, pitch, roll }, completeCallback)
return this
}

/**
*
* @param type

Loading…
Annulla
Salva