Explorar o código

715灾原点修改

tangjunhao hai 1 mes
pai
achega
efa30b2f40
Modificáronse 2 ficheiros con 100 adicións e 20 borrados
  1. 38 0
      src/control/vtkModel.js
  2. 62 20
      src/view/components/InfoDisaster.vue

+ 38 - 0
src/control/vtkModel.js

@@ -170,6 +170,8 @@ export class VtkModel {
     // 用于管道上位置移动(监测点)
     this.actorpipjcs=[]; 
 
+    this.actorpipsoures=[];
+
     this.actorpippumps=[];
 
     this.actorpipfans=[];
@@ -754,6 +756,42 @@ clearpipjc(){
   });
 }
 
+// 显示所选管道监测点位置
+addpipsoure(pid,site){
+    console.log(1111)
+    let pipe =this.pipeByPid(pid);
+    console.log("管道数据",pipe)
+    if(this.actorpipsoures.length==0){
+      const actorpipsoure = vtkActor.newInstance();
+      const pipsoureMapper = vtkMapper.newInstance();
+      pipsoureMapper.setInputConnection(this.soureReader.getOutputPort());
+      actorpipsoure.setMapper(pipsoureMapper);
+      actorpipsoure.rotateZ(90);
+      actorpipsoure.setScale(0.1,0.1,0.1);//放大
+      actorpipsoure.getProperty().setColor(GRAY);
+      this.actorpipsoures.push(actorpipsoure);
+    }
+    const actorpipsoure =this.actorpipsoures[0];  
+    let point1 = this.pointByPipeNodeId(pipe.snId);
+    let point2 = this.pointByPipeNodeId(pipe.enId);
+    let py = site/(1.01-site);
+    let pipsite_point=[
+      (point1[0]+py*point2[0])/(1+py),
+      (point1[1]+py*point2[1])/(1+py),
+      (point1[2]+py*point2[2])/(1+py),
+      ] 
+    actorpipsoure.setPosition(pipsite_point);
+    this.renderer.addActor(actorpipsoure);
+    this.renderWindow.render();
+  }
+
+//移除监测点在所选择的巷道中的位置
+clearpipsoure(){
+  this.actorpipsoures.forEach((actor) => {
+    this.renderer.removeActor(actor);
+  });
+}
+
 // 显示所选管道水泵位置
 addpipPump(pid,site){
     

+ 62 - 20
src/view/components/InfoDisaster.vue

@@ -44,13 +44,13 @@
                         <div
                           class="flex_a"
                           @click="
-                            newtable($event);
+                            newtable($event,'firesoure');
                             sdialog.dianadddialog = true;
                           "
                         >
                           <div class="btns" ><span class="spantext">添加</span></div>
                         </div>
-                        <div class="flex_a" @click="xiugaitable()">
+                        <div class="flex_a" @click="xiugaitable('firesoure')">
                           <div class="btns"><span class="spantext">修改</span></div>
                         </div>
                         <div
@@ -176,13 +176,13 @@
                         <div
                           class="flex_a"
                           @click="
-                            newtable($event);
+                            newtable($event,'watersoure');
                             sdialog.dianadddialog = true;
                           "
                         >
                           <div class="btns" :class="{tabactive: isActive === 1}" @click="changeClass(1)"><span class="spantext">添加</span></div>
                         </div>
-                        <div class="flex_a" @click="xiugaitable()">
+                        <div class="flex_a" @click="xiugaitable('watersoure')">
                           <div class="btns" :class="{tabactive: isActive === 2}" @click="changeClass(2)"><span class="spantext">修改</span></div>
                         </div>
                         <div
@@ -333,11 +333,11 @@
                         </div>
                         <div
                           class="flex_a"
-                          @click=" addpumdfun($event); sdialog.addpump = true; "
+                          @click=" addpumdfun($event,'pump'); sdialog.addpump = true; "
                         >
                           <div class="btns" :class="{tabactive: isActive === 7}" @click="changeClass(7)"><span class="spantext">添加</span></div>
                         </div>
-                        <div class="flex_a" @click="pumpxiugai()">
+                        <div class="flex_a" @click="pumpxiugai('pump')">
                           <div class="btns" :class="{tabactive: isActive === 8}" @click="changeClass(8)"><span class="spantext">修改</span></div>
                         </div>
                         <div
@@ -1058,7 +1058,7 @@
           <el-button
             type="primary"
             @click="
-              fireclick();
+              fireclick('ws');
               sdialog.dialogVisiblenode = true;
             "
             >选择巷道</el-button
@@ -1079,7 +1079,7 @@
             controls-position="right"
             class="w-50 m-2"
             placeholder="相对位置"
-            @change="inputnuberChange"
+            @change="inputnuberChange2"
           />
         </el-form-item>
       </div>
@@ -1749,6 +1749,7 @@ import { ta } from "element-plus/es/locales.mjs";
 //   'HORZI_ELLIPSE': '水平椭圆',
 //   'CATENARY': '悬链式',
 // };
+let selectFlag = '';
 const statusMap = {
   'halfarch_1': '1-1断面',
   'halfarch_2': '2-2断面',
@@ -2013,7 +2014,15 @@ const Dtext=(val)=>{
   selectstr.value=val.name;
   firepid.value=val.id;
 
-  vtkmodel.addpipPump(firepid.value, source.site|| 0.0);
+  if(selectFlag === 'pump'){
+    vtkmodel.addpipPump(firepid.value, source.site|| 0.0);
+  }else if(selectFlag === 'watersoure' || selectFlag === 'firesoure'){
+    vtkmodel.addpipsoure(firepid.value, source.site|| 0.0);
+  }else {
+    vtkmodel.addpipsite(firepid.value, source.site|| 0.0);
+  }
+  
+
 }
 // 3D弹屏
 const Dclick = (val) => {
@@ -2022,6 +2031,7 @@ const Dclick = (val) => {
   dialogtrue.value.dialoglog = true;
   vtkmodel.clearJgAddMode() ;
   vtkmodel.clearpipPump();
+  vtkmodel.clearpipsoure();
   vtkmodel.selectNoting();
 
    vtkmodel.selectPipes();
@@ -2123,6 +2133,7 @@ const inputnuberChange = (number) => {
 
 }
 
+// 水泵的
 const inputnuberChange1 = (number) => {
   dsite.value=number;
   dialogtrue.value.jgSelenum();
@@ -2131,6 +2142,16 @@ const inputnuberChange1 = (number) => {
 
 }
 
+// 灾原点的
+const inputnuberChange2 = (number) => {
+  dsite.value=number;
+  dialogtrue.value.jgSelenum();
+
+  vtkmodel.addpipsoure(firepid.value,number)
+
+}
+
+
 
 // 3D关闭弹窗
 const fun3D = () => {
@@ -2154,6 +2175,7 @@ state.value=sessionStorage.getItem("state");
   }//节点图形
   vtkmodel.clearpipsite();//清除选择巷道的位置
   vtkmodel.clearpipPump();
+  vtkmodel.clearpipsoure();
   vtkmodel.selectNoting();
   dialogtrue.value.timintclaer();
 }
@@ -2253,7 +2275,10 @@ const handleCurrentChange = (val) => {
   pipelinedata(searchtaggd.value);
 };
 //新建fire
-const newtable = (e) => {
+const newtable = (e,val) => {
+  if(val) {
+    selectFlag = val
+  }
 
   var e = e || window.Event;
   styX.value.left = e.clientX + "px";
@@ -2267,7 +2292,8 @@ const newtable = (e) => {
   gdadd.value = "1";
 
   zhtext.value = "添加";
-  vtkmodel.clearJgAddMode() ;
+  vtkmodel.clearJgAddMode();
+  vtkmodel.renderWindow.render();
   // vtkmodel.selectPipes();
   // dialogtrue.value.jgSelect();
  // dialogtrue.value.initmsg();
@@ -2275,7 +2301,10 @@ const newtable = (e) => {
 
 };
 //  修改
-const xiugaitable = () => {
+const xiugaitable = (val) => {
+  if(val){
+    selectFlag = val;
+  }
   gdadd.value = "3";
   zhtext.value = "修改";
   if (JSON.stringify(tableobj.value) == "{}") {
@@ -2291,11 +2320,9 @@ const xiugaitable = () => {
 
     vtkmodel.clearJgAddMode() ;
     //选中指定管道
-    vtkmodel.selectByPipeId(tableobj.value.pid); 
-    vtkmodel.addpipsite(tableobj.value.pid, tableobj.value.site);
-    // vtkmodel.selectPipes();
-    // dialogtrue.value.jgSelect();
-    vtkmodel.addpipsite( firepid.value,source.site )
+    vtkmodel.selectByPipeId(tableobj.value.pid);
+    
+    vtkmodel.addpipsoure( firepid.value,source.site)
   }
 };
 // 修改接口
@@ -2379,7 +2406,7 @@ const pumpload = () => {
 };
 
 // 选择
-const fireclick = () => {
+const fireclick = () => { 
   searchtaggd.value='';
   pipelinedata("");
 };
@@ -2393,9 +2420,17 @@ const selectfun = () => {
   if (multipleSelection.value.length != 0) {
     firepid.value = multipleSelection.value[0].id;
     selectstr.value = multipleSelection.value[0].name;
+    
     vtkmodel.selectByPipeId( firepid.value);
+    // console.log("selectFlag",selectFlag)
+    if(selectFlag === 'pump'){
+      vtkmodel.addpipPump(firepid.value,source.site || 0.0);
+    }else if(selectFlag === 'watersoure' || selectFlag === 'firesoure'){
+      vtkmodel.addpipsoure(firepid.value,source.site || 0.0);
+    }else {
+      vtkmodel.addpipsite(firepid.value,source.site || 0.0);
+    }
     
-    vtkmodel.addpipPump(firepid.value,source.site || 0.0);
   } else {
     // selectstr.value='';
   }
@@ -2942,7 +2977,11 @@ const fundeledata3 = () => {
       pumpobj.value.onoff=value;
     }
 // 水泵
-const addpumdfun=(e)=>{
+const addpumdfun=(e,val)=>{
+  if(val){
+    selectFlag = val
+  }
+
   var e = e || window.Event;
   styX.value.left = e.clientX + "px";
   currentrow.value=false;
@@ -2966,6 +3005,9 @@ const addpumdfun=(e)=>{
 //修改
 
 const pumpxiugai=(val)=>{
+  if(val){
+    selectFlag = val
+  }
   zhtext.value = "修改";
   tishi.value =zhtext.value;
   if (JSON.stringify( pumpobj.value.xzobj) == "{}") {