소스 검색

自定义飞行添加飞行速度设置

lkk 1 년 전
부모
커밋
470b0565e8
1개의 변경된 파일201개의 추가작업 그리고 35개의 파일을 삭제
  1. 201 35
      src/components/sceneAtttribute/camera/camera.vue

+ 201 - 35
src/components/sceneAtttribute/camera/camera.vue

@@ -15,13 +15,29 @@
           <input type="file" accept=".fpf" id="flyFile" style="width: 100%" />
         </div>
         <div class="flybox">
-          <i class="el-icon-video-play flyBtn" @click="flyStart" :title="Resource.startFly"></i>
-          <i class="el-icon-video-pause flyBtn" @click="flyPause" :title="Resource.pauseFly"></i>
-          <i class="el-icon-document-delete flyBtn" @click="flyStop" :title="Resource.stopFly"></i>
+          <i
+            class="el-icon-video-play flyBtn"
+            @click="flyStart"
+            :title="Resource.startFly"
+          ></i>
+          <i
+            class="el-icon-video-pause flyBtn"
+            @click="flyPause"
+            :title="Resource.pauseFly"
+          ></i>
+          <i
+            class="el-icon-document-delete flyBtn"
+            @click="flyStop"
+            :title="Resource.stopFly"
+          ></i>
         </div>
         <div class="sm-function-module-sub-section">
           <label class="label-container">{{ Resource.stopChoose }}</label>
-          <select class="sm-select" id="stopList" v-model="stopSelected"></select>
+          <select
+            class="sm-select"
+            id="stopList"
+            v-model="stopSelected"
+          ></select>
         </div>
         <div class="sm-function-module-sub-section">
           <label class="label-container">{{ Resource.observe }}</label>
@@ -45,8 +61,24 @@
           </div>
           <label class="label-container">{{ Resource.rotateSpeed }}</label>
           <div class="sm-solider-input-box">
-            <input class="min-solider" min="0" max="50" step="0.1" style="width: 63%" type="range" v-model="speed" />
-            <input class="min-solider" min="0" max="50" step="0.1" style="width: 34%" type="number" v-model="speed" />
+            <input
+              class="min-solider"
+              min="0"
+              max="50"
+              step="0.1"
+              style="width: 63%"
+              type="range"
+              v-model="speed"
+            />
+            <input
+              class="min-solider"
+              min="0"
+              max="50"
+              step="0.1"
+              style="width: 34%"
+              type="number"
+              v-model="speed"
+            />
           </div>
         </div>
         <div class="sm-function-module-sub-section">
@@ -60,7 +92,12 @@
             <label class="label-container">{{
               Resource.cameraMinimumZoomDistance
             }}</label>
-            <input class="sm-input-long" min="0" type="number" v-model="cameraMinimumZoomDistance" />
+            <input
+              class="sm-input-long"
+              min="0"
+              type="number"
+              v-model="cameraMinimumZoomDistance"
+            />
           </div>
           <div class="sm-function-module-sub-section">
             <label class="label-container">{{
@@ -76,8 +113,15 @@
             /> -->
             <!-- 地表透明度 -->
             <div class="sm-solider-input-box">
-              <input class="min-solider" min="0" max="1" step="0.01" style="width: 63%" type="range"
-                v-model="SurfaceTransparency" />
+              <input
+                class="min-solider"
+                min="0"
+                max="1"
+                step="0.01"
+                style="width: 63%"
+                type="range"
+                v-model="SurfaceTransparency"
+              />
               <span>{{ SurfaceTransparency }}</span>
               <!-- <input class="min-solider" min="0" max="1" step="0.01" style="width: 24%" type="number"
                 v-model="SurfaceTransparency" /> -->
@@ -87,9 +131,19 @@
       </TabPane>
       <TabPane :label="Resource.createFlyRoute" name="cjfxxl">
         <div class="icon-list" style="width: 12.96rem">
-          <span v-for="(item, index) in state.itemOptions" :key="index" class="icon-span" :title="item.lable"
-            :class="item.isSelect ? 'selected-icon' : ''" @click="changleIconItem(item)">
-            <i class="iconfont iconSize" :class="item.iconName" style="margin-top: 0px"></i>
+          <span
+            v-for="(item, index) in state.itemOptions"
+            :key="index"
+            class="icon-span"
+            :title="item.lable"
+            :class="item.isSelect ? 'selected-icon' : ''"
+            @click="changleIconItem(item)"
+          >
+            <i
+              class="iconfont iconSize"
+              :class="item.iconName"
+              style="margin-top: 0px"
+            ></i>
           </span>
         </div>
         <div v-show="state.customRouteNames.length > 0">
@@ -103,7 +157,12 @@
                 value-field="index"
               /> -->
               <el-select v-model="state.selectedAddedStopIndex">
-                <el-option v-for="item in state.routeStops" :key="item.value" :label="item.stopName" :value="item.index">
+                <el-option
+                  v-for="item in state.routeStops"
+                  :key="item.value"
+                  :label="item.stopName"
+                  :value="item.index"
+                >
                 </el-option>
               </el-select>
             </div>
@@ -112,37 +171,71 @@
           <div class="row-item" style="margin-bottom: 0px">
             <span></span>
             <div class="row-content" style="display: flex">
-              <el-checkbox v-model="showRoute" /><span class="checkbox-lable">显示路线</span>
-              <el-checkbox v-model="showStop" /><span class="checkbox-lable">显示站点</span>
+              <el-checkbox v-model="showRoute" /><span class="checkbox-lable"
+                >显示路线</span
+              >
+              <el-checkbox v-model="showStop" /><span class="checkbox-lable"
+                >显示站点</span
+              >
             </div>
           </div>
 
           <div>
             <label class="label-container">飞行速度</label>
             <div class="sm-solider-input-box">
-              <input class="min-solider" min="0" max="500" step="1" style="width: 63%" type="range"
-                v-model="state.routeSpeed" />
-              <span>{{ state.routeSpeed }}</span>
+              <input
+                class="min-solider"
+                :update-value-on-input="false"
+                :min="0"
+                :max="500"
+                :step="1"
+                style="width: 63%"
+                type="range"
+                v-model="routeSpeed"
+              />
+              <span>{{ routeSpeed }}</span>
             </div>
           </div>
 
           <!-- <div class="block">
             <span class="demonstration">飞行速度</span>
-            <el-slider v-model="state.routeSpeed" step="1" min="0" max="500" style="width: 63%"></el-slider>
-            <span>{{ state.routeSpeed }}</span>
+            <el-slider v-model="routeSpeed" step="1" min="0" max="500" style="width: 63%;pointer-events:all;"></el-slider>
+            <span>{{ routeSpeed }}</span>
           </div> -->
 
           <div class="icon-list" style="width: 12.96rem">
-            <span v-for="(item, index) in state.actionOptions" :key="index" class="icon-span" :title="item.lable"
-              :class="item.isSelect ? 'selected-icon' : ''" @click="changleIconItemAction(item)">
-              <i class="iconfont iconSize" :class="item.iconName" style="margin-top: 0px"></i>
+            <span
+              v-for="(item, index) in state.actionOptions"
+              :key="index"
+              class="icon-span"
+              :title="item.lable"
+              :class="item.isSelect ? 'selected-icon' : ''"
+              @click="changleIconItemAction(item)"
+            >
+              <i
+                class="iconfont iconSize"
+                :class="item.iconName"
+                style="margin-top: 0px"
+              ></i>
             </span>
           </div>
 
           <div class="btn-row-item" style="margin-left: 0.94rem">
-            <el-button type="info" color="#3499E5" text-color="#fff" @click="downLoad"
-              style="margin-right: 0.1rem; margin-left: 0.03rem">下载</el-button>
-            <el-button class="btn-secondary" @click="clearRoute" color="rgba(255, 255, 255, 0.65)" ghost>清除</el-button>
+            <el-button
+              type="info"
+              color="#3499E5"
+              text-color="#fff"
+              @click="downLoad"
+              style="margin-right: 0.1rem; margin-left: 0.03rem"
+              >下载</el-button
+            >
+            <el-button
+              class="btn-secondary"
+              @click="clearRoute"
+              color="rgba(255, 255, 255, 0.65)"
+              ghost
+              >清除</el-button
+            >
           </div>
         </div>
         <!-- <rotate></rotate> -->
@@ -151,7 +244,11 @@
           <!-- <div style="width: 12.96rem">
           <n-switch v-model="state.rotateShow" size="small" />
         </div> -->
-          <el-switch v-model="state.rotateShow" active-color="#13ce66" inactive-color="#ff4949">
+          <el-switch
+            v-model="state.rotateShow"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+          >
           </el-switch>
         </div>
         <div v-show="state.rotateShow">
@@ -171,8 +268,24 @@
           </div>
           <label class="label-container">{{ Resource.rotateSpeed }}</label>
           <div class="sm-solider-input-box">
-            <input class="min-solider" min="0" max="50" step="0.1" style="width: 63%" type="range" v-model="speed" />
-            <input class="min-solider" min="0" max="50" step="0.1" style="width: 34%" type="number" v-model="speed" />
+            <input
+              class="min-solider"
+              min="0"
+              max="50"
+              step="0.1"
+              style="width: 63%"
+              type="range"
+              v-model="speed"
+            />
+            <input
+              class="min-solider"
+              min="0"
+              max="50"
+              step="0.1"
+              style="width: 34%"
+              type="number"
+              v-model="speed"
+            />
           </div>
         </div>
       </TabPane>
@@ -218,7 +331,6 @@ export default {
       SurfaceTransparency: 0,
       cameraMinimumZoomDistance: -1000,
       isDestroyFlag: true,
-
       // 设置默认值数据
       state: {
         routeType: "customRoute", //自定义还得指定路线类型
@@ -244,7 +356,7 @@ export default {
         surroundDuration: 1, //环绕模式时间
         //飞行路线设置
         isAlongline: false, //获取或者设置该飞行路线是否是沿线飞行。
-        routeSpeed: 200, //飞行路线速度
+        //routeSpeed: 200, //飞行路线速度
         isSaveAutoFlag: false,
         //   allRoutes:[]
         itemOptions: [
@@ -296,6 +408,7 @@ export default {
       },
       showRoute: false, //显示路线
       showStop: false, //显示站点
+      routeSpeed: 200,
     };
   },
 
@@ -327,7 +440,7 @@ export default {
     //初始化站点文件保存
     this.$nextTick((res) => {
       this.initFlyManager();
-    })
+    });
     const fileInput = document.getElementById("flyFile");
     fileInput.addEventListener("change", function (event) {
       let routes = new Cesium.RouteCollection(viewer.entities);
@@ -587,13 +700,48 @@ export default {
       // this.state.surroundDuration = 1;
     },
 
+    // // 保存站点
+    // saveStop() {
+    //   if (this.state.routeStops.length < 2) {
+    //     if (this.state.customRouteNames.length == 0) {
+    //       this.$message.waring("至少两个节点才能保存");
+    //     }
+    //     return;
+    //   }
+
+    //   // 飞行路线配置
+    //   let route = {
+    //     routeName: "飞行路线-1",
+    //     index: this.state.addCurrentRouteIndex,
+    //     speed: this.routeSpeed,
+    //     isAlongLine: "False",
+    //     routeStops: this.state.routeStops,
+    //   };
+    //   let xml = createXml.createXMLflyLine(route);
+    //   flyLineXmls[0] = xml;
+    //   this.state.isSaveAutoFlag = true; //一旦点击保存,开启实时自动保存
+    //   // 保证只有一条飞行路线
+    //   if (this.state.customRouteNames.length === 0) {
+    //     this.state.customRouteNames.push({
+    //       label: route.routeName,
+    //       value: route.index,
+    //     });
+    //   }
+    //   this.updateRouteCollection();
+    //   this.state.addCurrentRouteIndex++;
+    //   if (this.state.customRouteSelectedIndex === null)
+    //     this.state.customRouteSelectedIndex = 0;
+    // },
+
     // 保存站点
     saveStop() {
-      console.log(5, this.state.routeStops);
       if (this.state.routeStops.length < 2) {
         if (this.state.customRouteNames.length == 0) {
+          // notification.create({
+          //   content: () => ("至少两个节点才能保存"),
+          //   duration: 3500,
+          // });
           this.$message.waring("至少两个节点才能保存");
-          console.log(1111);
         }
         return;
       }
@@ -602,10 +750,12 @@ export default {
       let route = {
         routeName: "飞行路线-1",
         index: this.state.addCurrentRouteIndex,
-        speed: this.state.routeSpeed,
+        speed: this.routeSpeed,
         isAlongLine: "False",
         routeStops: this.state.routeStops,
       };
+
+      console.log(this.routeSpeed, "this.routeSpeed");
       let xml = createXml.createXMLflyLine(route);
       flyLineXmls[0] = xml;
       this.state.isSaveAutoFlag = true; //一旦点击保存,开启实时自动保存
@@ -617,6 +767,7 @@ export default {
         });
       }
       this.updateRouteCollection();
+
       this.state.addCurrentRouteIndex++;
       if (this.state.customRouteSelectedIndex === null)
         this.state.customRouteSelectedIndex = 0;
@@ -788,6 +939,21 @@ export default {
       let route = flyManager.currentRoute;
       if (route) route.isStopVisible = val;
     },
+    //routeSpeed(val) {
+    //   this.saveStop();
+    // },
+    // 监听myObject对象的变化
+    routeSpeed: {
+      handler: function (newValue, oldValue) {
+        // 当myObject对象的属性发生变化时,这个函数会被调用
+        // console.log('state changed:', newValue, oldValue);
+        if (newValue != oldValue) {
+          this.saveStop();
+          this.flyStart(); //开始
+        }
+      },
+      deep: true, // 表示要深度监听
+    },
   },
 };
 </script>