|
@@ -52,6 +52,8 @@ export default {
|
|
|
name: "cesiumPage",
|
|
|
data() {
|
|
|
return {
|
|
|
+ myVar:null,
|
|
|
+ windy:null,
|
|
|
promsg: false,
|
|
|
labelEntities: [],
|
|
|
weather: null,
|
|
@@ -252,12 +254,12 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- flyto() {
|
|
|
+ flyto(h) {
|
|
|
this.viewer.camera.flyTo({
|
|
|
destination: Cesium.Cartesian3.fromDegrees(
|
|
|
106.24307250976562,
|
|
|
38.49372100830078,
|
|
|
- 2000
|
|
|
+ h
|
|
|
),
|
|
|
//duration:5, // 设置飞行持续时间,默认会根据距离来计算
|
|
|
complete: function () {
|
|
@@ -272,12 +274,24 @@ export default {
|
|
|
maximumHeight: 5000, // 相机最大飞行高度
|
|
|
});
|
|
|
},
|
|
|
- windy() {
|
|
|
- var windy = new Windy(response, this.viewer);
|
|
|
- setInterval(function () {
|
|
|
+ windyF() {
|
|
|
+ console.log(this.windy)
|
|
|
+ var windy = new Windy(response, this.viewer);
|
|
|
+ if(this.windy == null){
|
|
|
+ this.flyto(20000000);
|
|
|
+ this.windy = windy;
|
|
|
+ this.myVar = setInterval(function () {
|
|
|
console.log(1111111111)
|
|
|
windy.animate();
|
|
|
- }, 200);
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.windy = null
|
|
|
+ clearInterval(this.myVar);
|
|
|
+ console.log(22222)
|
|
|
+ windy.destroy();
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
handleCommand(command) {
|
|
|
switch (command) {
|
|
@@ -288,10 +302,10 @@ export default {
|
|
|
this.geoJSON();
|
|
|
break;
|
|
|
case "d":
|
|
|
- this.windy();
|
|
|
+ this.windyF();
|
|
|
break;
|
|
|
default:
|
|
|
- this.flyto();
|
|
|
+ this.flyto(2000);
|
|
|
break;
|
|
|
}
|
|
|
},
|