Browse Source

填挖逻辑

zpf 11 months ago
parent
commit
34ead06b17

+ 44 - 18
src/components/TerrainAnalysis/TerrainCutFillAnalysis/TerrainCutFillAnalysis.vue

@@ -5,21 +5,29 @@
 
     <div v-show="radio == 'cut'">
       <div class="cut_fill_centent1">
-        设计深度(米):
+        填挖深度(米):
         <el-input class="cut_fill_input" v-model="height" placeholder=""></el-input>
         <br>
         土石方量(立方米):
         <el-input class="cut_fill_input" v-model="result" placeholder=""></el-input>
 
       </div>
-      <div class="cut_fill_Buttons">
-        <el-button size="mini" type="primary" @click="draw">绘制</el-button>
-        <el-button size="mini" type="primary" @click="clear">清除</el-button>
-      </div>
+
     </div>
 
     <div v-show="radio == 'smooth'">
-      asd
+      <div class="cut_fill_centent1">
+        平整深度(米):
+        <el-input class="cut_fill_input" v-model="smooth_height" placeholder=""></el-input>
+        <br>
+        土石方量(立方米):
+        <el-input class="cut_fill_input" v-model="result" placeholder=""></el-input>
+
+      </div>
+    </div>
+    <div class="cut_fill_Buttons">
+      <el-button size="mini" type="primary" @click="draw">绘制</el-button>
+      <el-button size="mini" type="primary" @click="clear">清除</el-button>
     </div>
   </div>
 </template>
@@ -39,7 +47,8 @@ export default {
       height: 300,
       result: null,
       handler_Cut_fill: null,
-      array3D: []
+      array3D: [],
+      smooth_height: 0,
     };
   },
   //监听属性 类似于data概念
@@ -65,6 +74,24 @@ export default {
         granularity: 1 //精度
       });
     },
+    cutana(positions) {
+      viewer.scene.globe.removeAllExcavationRegion();
+      viewer.scene.globe.addExcavationRegion({
+        name: 'ggg',
+        position: positions,
+        height: Number(-this.height),
+        transparent: false
+      });
+    },
+    smooth_ana(positions) {
+      viewer.scene.globe.removeAllExcavationRegion();
+      viewer.scene.globe.addExcavationRegion({
+        name: 'ggg',
+        position: positions,
+        height: 100,
+        transparent: false
+      });
+    },
     draw() {
 
 
@@ -140,18 +167,17 @@ export default {
 
         }
 
-        if (that.height < 0) {
-          viewer.scene.globe.removeAllExcavationRegion();
-          viewer.scene.globe.addExcavationRegion({
-            name: 'ggg',
-            position: threeArray,
-            height: Number(-that.height),
-            transparent: false
-          });
-        } else {
-          that.extract(threeArray);
-        }
+        if (that.radio == 'smooth') {
+          that.smooth_ana(threeArray);
+
+        } else if (that.radio == 'cut') {
+          if (that.height < 0) {
+            that.cutana(threeArray);
+          } else {
+            that.extract(threeArray);
+          }
 
+        }
 
 
         that.handler_Cut_fill.polygon.show = false;