Browse Source

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

gushoubang 3 months ago
parent
commit
c21e4e2791

+ 4 - 4
src/components/Combinations/LayerManage/LayerManage.vue

@@ -297,10 +297,10 @@ export default {
               item.style3D = style;  
              }
             item.brightness = 1.2;
-            item.contrast = 1.2;
-            item.saturation = 1.2;
-            item.gamma = 1.1;
-            item.shadowType = 2;
+            // item.contrast = 1.2;
+            // item.saturation = 1.2;
+            // item.gamma = 1.1;
+            // item.shadowType = 2;
             if (
               item.name.indexOf("雨水") > -1 ||
               item.name.indexOf("管线") > -1 ||

+ 145 - 43
src/components/sceneAtttribute/camera/camera.vue

@@ -14,6 +14,32 @@
           <span>{{ Resource.flyRoute }}</span>
           <input type="file" accept=".fpf" id="flyFile" style="width: 100%" />
         </div>
+        <div class="sm-function-module-sub-section">
+          <label class="label-container">{{ Resource.flySpeed }}</label>
+          <div class="sm-solider-input-box">
+            <input
+              class="min-solider"
+              min="1"
+              max="1000"
+              step="1"
+              style="width: 63%"
+              type="range"
+              v-model="flySpeed"
+              @change="updateFlySpeed"
+            />
+            <input
+              class="min-solider"
+              min="1"
+              max="1000"
+              step="1"
+              style="width: 34%"
+              type="number"
+              v-model="flySpeed"
+              @change="updateFlySpeed"
+            />
+          </div>
+        </div>
+
         <div class="flybox">
           <i
             class="el-icon-video-play flyBtn"
@@ -291,7 +317,7 @@
       </TabPane>
     </Tabs>
   </div>
-</template>
+</template> 
 
 <script>
 let flyManager,
@@ -321,6 +347,14 @@ export default {
   },
   data() {
     return {
+      // 新增飞行速度变量,默认200
+      flySpeed: 200,
+      // 记录当前飞行状态用于速度调整
+      currentFlightState: {
+        isPaused: false,
+        currentStopIndex: 0,
+        progress: 0, // 记录在当前段的飞行进度(0-1)
+      },
       sharedState: store.state,
       stopSelected: [],
       stopFlyCircle: false,
@@ -467,9 +501,9 @@ export default {
       });
       if (flyManager.readyPromise) {
         Cesium.when(flyManager.readyPromise, function () {
-          let currentRoute = flyManager.currentRoute;
-          currentRoute.isLineVisible = true;
-          currentRoute.isStopVisible = true;
+          // let currentRoute = flyManager.currentRoute;
+          // currentRoute.isLineVisible = false;
+          // currentRoute.isStopVisible = true;
 
           let allStops = flyManager.getAllRouteStops();
           let menu = document.getElementById("stopList");
@@ -497,55 +531,126 @@ export default {
       camera.flyCircleLoop = true;
     },
     flyStart() {
-      if (flyManager && this.routeSpeed !=0) {
+      if (flyManager) {
+        // 如果是从暂停状态恢复,保持当前速度
         flyManager.play();
-      } else {
-        let routes = new Cesium.RouteCollection(viewer.entities);
-        let fileInput = document.getElementById("flyFile");
-        let file = fileInput.files[0];
-        if (!file) {
-          return; // 没有选择fpf文件无法开始执行
-        }
-        let reader = new FileReader();
-        reader.onload = function (e) {
-          // 读取操作完成时出发
-          let XMLContent = e.target.result;
+        return;
+      }
 
-          routes.fromXML(XMLContent);
-        };
-        reader.readAsBinaryString(file);
-        //创建飞行管理对象
+      // 新创建飞行管理器时设置初始速度
+      let routes = new Cesium.RouteCollection(viewer.entities);
+      let fileInput = document.getElementById("flyFile");
+      let file = fileInput.files[0];
+      if (!file) return;
+
+      let reader = new FileReader();
+      reader.onload = (e) => {
+        let XMLContent = e.target.result;
+        routes.fromXML(XMLContent);
+
+        // 创建飞行管理对象时设置速度
         flyManager = new Cesium.FlyManager({
           scene: scene,
           routes: routes,
+          speed: this.flySpeed, // 设置初始速度
+        });
+
+        // 监听站点到达事件,更新当前状态
+        flyManager.stopArrived.addEventListener((routeStop) => {
+          this.currentFlightState.currentStopIndex = routeStop.index;
+          this.currentFlightState.progress = 0;
         });
-        flyManager.stopArrived.addEventListener(function (routeStop) {
-          routeStop.waitTime = 1;
+
+        // 监听飞行进度事件,更新当前进度
+        flyManager.update.addEventListener((progress) => {
+          this.currentFlightState.progress = progress;
         });
+
+        // 原有就绪逻辑
         if (flyManager.readyPromise) {
-          Cesium.when(flyManager.readyPromise, function () {
-            let currentRoute = flyManager.currentRoute;
-            currentRoute.isLineVisible = true;
-            currentRoute.isStopVisible = true;
-
-            let allStops = flyManager.getAllRouteStops();
-            let menu = document.getElementById("stopList");
-            for (let i = 0, j = allStops.length; i < j; i++) {
-              let option = document.createElement("option");
-              option.textContent = Resource.stop + (i + 1);
-              option.value = allStops[i].index;
-              menu.appendChild(option);
-            }
+          Cesium.when(flyManager.readyPromise, () => {
+            // 原有站点列表逻辑...
             flyManager.play();
           });
         }
+      };
+      reader.readAsBinaryString(file);
+    },
+
+    // 新增速度更新方法
+    updateFlySpeed() {
+      if (!flyManager) return;
+
+      // 保存当前飞行状态(关键改进:更精确的状态保存)
+      const currentStopIndex = flyManager.currentStopIndex || 0;
+      const nextStopIndex = currentStopIndex + 1;
+      let progressInSegment = 0;
+
+      // 获取当前段的飞行进度(如果支持)
+      if (flyManager.getSegmentProgress) {
+        progressInSegment = flyManager.getSegmentProgress() || 0;
+      }
+      const isPlaying =
+        flyManager.isPaused !== undefined ? !flyManager.isPaused : false;
+
+      // 1. 更新当前路线速度(不重建路线,直接修改现有实例)
+      const currentRoute = flyManager.currentRoute;
+      if (currentRoute) {
+        currentRoute.speed = this.flySpeed;
+
+        // 2. 更新所有站点速度
+        let allStops = [];
+        if (
+          flyManager.getAllRouteStops &&
+          typeof flyManager.getAllRouteStops === "function"
+        ) {
+          allStops = flyManager.getAllRouteStops() || [];
+        }
+
+        // 修复length错误:确保是数组才遍历
+        if (Array.isArray(allStops)) {
+          allStops.forEach((stop) => {
+            if (stop && typeof stop.speed !== "undefined") {
+              stop.speed = this.flySpeed;
+            }
+          });
+        }
+
+        // 3. 不重建路线,而是调整当前飞行参数(关键改进)
+        if (isPlaying) {
+          flyManager.pause();
+
+          // 仅在有下一个站点时调整进度,避免从头开始
+          if (nextStopIndex < allStops.length) {
+            flyManager.goToStop(currentStopIndex);
+            // 如果支持设置段内进度,精确恢复位置
+            if (flyManager.setSegmentProgress) {
+              flyManager.setSegmentProgress(progressInSegment);
+            }
+          }
+
+          flyManager.play();
+        }
       }
     },
     flyPause() {
-      flyManager && flyManager.pause();
+      if (flyManager) {
+        flyManager.pause();
+        this.currentFlightState.isPaused = true;
+      }
     },
+
+    // 停止方法
     flyStop() {
-      flyManager && flyManager.stop();
+      if (flyManager) {
+        flyManager.stop();
+        // 重置飞行状态
+        this.currentFlightState = {
+          isPaused: false,
+          currentStopIndex: 0,
+          progress: 0,
+        };
+      }
     },
     onSpinClk(evt) {
       this.isDestroyFlag = false;
@@ -734,11 +839,7 @@ export default {
     saveStop() {
       if (this.state.routeStops.length < 2) {
         if (this.state.customRouteNames.length == 0) {
-          // notification.create({
-          //   content: () => ("至少两个节点才能保存"),
-          //   duration: 3500,
-          // });
-          this.$message.waring("至少两个节点才能保存");
+          this.$message.warning("至少两个节点才能保存");
         }
         return;
       }
@@ -810,6 +911,7 @@ export default {
         routes: routeCollection,
       });
       createXml = new createFlyLine_xml();
+      this.flySpeed = 200; // 设置初始速度
     },
 
     // 操作切换
@@ -944,7 +1046,7 @@ export default {
         if (newValue != oldValue && newValue != 0) {
           this.saveStop();
           this.flyStart(); //开始
-        }else{
+        } else {
           this.flyStop();
         }
       },

+ 4 - 4
src/views/ConstructionApplication3D/SunlightAnalysis/SunlightAnalysis.vue

@@ -209,10 +209,10 @@ import {
   pointGrid,
 } from "@turf/turf";
 // # 引入kriging-contour
-import {
-  getVectorContour,
-  drawCanvasContour,
-} from "kriging-contour/dist/kriging-contour.js";
+// import {
+//   getVectorContour,
+//   drawCanvasContour,
+// } from "kriging-contour/dist/kriging-contour.js"; //影响倾斜数据加载无法显示,暂时注释
 // import { getSunrise, getSunset } from "sunrise-sunset-js";
 import {
   cartesian3ToWGS84,

+ 4 - 4
src/views/ConstructionApplication3D/SunlightAnalysis/SunlightAnalysisCT.vue

@@ -263,10 +263,10 @@ import {
   invariant
 } from "@turf/turf";
 // # 引入kriging-contour
-import {
-  getVectorContour,
-  drawCanvasContour,
-} from "kriging-contour/dist/kriging-contour.js";
+// import {
+//   getVectorContour,
+//   drawCanvasContour,
+// } from "kriging-contour/dist/kriging-contour.js"; //影响倾斜数据加载无法显示,暂时注释
 // import { getSunrise, getSunset } from "sunrise-sunset-js";
 import {
   cartesian3ToWGS84,

+ 4 - 4
src/views/ConstructionApplication3D/SunlightAnalysis/SunlightAnalysisSX.vue

@@ -240,10 +240,10 @@ import {
   pointGrid,
 } from "@turf/turf";
 // # 引入kriging-contour
-import {
-  getVectorContour,
-  drawCanvasContour,
-} from "kriging-contour/dist/kriging-contour.js";
+// import {
+//   getVectorContour,
+//   drawCanvasContour,
+// } from "kriging-contour/dist/kriging-contour.js"; //影响倾斜数据加载无法显示,暂时注释
 // import { getSunrise, getSunset } from "sunrise-sunset-js";
 import {
   cartesian3ToWGS84,

+ 1 - 3
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -586,11 +586,9 @@ export default {
         id: store.state.cockpit_region.id,
         ...params,
       };
-      if (this.title == "国有建设用地完成项目" || this.title == "山水工程项目") {
+      if (this.title == "山水工程项目") {
         obj.beginTime = undefined;
         obj.endTime = undefined;
-        if (this.title == "国有建设用地完成项目")
-          obj.val0 = store.state.cockpit_date[0].split("-")[0];
       }
       if (this.title == "进出平衡") {
         (obj.jscType = "jsc_gdbh_jcph_zbmc"),

+ 3 - 3
src/views/cockpit/tdsy.vue

@@ -269,8 +269,8 @@ export default {
       let obj = {
         jscType: "jsc_tdgy_gy_ztsh",
         id: params ? params.id : "4602",
-        val0: params ? params.beginTime : store.state.cockpit_date[0],
-        // val1: params ? params.beginTime : store.state.cockpit_date[1],
+        beginTime: params ? params.beginTime : store.state.cockpit_date[0],
+        endTime: params ? params.endTime : store.state.cockpit_date[1],
       };
       let data = await QueryList(obj);
 
@@ -1118,7 +1118,7 @@ export default {
       that.init_tdgy_jt_jd();
       that.init_info();
       that.init_echart_data();
-      that.init_vector();
+      // that.init_vector();
 
       // this.gy_jd_entity = new Cesium.CustomDataSource("gy_jd_entity");
       // viewer.dataSources.add(this.gy_jd_entity);

+ 3 - 3
src/views/geologyDisaster/index.vue

@@ -101,13 +101,14 @@ export default {
 
     },
     addTerrain(LayerURL) {
+      viewer.scene.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
       viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
         url: LayerURL,
         isSct: true,
         requestVertexNormals: true,
       })
 
-      // this.bus.$emit("setDepthAgainst", true);
+      this.bus.$emit("setDepthAgainst", true);
       viewer.terrainProvider.readyPromise.then(() => {
         console.error('地形加载成功: ');
         this.searchFun();
@@ -142,8 +143,7 @@ export default {
         // getHight(item.lzb_x, item.bzb_y, (gcHight) => {
         // this.table.data[index].hight = gcHight
         // console.log(gcHight)
-        let geom = `POINT (${item.lzb_x} ${item.bzb_y} ${item.hight - 20})`
-        console.log(geom, 'geom')
+        let geom = `POINT (${item.lzb_x} ${item.bzb_y} ${item.hight})`
         loadGeoJSON(geom, "#facd91", { isfly: false, point: 'landslide' }, (data) => {
           geoSources[item.bsm] = data;
           data.name = "dzzh";

+ 1 - 0
src/views/map3d.vue

@@ -187,6 +187,7 @@ export default {
       this.updateTime();
     }, 1000);
     this.updateTime();
+    // let promise = viewer.scene.open("http://192.168.60.64:9001/iserver/services/3D-sanya/rest/realspace")
   },
   methods: {
     getFly() {

+ 77 - 0
src/views/map3dtest.vue

@@ -0,0 +1,77 @@
+<template>
+    <div id="app">
+        <!-- <sm-viewer @viewerChange="viewerChange" :isdefaultbig="true"> </sm-viewer> -->
+
+        <!-- <sm-viewer @viewerChange="viewerChange" :isdefaultbig="true"> </sm-viewer> -->
+        <div id="cesiumContainer"> </div>
+    </div>
+</template>
+
+<script>
+import { getRouters } from "@/api/menu";
+import aiModel from "./aiModel/index.vue";
+import { addLight } from "@/utils/MapHelper/map.js";
+export default {
+    name: "app",
+    components: { aiModel },
+    data() {
+        return {
+            menu_left: [],
+            menu_right: [],
+
+            activeIndex: 0,
+            formattedText: "",
+            formattedTime: "",
+            activeMenuId: 0,
+            drawer: false,
+            aiModel: window.aiModel,
+        };
+    },
+    created() {
+
+    },
+    computed: {},
+    mounted() {
+        // let promise = window.viewer.scene.open("http://192.168.60.2:8090/iserver/services/3D-3-2mash/rest/realspace")
+        // Object.defineProperty(Array.prototype, 'max', {
+        //     value: function () { return Math.max.apply(null, this); }, // 将第三方插件添加的方法代码放到这里
+        //     enumerable: false,  // 关键:设置为不可枚举
+        //     writable: true,
+        //     configurable: true
+        // });
+
+        // Object.defineProperty(Array.prototype, 'min', {
+        //     value: function () { return Math.min.apply(null, this); },// 将第三方插件添加的方法代码放到这里
+        //     enumerable: false,  // 关键:设置为不可枚举
+        //     writable: true,
+        //     configurable: true
+        // });
+        // // console.log(Cesium.SuperMapVersion,viewer.imageryLayers,'ssss')
+
+        let viewer = new Cesium.Viewer("cesiumContainer")
+
+        console.log("Cesium.Ellipsoid.WGS84===", Cesium.Ellipsoid.WGS84, viewer)
+        console.log("viewer===", viewer)
+        let promise = viewer.scene.open("http://192.168.60.64:9001/iserver/services/3D-sanya/rest/realspace")
+        // viewer.scene.open("http://192.168.60.64:9001/iserver/services/3D-sanya/rest/realspace")
+        // Cesium.when(promise, layers => {
+        //     console.log('layers===', layers)
+        //     viewer.camera.flyTo({
+        //         //定位到范围中心点
+        //         // destination: Cesium.Cartesian3.fromDegrees(109.4166666666667,18.334453322218476,500)
+        //         // orientation: {
+        //         //   heading: 0.000005686606919574899,
+        //         //   pitch: -0.41034310444770905,
+        //         //   roll: 0.0,
+        //         // },
+        //     });
+        // })
+
+
+        // viewer.scene.open('http://192.168.60.2:8090/iserver/services/3D-3-2mash/rest/realspace')
+
+    }
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 2 - 0
vue.config.js

@@ -128,6 +128,8 @@
 // };
 
 module.exports = {
+  //  mode: 'development',
+   devtool: false,          // 不生成任何 source-map
     css: {
         loaderOptions: {
             postcss: {