Ver Fonte

add simulation basic function

xyh há 1 ano atrás
pai
commit
ca5733e301
1 ficheiros alterados com 431 adições e 196 exclusões
  1. 431 196
      src/views/simulation/index.vue

+ 431 - 196
src/views/simulation/index.vue

@@ -11,6 +11,43 @@
           <div id="3DcesiumContainer" class="map" @click="onMapClick"></div>
         </div>
       </el-col>
+      <el-tabs type="border-card" v-model="activeName" tab-position="left" class="menu" :stretch="true"
+        @tab-click="legendClick">
+        <!-- <el-tab-pane name="first">
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">标绘</span>
+            <span><i class="el-icon-wind-power"></i></span>
+          </el-tooltip>
+        </el-tab-pane> -->
+        <!-- <el-tab-pane name="second">
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">模型</span>
+            <span><i class="el-icon-receiving"></i></span>
+          </el-tooltip>
+          <Model @selectModel="selectModel" :isShow="isShow"></Model>
+        </el-tab-pane> -->
+        <!-- <el-tab-pane name="third">
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">测量</span>
+            <span><i class="el-icon-discount"></i></span>
+          </el-tooltip>
+        </el-tab-pane> -->
+        <el-tab-pane name="fouth">
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">想定</span>
+            <span><i class="el-icon-house"></i></span>
+          </el-tooltip>
+          <el-table :data="situation">
+            <el-table-column label="名称" prop="xdname" width="150px"></el-table-column>
+            <el-table-column label="操作" align="center">
+              <template slot-scope="scope">
+                <el-button type="primary" @click="getJson(scope.row)">导入</el-button>
+                <!-- <el-button type="primary" @click="saveJson()">保存</el-button> -->
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+      </el-tabs>
       <div class="buttons">
         <el-button icon="el-icon-full-screen" circle @click="ismax()"></el-button>
         <el-button icon="el-icon-house" circle @click="home()"></el-button>
@@ -28,7 +65,12 @@ import { getToken } from "@/utils";
 import axios from "axios";
 import satelliteModel from '@/assets/model/satelite.glb';
 import TimeLine from '@/components/TimeLine/index.vue';
+import missileModel from '@/assets/model/basic_missle.glb';
+import thaadModel from '@/assets/model/anti-aircraft_gun_fire_control_radar_vehicle.glb';
+import centerModel from '@/assets/model/the_white_house.glb';
+import radarModel from '@/assets/model/radar.glb'
 import { mapGetters } from "vuex";
+
 export default {
   components: {
     TimeLine
@@ -92,7 +134,7 @@ export default {
   },
   mounted() {
     this.cesiumInit();
-    this.pointMove();
+    // this.pointMove();
     this.startWebSocket();
   },
   beforeDestroy() {
@@ -171,6 +213,191 @@ export default {
     },
     changeItemPosition(data) {
 
+    },
+    async getJson(row) {
+      let redunit = [];
+      let blueunit = [];
+      let satellite = [];
+      let center = [];
+      // let fileInfoStr = row.blueunit;
+      // let fileInfoArr = JSON.parse(fileInfoStr);
+      // for (let i = 0; i < fileInfoArr.length; i++) {
+      //   await axios
+      //     .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
+      //       params: {
+      //         datasourceId: "1656243335922192384",
+      //         fieldName: "blueunit",
+      //         asImage: false,
+      //         dataId: row.id,
+      //         filename: fileInfoArr[i].filename,
+      //         Authorization: getToken(),
+      //         MenuId: "1656244747347431424"
+      //       }
+      //     })
+      //     .then((response) => {
+      //       // 处理成功的响应
+      //       blueunit.push(response.data);
+      //     })
+      //     .catch((error) => {
+      //       // 处理错误
+      //       console.error(error);
+      //     });
+      // }
+      // fileInfoStr = row.redunit;
+      // fileInfoArr = JSON.parse(fileInfoStr);
+
+      // for (let i = 0; i < fileInfoArr.length; i++) {
+      //   await axios
+      //     .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
+      //       params: {
+      //         datasourceId: "1656243335922192384",
+      //         fieldName: "redunit",
+      //         asImage: false,
+      //         dataId: row.id,
+      //         filename: fileInfoArr[i].filename,
+      //         Authorization: getToken(),
+      //         MenuId: "1656244747347431424"
+      //       }
+      //     })
+      //     .then((response) => {
+      //       // 处理成功的响应
+      //       redunit.push(response.data);
+      //     })
+      //     .catch((error) => {
+      //       // 处理错误
+      //       console.error(error);
+      //     });
+      // }
+      // fileInfoStr = row.center;
+      // fileInfoArr = JSON.parse(fileInfoStr);
+
+      // for (let i = 0; i < fileInfoArr.length; i++) {
+      //   await axios
+      //     .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
+      //       params: {
+      //         datasourceId: "1656243335922192384",
+      //         fieldName: "center",
+      //         asImage: false,
+      //         dataId: row.id,
+      //         filename: fileInfoArr[i].filename,
+      //         Authorization: getToken(),
+      //         MenuId: "1656244747347431424"
+      //       }
+      //     })
+      //     .then((response) => {
+      //       // 处理成功的响应
+      //       center.push(response.data);
+      //     })
+      //     .catch((error) => {
+      //       // 处理错误
+      //       console.error(error);
+      //     });
+      // }
+      // fileInfoStr = row.satellite;
+      // fileInfoArr = JSON.parse(fileInfoStr);
+
+      // for (let i = 0; i < fileInfoArr.length; i++) {
+      //   await axios
+      //     .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
+      //       params: {
+      //         datasourceId: "1656243335922192384",
+      //         fieldName: "satellite",
+      //         asImage: false,
+      //         dataId: row.id,
+      //         filename: fileInfoArr[i].filename,
+      //         Authorization: getToken(),
+      //         MenuId: "1656244747347431424"
+      //       }
+      //     })
+      //     .then((response) => {
+      //       // 处理成功的响应
+      //       satellite.push(response.data);
+      //     })
+      //     .catch((error) => {
+      //       // 处理错误
+      //       console.error(error);
+      //     });
+      // }
+      // const jsonData = {}
+      //   id: row.id,
+      //   xdname: row.xdname,
+      //   type: row.type,
+      //   creator: row.creator,
+      //   createtime: row.createtime,
+      //   bluecnt: row.bluecnt,
+      //   target: row.target,
+      //   starttime: row.starttime,
+      //   steptime: row.steptime,
+      //   blueunit: blueunit,
+      //   redunit: redunit,
+      //   satellite: satellite,
+      //   center: center
+      // };
+     let fileInfoStr = row.xdfile;
+     let fileInfoArr = JSON.parse(fileInfoStr);
+      await axios
+          .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
+            params: {
+              datasourceId: "1656243335922192384",
+              fieldName: "xdfile",
+              asImage: false,
+              dataId: row.id,
+              filename: fileInfoArr[0].filename,
+              Authorization: getToken(),
+              MenuId: "1656244747347431424"
+            }
+          })
+          .then((response) => {
+            console.log('response.data :>> ', response.data);
+            // // 处理成功的响应
+            // jsonData = response.data
+            blueunit = response.data.blueunit
+            redunit = response.data.redunit
+            satellite = response.data.satellite
+            center = response.data.center
+            this.save = true
+                this.jsonData = {
+        id: row.id,
+        xdname: row.xdname,
+        type: row.type,
+        creator: row.creator,
+        createtime: row.createtime,
+        bluecnt: row.bluecnt,
+        target: row.target,
+        starttime: row.starttime,
+        steptime: row.steptime,
+        blueunit: blueunit,
+        redunit: redunit,
+        satellite: satellite,
+        center: center
+      }
+          })
+          .catch((error) => {
+            // 处理错误
+            console.error(error);
+          });
+      
+      for(let i =0;i<blueunit.length;i++){
+        this.markLocationbyJson(parseFloat(blueunit[i].pos.lat),parseFloat(blueunit[i].pos.lon),parseFloat(blueunit[i].pos.height),blueunit[i].name,"blue")
+      }
+      for(let i = 0;i<center.length;i++){
+        let item = center[i]
+        this.markLocationbyJson(parseFloat(item[center[i].name].properties.lat),parseFloat(item[center[i].name].properties.lon),parseFloat(item[center[i].name].properties.h),item.name,"center")
+      }
+      for(let i = 0;i<redunit.length;i++){
+        this.markLocationbyJson(parseFloat(redunit[i].component_movementjson.properties.launch_lat),parseFloat(redunit[i].component_movementjson.properties.launch_lon),parseFloat(redunit[i].component_movementjson.properties.launch_h),redunit[i].name,"red")
+        let point1 = {
+          longitude : parseFloat(redunit[i].component_movementjson.properties.launch_lon),
+          latitude : parseFloat(redunit[i].component_movementjson.properties.launch_lat),
+          height :parseFloat(redunit[i].component_movementjson.properties.launch_h)
+        }
+        let point2 = {
+          longitude : parseFloat(redunit[i].component_movementjson.properties.target_lon),
+          latitude : parseFloat(redunit[i].component_movementjson.properties.target_lat),
+          height : parseFloat(redunit[i].component_movementjson.properties.target_h)
+        }
+        this.markLine(point1,point2,"red")
+      }
     },
     //获取所有数据
     getData() {
@@ -538,24 +765,32 @@ export default {
       });
       this.id++;
     },
-    markLocationbyJson(latitude, longitude,name,type) {
-      const position = this.Cesium.Cartesian3.fromDegrees(longitude, latitude);
+    markLocationbyJson(latitude, longitude,height,name,type) {
+      const position = this.Cesium.Cartesian3.fromDegrees(longitude, latitude,height);
+      console.log('position :>> ', position);
       let color = ''
+      let modelUrl = ''
       if(type=='red'){
         color = 'Red'
+        modelUrl= missileModel
       }
-      else{
+      else if(type=='blue'){
         color = 'Blue'
+        modelUrl = radarModel
+      }
+      else if(type=='center'){
+        color = 'Blue'
+        modelUrl = centerModel
       }
       this.viewer2D.entities.add({
         id: this.id,
         position: position,
-        // point: {
-        //   pixelSize: 12, // 调整点的大小,可以增大点的像素大小
-        //   color: this.Cesium.Color.fromCssColorString(color)
-        // },
+        point: {
+          pixelSize: 12, // 调整点的大小,可以增大点的像素大小
+          color: this.Cesium.Color.fromCssColorString(color)
+        },
         model: {
-          uri: satelliteModel, // 替换为你的3D模型文件路径
+          uri: modelUrl, // 替换为你的3D模型文件路径
           scale: 1.0, // 调整3D模型的缩放大小
           minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
         },
@@ -574,7 +809,7 @@ export default {
           color: this.Cesium.Color.fromCssColorString(color)
         },
         model: {
-          uri: satelliteModel, // 替换为你的3D模型文件路径
+          uri: modelUrl, // 替换为你的3D模型文件路径
           scale: 1.0, // 调整3D模型的缩放大小
           minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
         },
@@ -639,195 +874,195 @@ export default {
       });
     },
     // 鼠标点击的事件监听
-    pointMove() {
-      // 监听鼠标左键点击事件
-      this.handler2D.setInputAction((event) => {
-        if (!this.selectedMarker && !this.modeltooltip) {
-          const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
-          const pickedEntity = this.viewer2D.scene.pick(screenPosition);
-          if (this.Cesium.defined(pickedEntity)) {
-            for (const entity of this.viewer2D.entities.values) {
-              if (pickedEntity.id.id === entity.id) {
-                this.selectedMarker = entity;
-                this.oldPosition = pickedEntity.id.position;
-                // 显示提示
-                this.selectModel("pointer", null, "右键取消");
-              }
-            }
-          }
-        } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          // const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
-          console.log('this.viewer2D.entities.values :>> ', this.viewer2D.entities.getById(this.selectedMarker.id).position._value);
-          let position = this.convertWorldToCartographic(this.viewer2D.entities.getById(this.selectedMarker.id).position._value)
+//     pointMove() {
+//       // 监听鼠标左键点击事件
+//       this.handler2D.setInputAction((event) => {
+//         if (!this.selectedMarker && !this.modeltooltip) {
+//           const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
+//           const pickedEntity = this.viewer2D.scene.pick(screenPosition);
+//           if (this.Cesium.defined(pickedEntity)) {
+//             for (const entity of this.viewer2D.entities.values) {
+//               if (pickedEntity.id.id === entity.id) {
+//                 this.selectedMarker = entity;
+//                 this.oldPosition = pickedEntity.id.position;
+//                 // 显示提示
+//                 this.selectModel("pointer", null, "右键取消");
+//               }
+//             }
+//           }
+//         } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           // const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
+//           console.log('this.viewer2D.entities.values :>> ', this.viewer2D.entities.getById(this.selectedMarker.id).position._value);
+//           let position = this.convertWorldToCartographic(this.viewer2D.entities.getById(this.selectedMarker.id).position._value)
         
-          let name = ''
-          for(let i = 0;i<this.nameIdList.length;i++){
+//           let name = ''
+//           for(let i = 0;i<this.nameIdList.length;i++){
           
-            if(this.nameIdList[i].id == this.selectedMarker.id){
-              name = this.nameIdList[i].name
-            }
-          }
-          for(let i = 0;i<this.jsonData.blueunit.length;i++){
-            if(name == this.jsonData.blueunit[i].name){
-              this.jsonData.blueunit[i].pos.lat = position.latitude.toFixed(6)
-              this.jsonData.blueunit[i].pos.lon = position.longitude.toFixed(6)
-              this.jsonData.blueunit[i].pos.h = position.height.toFixed(2)
-            }
-          }
-          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)
-            }
-          }
-          for(let i = 0;i<this.jsonData.center.length;i++){
-            if(name == this.jsonData.center[i].name){
-              this.jsonData.center[i][name].properties.lon = position.longitude.toFixed(6)
-              this.jsonData.center[i][name].properties.lat = position.latitude.toFixed(6)
-              this.jsonData.center[i][name].properties.h = position.height.toFixed(2)
-              for(let j = 0;j<this.jsonData.redunit.length;j++){
-              this.jsonData.redunit[j].component_movementjson.properties.target_lon = position.longitude.toFixed(6)
-              this.jsonData.redunit[j].component_movementjson.properties.target_lat = position.latitude.toFixed(6)
-              this.jsonData.redunit[j].component_movementjson.properties.target_h = position.height.toFixed(2)
-          }
-// 新的终点坐标
-const newEndPoint = this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, position.height);
-// 遍历所有的entity对象
-this.viewer2D.entities.values.forEach(entity => {
-  // 检查entity是否为Polyline类型
-  if (entity instanceof this.Cesium.Entity && entity.polyline) {
-    // 获取原始的Polyline坐标数组
-    const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
-
-    // 修改终点坐标为新的坐标
-    positions[positions.length - 1] = newEndPoint;
-
-    // 更新entity的Polyline坐标
-    entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
-  }
-});
-this.viewer3D.entities.values.forEach(entity => {
-  // 检查entity是否为Polyline类型
-  if (entity instanceof this.Cesium.Entity && entity.polyline) {
-    // 获取原始的Polyline坐标数组
-    const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
-
-    // 修改终点坐标为新的坐标
-    positions[positions.length - 1] = newEndPoint;
-
-    // 更新entity的Polyline坐标
-    entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
-  }
-});
-            }
+//             if(this.nameIdList[i].id == this.selectedMarker.id){
+//               name = this.nameIdList[i].name
+//             }
+//           }
+//           for(let i = 0;i<this.jsonData.blueunit.length;i++){
+//             if(name == this.jsonData.blueunit[i].name){
+//               this.jsonData.blueunit[i].pos.lat = position.latitude.toFixed(6)
+//               this.jsonData.blueunit[i].pos.lon = position.longitude.toFixed(6)
+//               this.jsonData.blueunit[i].pos.h = position.height.toFixed(2)
+//             }
+//           }
+//           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)
+//             }
+//           }
+//           for(let i = 0;i<this.jsonData.center.length;i++){
+//             if(name == this.jsonData.center[i].name){
+//               this.jsonData.center[i][name].properties.lon = position.longitude.toFixed(6)
+//               this.jsonData.center[i][name].properties.lat = position.latitude.toFixed(6)
+//               this.jsonData.center[i][name].properties.h = position.height.toFixed(2)
+//               for(let j = 0;j<this.jsonData.redunit.length;j++){
+//               this.jsonData.redunit[j].component_movementjson.properties.target_lon = position.longitude.toFixed(6)
+//               this.jsonData.redunit[j].component_movementjson.properties.target_lat = position.latitude.toFixed(6)
+//               this.jsonData.redunit[j].component_movementjson.properties.target_h = position.height.toFixed(2)
+//           }
+// // 新的终点坐标
+// const newEndPoint = this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, position.height);
+// // 遍历所有的entity对象
+// this.viewer2D.entities.values.forEach(entity => {
+//   // 检查entity是否为Polyline类型
+//   if (entity instanceof this.Cesium.Entity && entity.polyline) {
+//     // 获取原始的Polyline坐标数组
+//     const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
+
+//     // 修改终点坐标为新的坐标
+//     positions[positions.length - 1] = newEndPoint;
+
+//     // 更新entity的Polyline坐标
+//     entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
+//   }
+// });
+// this.viewer3D.entities.values.forEach(entity => {
+//   // 检查entity是否为Polyline类型
+//   if (entity instanceof this.Cesium.Entity && entity.polyline) {
+//     // 获取原始的Polyline坐标数组
+//     const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
+
+//     // 修改终点坐标为新的坐标
+//     positions[positions.length - 1] = newEndPoint;
+
+//     // 更新entity的Polyline坐标
+//     entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
+//   }
+// });
+//             }
            
-          }
-
-          // this.viewer2D.entities.add({
-          //   polyline: {
-          //     positions: [
-          //       this.oldPosition._value,
-          //       this.viewer2D.entities.getById(this.selectedMarker.id).position._value
-          //     ],
-          //     width: 5, // 设置线的宽度
-          //     material: material,
-          //     followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
-          //   }
-          // });
-          // this.viewer3D.entities.add({
-          //   polyline: {
-          //     positions: [
-          //       this.oldPosition._value,
-          //       this.viewer3D.entities.getById(this.selectedMarker.id).position._value
-          //     ],
-          //     width: 5, // 设置线的宽度
-          //     material: material,
-          //     followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
-          //   }
-          // });
-          console.log('this.jsonData :>> ', this.jsonData);
-          this.selectedMarker = null;
-          this.selectModel();
-        }
-      }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
-      // 监听鼠标移动事件,用于移动标记点
-      this.handler2D.setInputAction((event) => {
-        if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
-          const position = this.viewer2D.scene.camera.pickEllipsoid(screenPosition);
-          this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
-          this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
-        }
-      }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
-      // 监听右键
-      this.handler2D.setInputAction(() => {
-        if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          this.viewer2D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
-          this.selectedMarker = null;
-          this.selectModel();
-        }
-      }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
-      this.handler3D.setInputAction((event) => {
-        if (!this.selectedMarker && !this.modeltooltip) {
-          const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
-          const pickedEntity = this.viewer3D.scene.pick(screenPosition);
-          if (this.Cesium.defined(pickedEntity)) {
-            for (const entity of this.viewer3D.entities.values) {
-              if (pickedEntity.id.id === entity.id) {
-                this.selectedMarker = entity;
-                this.oldPosition = pickedEntity.id.position;
-                // 显示提示
-                this.selectModel("pointer", null, "右键取消");
-              }
-            }
-          }
-        } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
-          this.viewer2D.entities.add({
-            polyline: {
-              positions: [
-                this.oldPosition._value,
-                this.viewer2D.entities.getById(this.selectedMarker.id).position._value
-              ],
-              width: 5, // 设置线的宽度
-              material: material,
-              followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
-            }
-          });
-          this.viewer3D.entities.add({
-            polyline: {
-              positions: [
-                this.oldPosition._value,
-                this.viewer3D.entities.getById(this.selectedMarker.id).position._value
-              ],
-              width: 5, // 设置线的宽度
-              material: material,
-              followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
-            }
-          });
-          this.selectedMarker = null;
-          this.selectModel();
-        }
-      }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
-      // 监听鼠标移动事件,用于移动标记点
-      this.handler3D.setInputAction((event) => {
-        if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
-          const position = this.viewer3D.scene.camera.pickEllipsoid(screenPosition);
-          this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
-          this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
-        }
-      }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
-      // 监听右键
-      this.handler3D.setInputAction(() => {
-        if (this.selectedMarker && this.modeltooltip === "右键取消") {
-          this.viewer3D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
-          this.selectedMarker = null;
-          this.selectModel();
-        }
-      }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
-    }
+//           }
+
+//           // this.viewer2D.entities.add({
+//           //   polyline: {
+//           //     positions: [
+//           //       this.oldPosition._value,
+//           //       this.viewer2D.entities.getById(this.selectedMarker.id).position._value
+//           //     ],
+//           //     width: 5, // 设置线的宽度
+//           //     material: material,
+//           //     followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
+//           //   }
+//           // });
+//           // this.viewer3D.entities.add({
+//           //   polyline: {
+//           //     positions: [
+//           //       this.oldPosition._value,
+//           //       this.viewer3D.entities.getById(this.selectedMarker.id).position._value
+//           //     ],
+//           //     width: 5, // 设置线的宽度
+//           //     material: material,
+//           //     followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
+//           //   }
+//           // });
+//           console.log('this.jsonData :>> ', this.jsonData);
+//           this.selectedMarker = null;
+//           this.selectModel();
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
+//       // 监听鼠标移动事件,用于移动标记点
+//       this.handler2D.setInputAction((event) => {
+//         if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
+//           const position = this.viewer2D.scene.camera.pickEllipsoid(screenPosition);
+//           this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
+//           this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
+//       // 监听右键
+//       this.handler2D.setInputAction(() => {
+//         if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           this.viewer2D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
+//           this.selectedMarker = null;
+//           this.selectModel();
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
+//       this.handler3D.setInputAction((event) => {
+//         if (!this.selectedMarker && !this.modeltooltip) {
+//           const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
+//           const pickedEntity = this.viewer3D.scene.pick(screenPosition);
+//           if (this.Cesium.defined(pickedEntity)) {
+//             for (const entity of this.viewer3D.entities.values) {
+//               if (pickedEntity.id.id === entity.id) {
+//                 this.selectedMarker = entity;
+//                 this.oldPosition = pickedEntity.id.position;
+//                 // 显示提示
+//                 this.selectModel("pointer", null, "右键取消");
+//               }
+//             }
+//           }
+//         } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
+//           this.viewer2D.entities.add({
+//             polyline: {
+//               positions: [
+//                 this.oldPosition._value,
+//                 this.viewer2D.entities.getById(this.selectedMarker.id).position._value
+//               ],
+//               width: 5, // 设置线的宽度
+//               material: material,
+//               followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
+//             }
+//           });
+//           this.viewer3D.entities.add({
+//             polyline: {
+//               positions: [
+//                 this.oldPosition._value,
+//                 this.viewer3D.entities.getById(this.selectedMarker.id).position._value
+//               ],
+//               width: 5, // 设置线的宽度
+//               material: material,
+//               followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
+//             }
+//           });
+//           this.selectedMarker = null;
+//           this.selectModel();
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
+//       // 监听鼠标移动事件,用于移动标记点
+//       this.handler3D.setInputAction((event) => {
+//         if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
+//           const position = this.viewer3D.scene.camera.pickEllipsoid(screenPosition);
+//           this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
+//           this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
+//       // 监听右键
+//       this.handler3D.setInputAction(() => {
+//         if (this.selectedMarker && this.modeltooltip === "右键取消") {
+//           this.viewer3D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
+//           this.selectedMarker = null;
+//           this.selectModel();
+//         }
+//       }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
+//     }
   }
 };
 </script>