|
@@ -385,7 +385,7 @@ export default {
|
|
|
satelliteVisible: false,
|
|
|
missileVisible:false,
|
|
|
JsonVisible:false,
|
|
|
-
|
|
|
+ tempPickedEntityId: false,
|
|
|
situation: [],
|
|
|
xdName: '',
|
|
|
nameIdList: [],
|
|
@@ -517,7 +517,7 @@ export default {
|
|
|
this.$notify({
|
|
|
title: "提示",
|
|
|
message: "已选择想定文件:"+val,
|
|
|
- type: 'info'
|
|
|
+ type: 'success'
|
|
|
});
|
|
|
},
|
|
|
},
|
|
@@ -1037,10 +1037,52 @@ export default {
|
|
|
this.$data._viewer3D.camera.changed.addEventListener(this.sync); //地图移动事件
|
|
|
this.$data._viewer2D.camera.moveEnd.addEventListener(this.getCammeraHeightAndZoom) //地图缩放事件
|
|
|
this.$data._viewer3D.camera.moveEnd.addEventListener(this.getCammeraHeightAndZoom) //地图缩放事件
|
|
|
- this.handler2D = new Cesium.ScreenSpaceEventHandler(this.$data._viewer2D.scene.canvas);
|
|
|
- this.handler3D = new Cesium.ScreenSpaceEventHandler(this.$data._viewer3D.scene.canvas);
|
|
|
+
|
|
|
//设置导航组件
|
|
|
new CesiumNavigation(this.$data._viewer3D, this.mapNavOptions);
|
|
|
+
|
|
|
+ // 监听鼠标移动事件
|
|
|
+ this.handler2D = new Cesium.ScreenSpaceEventHandler(this.$data._viewer2D.scene.canvas);
|
|
|
+ this.handler3D = new Cesium.ScreenSpaceEventHandler(this.$data._viewer3D.scene.canvas);
|
|
|
+
|
|
|
+ //鼠标悬停在模型上的监听事件
|
|
|
+ // 创建屏幕空间事件处理器
|
|
|
+
|
|
|
+ this.handler2D.setInputAction((event)=>{
|
|
|
+ const screenPosition = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
|
|
|
+ const pickedEntity = this.$data._viewer2D.scene.pick(screenPosition);
|
|
|
+ if (Cesium.defined(pickedEntity)) {
|
|
|
+ for (const entity of this.$data._viewer2D.entities.values) {
|
|
|
+ if (pickedEntity.id.id === entity.id && this.tempPickedEntityId != pickedEntity.id.id) {
|
|
|
+ // 获取模型实体的地理位置(经度和纬度)
|
|
|
+ let position = this.convertWorldToCartographic(pickedEntity.id.position['_value'])
|
|
|
+ this.$notify({
|
|
|
+ title: "ID:"+entity.id,
|
|
|
+ message: "经度:"+ position.longitude +" 维度:"+ position.latitude + " 高度:"+ position.height,
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
+ this.tempPickedEntityId = pickedEntity.id.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
|
+ this.handler3D.setInputAction((event)=>{
|
|
|
+ const screenPosition = new Cesium.Cartesian3(event.endPosition.x, event.endPosition.y,event.endPosition.z);
|
|
|
+ const pickedEntity = this.$data._viewer2D.scene.pick(screenPosition);
|
|
|
+ if (Cesium.defined(pickedEntity)) {
|
|
|
+ for (const entity of this.$data._viewer2D.entities.values) {
|
|
|
+ if (pickedEntity.id.id === entity.id && this.tempPickedEntityId != pickedEntity.id.id) {
|
|
|
+ let position = this.convertWorldToCartographic(pickedEntity.id.position['_value'])
|
|
|
+ this.$notify({
|
|
|
+ title: "ID:"+entity.id,
|
|
|
+ message: "经度:"+ position.longitude +" 维度:"+ position.latitude + " 高度:"+ position.height,
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
+ this.tempPickedEntityId = pickedEntity.id.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
|
},
|
|
|
sync() {
|
|
|
//更新地图位置
|
|
@@ -1527,6 +1569,11 @@ export default {
|
|
|
time: startTime,
|
|
|
context: "开始模拟!!!"
|
|
|
})
|
|
|
+ this.$notify({
|
|
|
+ title: "提示",
|
|
|
+ message: "开始模拟!!!",
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
this.$data._viewer2D.clock.onTick.addEventListener(clock => {
|
|
|
const currentTime = clock.currentTime; // 获取当前时间轴的时间
|
|
|
const elapsedTime = Cesium.JulianDate.secondsDifference(
|
|
@@ -1719,7 +1766,7 @@ export default {
|
|
|
}
|
|
|
this.judgeMissile(this.$data._viewer2D, newTimeString);
|
|
|
//判断攻防是否结束
|
|
|
- if (this.ifFinish(this.$data._viewer3D, newTimeString) && !this.finish) {
|
|
|
+ if (this.ifFinish(this.$data._viewer2D, newTimeString) && !this.finish) {
|
|
|
// 停止时间轴动画
|
|
|
this.$data._viewer2D.clock.shouldAnimate = false;
|
|
|
this.dialogVisible = true
|
|
@@ -1959,6 +2006,11 @@ export default {
|
|
|
time: time,
|
|
|
context: context
|
|
|
})
|
|
|
+ this.$notify({
|
|
|
+ title: "战况",
|
|
|
+ message: context,
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
let radar = viewer.entities.getById(id)
|
|
|
let newRange = range * health * 0.01
|
|
|
radar.ellipsoid.radii = new Cesium.Cartesian3(newRange, newRange, newRange);
|
|
@@ -1979,18 +2031,44 @@ export default {
|
|
|
time: time,
|
|
|
context: '全部导弹被拦截,红方进攻失败,蓝方防守成功!!!'
|
|
|
})
|
|
|
+ this.$notify({
|
|
|
+ title: "战况",
|
|
|
+ message: '全部导弹被拦截,红方进攻失败,蓝方防守成功!!!',
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
return true
|
|
|
}
|
|
|
else {
|
|
|
for (let key in this.missileList) {
|
|
|
let missilePos = viewer.entities.getById(this.missileList[key].id).position._value
|
|
|
- if (Cesium.Cartesian3.distance(this.centerPosition, missilePos) <= 10) {
|
|
|
- this.messageList.push({
|
|
|
- order: this.order,
|
|
|
- time: time,
|
|
|
- context: '导弹' + key + '成功摧毁蓝方指挥中心!!!'
|
|
|
- })
|
|
|
- return true
|
|
|
+ if(viewer == this.$data._viewer3D){
|
|
|
+ if (Cesium.Cartesian3.distance(this.centerPosition, missilePos) <= 10) {
|
|
|
+ this.messageList.push({
|
|
|
+ order: this.order,
|
|
|
+ time: time,
|
|
|
+ context: '导弹' + key + '成功摧毁蓝方指挥中心!!!'
|
|
|
+ })
|
|
|
+ this.$notify({
|
|
|
+ title: "战况",
|
|
|
+ message: '导弹' + key + '成功摧毁蓝方指挥中心!!!',
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (Cesium.Cartesian2.distance(this.centerPosition, missilePos) <= 10) {
|
|
|
+ this.messageList.push({
|
|
|
+ order: this.order,
|
|
|
+ time: time,
|
|
|
+ context: '导弹' + key + '成功摧毁蓝方指挥中心!!!'
|
|
|
+ })
|
|
|
+ this.$notify({
|
|
|
+ title: "战况",
|
|
|
+ message: '导弹' + key + '成功摧毁蓝方指挥中心!!!',
|
|
|
+ type: 'info'
|
|
|
+ });
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|