maxiaoxiao 10 місяців тому
батько
коміт
1904fc382d

+ 56 - 31
src/components/TerrainAnalysis/TerrainCutFillAnalysis/TerrainCutFillAnalysisNew.vue

@@ -30,29 +30,19 @@
         <span> 最大:{{ cutData.max || 0 }}米 </span>
         <span> 平均:{{ cutData.avg || 0 }}米 </span>
       </el-form-item>
-      <el-radio v-model="dsmtype" label="buffer">
-        缓冲区获取高程
+      <el-form-item label="缓冲区获取高程" label-width="130px">
         <el-input
           v-model="form.buffer"
           placeholder="修改缓冲区获取高程"
           size="mini"
-          class="iwidth"
-          :disabled="dsmtype != 'buffer'"
-          @hange="getDsm()"
-        ></el-input
-      ></el-radio>
-      <el-radio v-model="dsmtype" label="pick">
-        点击获取高程
-        <el-button
-          type="primary"
-          size="mini"
-          class="iwidth"
-          :disabled="dsmtype != 'pick'"
-          @click="clickPoint"
-        >
+          @change="getDsm()"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="点击获取高程" label-width="130px">
+        <el-button type="primary" size="mini" @click="clickPoint">
           查询
         </el-button>
-      </el-radio>
+      </el-form-item>
       <el-form-item label="填挖基准:" v-if="radio == 'cut'" prop="height">
         <!-- readonly="readonly" -->
         <el-input
@@ -85,16 +75,23 @@
         >导出结果</span
       >
     </div>
-    <el-descriptions border size="mini" :column="2">
-      <el-descriptions-item v-for="item in sdh" :key="item" :label="item.scS"
-        ><div
-          style="width: 4.5rem; height: 100%"
-          :style="{ 'background-color': item.fill }"
-        >
-          &nbsp;
-        </div>
-      </el-descriptions-item>
-    </el-descriptions>
+    <div class="lend">
+      <el-checkbox
+        v-model="checked"
+        @change="changelen"
+        title="显示图例"
+      ></el-checkbox>
+      <el-descriptions border size="mini" :column="2">
+        <el-descriptions-item v-for="item in sdh" :key="item" :label="item.scS"
+          ><div
+            style="width: 4.5rem; height: 100%"
+            :style="{ 'background-color': item.fill }"
+          >
+            &nbsp;
+          </div>
+        </el-descriptions-item>
+      </el-descriptions>
+    </div>
   </div>
 </template>
 
@@ -104,13 +101,14 @@ import * as turf from "@turf/turf";
 import parse from "wellknown";
 import { loadGeoJSON, download, pickPoint } from "@/utils/MapHelper/help.js";
 import range from "@/components/mapview/range.vue"; ///mapview/range
+let dataSource = {};
 export default {
   name: "TerrainCutFillAnalysis",
   components: { range },
   data() {
     return {
       radio: "cut",
-      dsmtype: "",
+      // dsmtype: "",
       sharedState: store.state,
       loading: false,
       form: {
@@ -119,6 +117,7 @@ export default {
         geom: "",
       },
       cutData: {},
+      checked: true,
       // 石方量
       sdata: [
         { name: "填土体积:", prop: "fillVolume", unit: "立方米" },
@@ -238,12 +237,26 @@ export default {
         this.cutData.cz = this.cutData.cutVolume - this.cutData.fillVolume;
 
         // let pitch = Cesium.Math.toRadians(-45.0);
-        let params = { sw: 0.001, fill_a: 0.8 };
+        let params = { sw: 0.001, fill_a: 0.2 };
         // let fn = (data) => {  data.name = "cut_fill" };
         viewer.entities.removeAll();
         viewer.dataSources.removeAll();
-        loadGeoJSON(res.data.bottomGeom, "#1E90A8", params);
-        loadGeoJSON(res.data.midGeom, "#ff0000", params);
+        loadGeoJSON(this.form.geom, "#E1CFAD", {}, (data) => {
+          data.entities.values.forEach((entity, ei) => {
+            if (entity.polygon) {
+              entity.polygon.material = new Cesium.ImageMaterialProperty({
+                image: "./static/images/map/texture.png",
+                transparent: true,
+              });
+            }
+          });
+        });
+        loadGeoJSON(res.data.bottomGeom, "#1E90A8", params, (data) => {
+          dataSource.bottom = data;
+        });
+        loadGeoJSON(res.data.midGeom, "#ff0000", params, (data) => {
+          dataSource.mid = data;
+        });
         let threeArray = this.geojsonToFlatArray(parse(this.form.geom));
         // this.cutana(threeArray);
         this.smooth(threeArray);
@@ -255,6 +268,10 @@ export default {
         // this.cutana(mthree);
       }
     },
+    changelen() {
+      if (dataSource.bottom) dataSource.bottom.show = this.checked;
+      if (dataSource.mid) dataSource.mid.show = this.checked;
+    },
     //地形抽出部分
     extract(positions) {
       viewer.scene.globe.removeAllExtractRegion();
@@ -388,12 +405,20 @@ export default {
     }
   }
 }
+.lend {
+  display: flex;
+  .el-checkbox {
+    margin-top: 20px;
+  }
+}
 </style>
 <style lang="scss">
 .cut_fill_box {
   .el-descriptions {
     color: #fff;
     margin-top: 20px;
+    margin-left: 20px;
+    width: calc(100% - 20px);
     // position: absolute;
     // bottom: 20px;
   }