|
@@ -48,6 +48,18 @@
|
|
|
</div>
|
|
|
</el-row>
|
|
|
<!-- <TimeLine :showLayers="showLayers" :timeDataArray="timeDataArray" class="TimeLine"></TimeLine> -->
|
|
|
+ <div>
|
|
|
+ <el-dialog title="模拟消息列表" :visible.sync="dialogVisible" width="50%">
|
|
|
+ <el-table :data="messageList">
|
|
|
+ <el-table-column label="序号" prop="order" width="50px"></el-table-column>
|
|
|
+ <el-table-column label="时间" align="center" prop="time"></el-table-column>
|
|
|
+ <el-table-column label="消息" align="center" prop="context"></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -58,7 +70,6 @@ import axios from "axios";
|
|
|
import satelliteModel from 'public/static/model/satelite1.glb';
|
|
|
import TimeLine from '@/components/TimeLine/index.vue';
|
|
|
import missileModel from 'public/static/model/basic_missle.glb';
|
|
|
-import thaadModel from 'public/static/model/anti-aircraft_gun_fire_control_radar_vehicle.glb';
|
|
|
import centerModel from 'public/static/model/the_white_house.glb';
|
|
|
import radarModel from 'public/static/model/radar.glb'
|
|
|
import { mapGetters } from "vuex";
|
|
@@ -75,19 +86,21 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
save: false,
|
|
|
- messageList:[],
|
|
|
+ messageList: [],
|
|
|
situation: [],
|
|
|
nameIdList: [],
|
|
|
satelliteRange: [],
|
|
|
- missileList:{},
|
|
|
- thaadList:{},
|
|
|
+ missileList: {},
|
|
|
+ thaadList: {},
|
|
|
websocket: null,
|
|
|
+ centerPosition: null,
|
|
|
leftwidth: 12,
|
|
|
unit: [],
|
|
|
+ dialogVisible: false,
|
|
|
satellite: [],
|
|
|
center: [],
|
|
|
move_data: {},
|
|
|
- order : 1,
|
|
|
+ order: 1,
|
|
|
_viewer2D: null,
|
|
|
_viewer3D: null,
|
|
|
mousevalue: null,
|
|
@@ -152,7 +165,7 @@ export default {
|
|
|
this.order = 1;
|
|
|
this.messageList = [];
|
|
|
this.nameIdList = [];
|
|
|
- this.satelliteRange = [];
|
|
|
+ this.satelliteRange = [];
|
|
|
this.missileList = {};
|
|
|
this.thaadList = {};
|
|
|
let redunit = [];
|
|
@@ -574,6 +587,7 @@ export default {
|
|
|
else if (type == 'center') {
|
|
|
color = 'Blue'
|
|
|
modelUrl = centerModel
|
|
|
+ this.centerPosition = position
|
|
|
}
|
|
|
else if (type == 'satelite') {
|
|
|
color = 'Blue'
|
|
@@ -774,8 +788,8 @@ export default {
|
|
|
this.$data._viewer2D.clock.clockRange = this.Cesium.ClockRange.LOOP_STOP;
|
|
|
this.$data._viewer3D.clock.clockRange = this.Cesium.ClockRange.LOOP_STOP;
|
|
|
this.messageList.push({
|
|
|
- order : this.order++,
|
|
|
- time : startTime,
|
|
|
+ order: this.order++,
|
|
|
+ time: startTime,
|
|
|
context: "开始模拟!!!"
|
|
|
})
|
|
|
this.$data._viewer2D.clock.onTick.addEventListener(clock => {
|
|
@@ -947,27 +961,33 @@ export default {
|
|
|
this.modelEntityMoveByIDAndLocation(this.$data._viewer2D, this.nameIdList[i].id, data[this.nameIdList[i].name].x, data[this.nameIdList[i].name].y, data[this.nameIdList[i].name].z)
|
|
|
}
|
|
|
}
|
|
|
- for(let i = 0; i < this.nameIdList.length; i++) {
|
|
|
- if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined){
|
|
|
+ for (let i = 0; i < this.nameIdList.length; i++) {
|
|
|
+ if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined) {
|
|
|
//查看在雷达原侦察范围内有几颗导弹
|
|
|
- let missileNum = this.howManyMissile(this.$data._viewer2D,this.thaadList[this.nameIdList[i].name].id,this.nameIdList[i].name)
|
|
|
+ let missileNum = this.howManyMissile(this.$data._viewer2D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
|
|
|
let health = 100.0
|
|
|
- for(let j=0;j<missileNum;j++){
|
|
|
- health = health*0.8
|
|
|
+ for (let j = 0; j < missileNum; j++) {
|
|
|
+ health = health * 0.8
|
|
|
}
|
|
|
- if(this.thaadList[this.nameIdList[i].name].health != health){
|
|
|
+ if (this.thaadList[this.nameIdList[i].name].health != health) {
|
|
|
//修改健康值并修改范围
|
|
|
let mark = true
|
|
|
- if(health>this.thaadList[this.nameIdList[i].name].health)
|
|
|
- {
|
|
|
+ if (health > this.thaadList[this.nameIdList[i].name].health) {
|
|
|
mark = false
|
|
|
}
|
|
|
this.thaadList[this.nameIdList[i].name].health = health
|
|
|
- this.changeRange(this.$data._viewer2D,this.thaadList[this.nameIdList[i].name].id,this.thaadList[this.nameIdList[i].name].range,this.thaadList[this.nameIdList[i].name].health,newTimeString,this.nameIdList[i].name,mark)
|
|
|
+ this.changeRange(this.$data._viewer2D, this.thaadList[this.nameIdList[i].name].id, this.thaadList[this.nameIdList[i].name].range, this.thaadList[this.nameIdList[i].name].health, newTimeString, this.nameIdList[i].name, mark)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.judgeMissile(this.$data._viewer2D,newTimeString);
|
|
|
+ this.judgeMissile(this.$data._viewer2D, newTimeString);
|
|
|
+ //判断攻防是否结束
|
|
|
+ if (this.ifFinish(this.$data._viewer3D, newTimeString)) {
|
|
|
+ // 停止时间轴动画
|
|
|
+ this.$data._viewer2D.clock.shouldAnimate = false;
|
|
|
+ this.dialogVisible = true
|
|
|
+ }
|
|
|
+
|
|
|
//更新模型位置
|
|
|
// this.modelEntityMoveByIDAndLocation(this.$data._viewer2D,"1654426964397658112",res.data[1].data.W1.x,res.data[1].data.W1.y,res.data[1].data.W1.z)
|
|
|
})
|
|
@@ -991,30 +1011,36 @@ export default {
|
|
|
this.modelEntityMoveByIDAndLocation(this.$data._viewer3D, this.nameIdList[i].id, data[this.nameIdList[i].name].x, data[this.nameIdList[i].name].y, data[this.nameIdList[i].name].z)
|
|
|
}
|
|
|
}
|
|
|
- for(let i = 0; i < this.nameIdList.length; i++) {
|
|
|
- if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined){
|
|
|
+ for (let i = 0; i < this.nameIdList.length; i++) {
|
|
|
+ if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined) {
|
|
|
//查看在雷达原侦察范围内有几颗导弹
|
|
|
- let missileNum = this.howManyMissile(this.$data._viewer3D,this.thaadList[this.nameIdList[i].name].id,this.nameIdList[i].name)
|
|
|
+ let missileNum = this.howManyMissile(this.$data._viewer3D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
|
|
|
let health = 100.0
|
|
|
//变化健康值
|
|
|
- for(let j=0;j<missileNum;j++){
|
|
|
- health = health*0.8
|
|
|
+ for (let j = 0; j < missileNum; j++) {
|
|
|
+ health = health * 0.8
|
|
|
}
|
|
|
- if(this.thaadList[this.nameIdList[i].name].health != health){
|
|
|
+ if (this.thaadList[this.nameIdList[i].name].health != health) {
|
|
|
//修改健康值并修改范围
|
|
|
let mark = true
|
|
|
- if(health>this.thaadList[this.nameIdList[i].name].health)
|
|
|
- {
|
|
|
+ if (health > this.thaadList[this.nameIdList[i].name].health) {
|
|
|
mark = false
|
|
|
}
|
|
|
this.thaadList[this.nameIdList[i].name].health = health
|
|
|
- this.changeRange(this.$data._viewer3D,this.thaadList[this.nameIdList[i].name].id,this.thaadList[this.nameIdList[i].name].range,this.thaadList[this.nameIdList[i].name].health,newTimeString,this.nameIdList[i].name,mark)
|
|
|
+ this.changeRange(this.$data._viewer3D, this.thaadList[this.nameIdList[i].name].id, this.thaadList[this.nameIdList[i].name].range, this.thaadList[this.nameIdList[i].name].health, newTimeString, this.nameIdList[i].name, mark)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
//判断是否有导弹被拦截
|
|
|
- this.judgeMissile(this.$data._viewer3D,newTimeString);
|
|
|
+ this.judgeMissile(this.$data._viewer3D, newTimeString);
|
|
|
+ //判断攻防是否结束
|
|
|
+ if (this.ifFinish(this.$data._viewer3D, newTimeString)) {
|
|
|
+ // 停止时间轴动画
|
|
|
+ this.$data._viewer3D.clock.shouldAnimate = false;
|
|
|
+ this.dialogVisible = true
|
|
|
+ }
|
|
|
+
|
|
|
//更新模型位置
|
|
|
// this.modelEntityMoveByIDAndLocation(this.$data._viewer3D,viewer,"1654426964397658112",res.data[1].data.W1.x,res.data[1].data.W1.y,res.data[1].data.W1.z)
|
|
|
})
|
|
@@ -1055,31 +1081,31 @@ export default {
|
|
|
this.markSatelliteLine(oldPosition, position, 'Blue', viewer)
|
|
|
},
|
|
|
//计算有多少个导弹进入了雷达的原始范围
|
|
|
- howManyMissile(viewer,id,name){
|
|
|
+ howManyMissile(viewer, id, name) {
|
|
|
let radar = viewer.entities.getById(id)
|
|
|
let radarPos = radar.position._value
|
|
|
let num = 0
|
|
|
- for(let key in this.missileList){
|
|
|
+ for (let key in this.missileList) {
|
|
|
let missilePos = viewer.entities.getById(this.missileList[key].id).position._value
|
|
|
- if(this.Cesium.Cartesian3.distance(radarPos,missilePos)<=this.thaadList[name].range){//距离小于range
|
|
|
+ if (this.Cesium.Cartesian3.distance(radarPos, missilePos) <= this.thaadList[name].range) {//距离小于range
|
|
|
num++
|
|
|
}
|
|
|
}
|
|
|
return num;
|
|
|
},
|
|
|
//判断导弹是否被拦截
|
|
|
- judgeMissile(viewer,time){
|
|
|
- for(let key in this.missileList){
|
|
|
+ judgeMissile(viewer, time) {
|
|
|
+ for (let key in this.missileList) {
|
|
|
let missile = viewer.entities.getById(this.missileList[key].id)
|
|
|
let missilePos = viewer.entities.getById(this.missileList[key].id).position._value
|
|
|
- for(let item in this.thaadList){
|
|
|
+ for (let item in this.thaadList) {
|
|
|
let radarPos = viewer.entities.getById(this.thaadList[item].id).position._value
|
|
|
- if(this.Cesium.Cartesian3.distance(radarPos,missilePos)<=this.thaadList[item].range*this.thaadList[item].health*0.01){
|
|
|
+ if (this.Cesium.Cartesian3.distance(radarPos, missilePos) <= this.thaadList[item].range * this.thaadList[item].health * 0.01) {
|
|
|
// 导弹进入了被干扰后的雷达探测范围,判断被拦截 移除实体,删除信息
|
|
|
this.messageList.push({
|
|
|
- order : this.order++,
|
|
|
+ order: this.order++,
|
|
|
time: time,
|
|
|
- context : '导弹'+key+'被雷达'+item+'拦截!!!'
|
|
|
+ context: '导弹' + key + '被雷达' + item + '拦截!!!'
|
|
|
})
|
|
|
viewer.entities.remove(missile)
|
|
|
this.nameIdList = this.nameIdList.filter(item => item.id !== this.missileList[key].id);
|
|
@@ -1090,19 +1116,52 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//修改雷达的显示范围
|
|
|
- changeRange(viewer,id,range,health,time,name,mark){
|
|
|
- let context = '雷达'+name+'受到干扰!健康值变化为: '+health
|
|
|
- if(!mark){
|
|
|
- context = '雷达'+name+'恢复健康值,健康值变化为: '+health
|
|
|
+ changeRange(viewer, id, range, health, time, name, mark) {
|
|
|
+ let context = '雷达' + name + '受到干扰!健康值变化为: ' + health
|
|
|
+ if (!mark) {
|
|
|
+ context = '雷达' + name + '恢复健康值,健康值变化为: ' + health
|
|
|
}
|
|
|
this.messageList.push({
|
|
|
- order : this.order++,
|
|
|
- time : time,
|
|
|
+ order: this.order++,
|
|
|
+ time: time,
|
|
|
context: context
|
|
|
})
|
|
|
let radar = viewer.entities.getById(id)
|
|
|
- let newRange = range*health*0.01
|
|
|
+ let newRange = range * health * 0.01
|
|
|
radar.ellipsoid.radii = new this.Cesium.Cartesian3(newRange, newRange, newRange);
|
|
|
+ },
|
|
|
+ isObjectEmpty(obj) {
|
|
|
+ for (let key in obj) {
|
|
|
+ if (obj.hasOwnProperty(key)) {
|
|
|
+ return false; // 如果对象有任何属性,返回 false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true; // 如果对象没有任何属性,返回 true
|
|
|
+},
|
|
|
+ //判断攻防是否完成
|
|
|
+ ifFinish(viewer, time) {
|
|
|
+ if (this.isObjectEmpty(this.missileList)) {
|
|
|
+ this.messageList.push({
|
|
|
+ order: this.order,
|
|
|
+ time: time,
|
|
|
+ context: '全部导弹被拦截,红方进攻失败,蓝方防守成功!!!'
|
|
|
+ })
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ for (let key in this.missileList) {
|
|
|
+ let missilePos = viewer.entities.getById(this.messageList[key].id).position._value
|
|
|
+ if (this.Cesium.Cartesian3.distance(this.centerPosition, missilePos) <= 100) {
|
|
|
+ this.messageList.push({
|
|
|
+ order: this.order,
|
|
|
+ time: time,
|
|
|
+ context: '导弹' + key + '成功摧毁蓝方指挥中心!!!'
|
|
|
+ })
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
}
|
|
|
|
|
|
}
|