Browse Source

update by xyh

xyh 1 year ago
parent
commit
fa8e32d62a
2 changed files with 46 additions and 17 deletions
  1. 33 4
      src/views/simulation/index.vue
  2. 13 13
      src/views/situation/index.vue

+ 33 - 4
src/views/simulation/index.vue

@@ -66,6 +66,7 @@ export default {
       save: false,
       situation: [],
       nameIdList: [],
+      satelliteRange: [],
       websocket: null,
       leftwidth: 12,
       unit: [],
@@ -798,14 +799,18 @@ export default {
             }
             // 新建卫星实体
             if (isSatellite) {
-              let range = 1200000
+              let range = 1000000
               console.log('key :>> ', key);
               let x = parseFloat(data[key].x) * 1000
               let y = parseFloat(data[key].y) * 1000
               let z = parseFloat(data[key].z) * 1000
               //终点位置
               let position = new this.Cesium.Cartesian3(x, y, z);
-              let cylinderposition = new this.Cesium.Cartesian3(x,y,z/2.0);
+              let cylinderposition = this.convertWorldToCartographic(position)
+              cylinderposition.height = cylinderposition.height / 10.0
+              cylinderposition = this.Cesium.Cartesian3.fromDegrees(cylinderposition.longitude, cylinderposition.latitude, cylinderposition.height);
+              console.log('position :>> ', position);
+              console.log('cylinderposition :>> ', cylinderposition);
               this.$data._viewer2D.entities.add({
                 id: this.id,
                 position: position,
@@ -834,7 +839,7 @@ export default {
                 }
               });
               this.$data._viewer2D.entities.add({
-                id: this.id,
+                id: this.id + 1,
                 position: cylinderposition,
                 cylinder: {
                   length: range, // 锥形的高度,可以根据需要调整
@@ -873,7 +878,7 @@ export default {
                 },
               });
               this.$data._viewer3D.entities.add({
-                id: this.id,
+                id: this.id + 1,
                 position: cylinderposition,
                 cylinder: {
                   length: range, // 锥形的高度,可以根据需要调整
@@ -888,6 +893,11 @@ export default {
                 id: this.id,
                 name: key
               })
+              this.satelliteRange.push({
+                satelliteId: this.id,
+                rangeId: this.id + 1
+              })
+              this.id++;
               this.id++;
             }
           }
@@ -945,7 +955,26 @@ export default {
       y = parseFloat(y) * 1000
       z = parseFloat(z) * 1000
       let entity = viewer.entities.getById(id)
+      for (let i = 0; i < this.satelliteRange.length; i++) {
+        if (id == this.satelliteRange[i].satelliteId) {
+          //是卫星
+          let rangeEntity = viewer.entities.getById(this.satelliteRange[i].rangeId)
+          let position = new this.Cesium.Cartesian3(x, y, z);
+          let cylinderposition = this.convertWorldToCartographic(position)
 
+          cylinderposition = this.Cesium.Cartesian3.fromDegrees(cylinderposition.longitude, cylinderposition.latitude, cylinderposition.height / 10.0);
+          let oldPosition = viewer.entities.getById(id).position._value
+          //设置方向,根据实体的位置来配置方向
+          entity.orientation = new this.Cesium.VelocityOrientationProperty(entity.position);
+          //设置实体位置
+          entity.position.setValue(position)
+          //设置方向,根据实体的位置来配置方向
+          rangeEntity.orientation = new this.Cesium.VelocityOrientationProperty(rangeEntity.position);
+          //设置实体位置
+          rangeEntity.position.setValue(cylinderposition)
+          this.markSatelliteLine(oldPosition, position, 'Blue', viewer)
+        }
+      }
       //终点位置
       let position = new this.Cesium.Cartesian3(x, y, z);
       let oldPosition = viewer.entities.getById(id).position._value

+ 13 - 13
src/views/situation/index.vue

@@ -334,15 +334,15 @@ export default {
           center = response.data.center
           this.save = true
           this.jsonData = {
-            id: row.id,
-            xdname: row.xdname,
-            type: row.type,
-            createtime: row.createtime,
-            bluecnt: row.bluecnt,
-            target: row.target,
-            starttime: row.starttime,
-            endtime: row.endtime,
-            steptime: row.steptime,
+            id: response.data.id,
+            xdname: response.data.xdname,
+            type: response.data.type,
+            createtime: response.data.createtime,
+            bluecnt: response.data.bluecnt,
+            target: response.data.target,
+            starttime: response.data.starttime,
+            endtime: response.data.endtime,
+            steptime: response.data.steptime,
             blueunit: blueunit,
             redunit: redunit,
             satellite: satellite,
@@ -961,10 +961,10 @@ export default {
             }
           }
           for (let i = 0; i < this.jsonData.redunit.length; i++) {
-            if (name == this.jsonData.redunit.name) {
-              this.jsonData.redunit.component_movementjson.properties.launch_lon = position.longitude.toFixed(6)
-              this.jsonData.redunit.component_movementjson.properties.launch_lat = position.latitude.toFixed(6)
-              this.jsonData.redunit.component_movementjson.properties.launch_h = position.height.toFixed(2)
+            if (name == this.jsonData.redunit[i].name) {
+              this.jsonData.redunit[i].component_movementjson.properties.launch_lon = position.longitude.toFixed(6)
+              this.jsonData.redunit[i].component_movementjson.properties.launch_lat = position.latitude.toFixed(6)
+              this.jsonData.redunit[i].component_movementjson.properties.launch_h = position.height.toFixed(2)
             }
           }
           for (let i = 0; i < this.jsonData.center.length; i++) {