|
@@ -170,6 +170,12 @@ export class VtkModel {
|
|
|
// 用于管道上位置移动(监测点)
|
|
|
this.actorpipjcs=[];
|
|
|
|
|
|
+ this.actorpippumps=[];
|
|
|
+
|
|
|
+ this.actorpipfans=[];
|
|
|
+
|
|
|
+ this.actorpipdoors=[];
|
|
|
+
|
|
|
this.jcdActors = []; //检测点数据
|
|
|
this.jcreader = vtkPLYReader.newInstance();
|
|
|
fetchJSFileAsArrayBuffer('static/3d/jiancd.ply').then(arrayBuffer => {
|
|
@@ -185,14 +191,36 @@ export class VtkModel {
|
|
|
this.soureReader.parseAsArrayBuffer(arrayBuffer);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- this.pmpActors=[];
|
|
|
this.cgqActors=[];
|
|
|
this.cgqreader = vtkPLYReader.newInstance();
|
|
|
fetchJSFileAsArrayBuffer('static/3d/cgq.ply').then(arrayBuffer => {
|
|
|
// 读取PLY数据
|
|
|
this.cgqreader.parseAsArrayBuffer(arrayBuffer);
|
|
|
});
|
|
|
+
|
|
|
+ // 水泵
|
|
|
+ this.waterPumpActors = [];
|
|
|
+ this.waterPumpreader = vtkPLYReader.newInstance();
|
|
|
+ fetchJSFileAsArrayBuffer('static/3d/shuibeng.ply').then(arrayBuffer => {
|
|
|
+ // 读取PLY数据
|
|
|
+ this.waterPumpreader.parseAsArrayBuffer(arrayBuffer);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 风机
|
|
|
+ this.fanActors = [];
|
|
|
+ this.fanreader = vtkPLYReader.newInstance();
|
|
|
+ fetchJSFileAsArrayBuffer('static/3d/fengji.ply').then(arrayBuffer => {
|
|
|
+ // 读取PLY数据
|
|
|
+ this.fanreader.parseAsArrayBuffer(arrayBuffer);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 风门
|
|
|
+ this.doorActors = [];
|
|
|
+ this.doorreader = vtkPLYReader.newInstance();
|
|
|
+ fetchJSFileAsArrayBuffer('static/3d/fengmen.ply').then(arrayBuffer => {
|
|
|
+ // 读取PLY数据
|
|
|
+ this.doorreader.parseAsArrayBuffer(arrayBuffer);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
xyz_back(){
|
|
@@ -297,7 +325,7 @@ removePname(){
|
|
|
}
|
|
|
|
|
|
|
|
|
-//水泵/风门、风机添加
|
|
|
+//水泵添加
|
|
|
addpump(pid,site){
|
|
|
|
|
|
let pipe =this.pipeByPid(pid,site);
|
|
@@ -311,38 +339,133 @@ addpump(pid,site){
|
|
|
]
|
|
|
console.log(pipsite_point)
|
|
|
const mapper = vtkMapper.newInstance();
|
|
|
- mapper.setInputConnection(this.cgqreader.getOutputPort());
|
|
|
+ mapper.setInputConnection(this.waterPumpreader.getOutputPort());
|
|
|
const actor = vtkActor.newInstance();
|
|
|
actor.setPosition(pipsite_point[0],pipsite_point[1],pipsite_point[2]);
|
|
|
- actor.getProperty().setColor(SOURECOLOR);
|
|
|
+ actor.getProperty().setColor(GREEN);
|
|
|
actor.setMapper(mapper);
|
|
|
actor.rotateZ(90);
|
|
|
- actor.setScale(0.2,0.2,0.2);//放大
|
|
|
+ actor.setScale(0.1,0.1,0.1);//放大
|
|
|
// 旋转actor
|
|
|
// actor.rotateY(90);// 绕y轴旋转
|
|
|
- this.pmpActors.push(actor);
|
|
|
- this.pmpActors.forEach((actor)=>{
|
|
|
+ this.waterPumpActors.push(actor);
|
|
|
+ this.waterPumpActors.forEach((actor)=>{
|
|
|
this.renderer.addActor(actor);
|
|
|
});
|
|
|
this.renderWindow.render();
|
|
|
}
|
|
|
showpump(){
|
|
|
- this.pmpActors.forEach((actor)=>{
|
|
|
+ this.waterPumpActors.forEach((actor)=>{
|
|
|
this.renderer.addActor(actor);
|
|
|
});
|
|
|
this.renderWindow.render();
|
|
|
|
|
|
}
|
|
|
removepump(){
|
|
|
- this.pmpActors.forEach((actor)=>{
|
|
|
+ this.waterPumpActors.forEach((actor)=>{
|
|
|
this.renderer.removeActor(actor);
|
|
|
});
|
|
|
this.renderWindow.render();
|
|
|
}
|
|
|
delpump(){
|
|
|
this.removepump();
|
|
|
- this.pmpActors=[];
|
|
|
+ this.waterPumpActors=[];
|
|
|
+}
|
|
|
+
|
|
|
+//风机添加
|
|
|
+addfan(pid,site){
|
|
|
+
|
|
|
+ let pipe =this.pipeByPid(pid,site);
|
|
|
+ let point1 = this.pointByPipeNodeId(pipe.snId);
|
|
|
+ let point2 = this.pointByPipeNodeId(pipe.enId);
|
|
|
+ let py = site/(1-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),
|
|
|
+ ]
|
|
|
+ console.log(pipsite_point)
|
|
|
+ const mapper = vtkMapper.newInstance();
|
|
|
+ mapper.setInputConnection(this.fanreader.getOutputPort());
|
|
|
+ const actor = vtkActor.newInstance();
|
|
|
+ actor.setPosition(pipsite_point[0],pipsite_point[1],pipsite_point[2]);
|
|
|
+ actor.getProperty().setColor(GREEN);
|
|
|
+ actor.setMapper(mapper);
|
|
|
+ actor.rotateZ(90);
|
|
|
+ actor.setScale(0.1,0.1,0.1);//放大
|
|
|
+ // 旋转actor
|
|
|
+ // actor.rotateY(90);// 绕y轴旋转
|
|
|
+ this.fanActors.push(actor);
|
|
|
+ this.fanActors.forEach((actor)=>{
|
|
|
+ this.renderer.addActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+}
|
|
|
+showfan(){
|
|
|
+ this.fanActors.forEach((actor)=>{
|
|
|
+ this.renderer.addActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+
|
|
|
+}
|
|
|
+removefan(){
|
|
|
+ this.fanActors.forEach((actor)=>{
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+}
|
|
|
+delfan(){
|
|
|
+ this.removefan();
|
|
|
+ this.fanActors=[];
|
|
|
+}
|
|
|
+
|
|
|
+//风门添加
|
|
|
+adddoor(pid,site){
|
|
|
+
|
|
|
+ let pipe =this.pipeByPid(pid,site);
|
|
|
+ let point1 = this.pointByPipeNodeId(pipe.snId);
|
|
|
+ let point2 = this.pointByPipeNodeId(pipe.enId);
|
|
|
+ let py = site/(1-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),
|
|
|
+ ]
|
|
|
+ console.log(pipsite_point)
|
|
|
+ const mapper = vtkMapper.newInstance();
|
|
|
+ mapper.setInputConnection(this.doorreader.getOutputPort());
|
|
|
+ const actor = vtkActor.newInstance();
|
|
|
+ actor.setPosition(pipsite_point[0],pipsite_point[1],pipsite_point[2]);
|
|
|
+ actor.getProperty().setColor(GREEN);
|
|
|
+ actor.setMapper(mapper);
|
|
|
+ // actor.rotateZ(90);
|
|
|
+ actor.setScale(0.1,0.1,0.1);//放大
|
|
|
+ // 旋转actor
|
|
|
+ // actor.rotateY(90);// 绕y轴旋转
|
|
|
+ this.doorActors.push(actor);
|
|
|
+ this.doorActors.forEach((actor)=>{
|
|
|
+ this.renderer.addActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
}
|
|
|
+showdoor(){
|
|
|
+ this.doorActors.forEach((actor)=>{
|
|
|
+ this.renderer.addActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+
|
|
|
+}
|
|
|
+removedoor(){
|
|
|
+ this.doorActors.forEach((actor)=>{
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+}
|
|
|
+deldoor(){
|
|
|
+ this.removedoor();
|
|
|
+ this.doorActors=[];
|
|
|
+}
|
|
|
+
|
|
|
addSensor(val){
|
|
|
let pipe =this.pipeByPid(val.pid,val.site);
|
|
|
let point1 = this.pointByPipeNodeId(pipe.snId);
|
|
@@ -503,7 +626,7 @@ deljc() {
|
|
|
const pipsiteMapper = vtkMapper.newInstance();
|
|
|
pipsiteMapper.setInputConnection(sphereSource.getOutputPort());
|
|
|
actorpipsite.setMapper(pipsiteMapper);
|
|
|
- actorpipsite.getProperty().setColor(WHITE);
|
|
|
+ actorpipsite.getProperty().setColor(GRAY);
|
|
|
this.actorpipsites.push(actorpipsite);
|
|
|
}
|
|
|
const actorpipsite =this.actorpipsites[0];
|
|
@@ -536,7 +659,7 @@ deljc() {
|
|
|
const pipsiteMapper = vtkMapper.newInstance();
|
|
|
pipsiteMapper.setInputConnection(sphereSource.getOutputPort());
|
|
|
actorpipsite.setMapper(pipsiteMapper);
|
|
|
- actorpipsite.getProperty().setColor(WHITE);
|
|
|
+ actorpipsite.getProperty().setColor(GRAY);
|
|
|
this.actorpipsites.push(actorpipsite);
|
|
|
}
|
|
|
const actorpipsite =this.actorpipsites[1];
|
|
@@ -570,7 +693,7 @@ addpipsensor(pid,site){
|
|
|
actorpipsensor.setMapper(pipsensorMapper);
|
|
|
actorpipsensor.rotateZ(90);
|
|
|
actorpipsensor.setScale(0.05,0.05,0.05);//放大
|
|
|
- actorpipsensor.getProperty().setColor(SOURECOLOR);
|
|
|
+ actorpipsensor.getProperty().setColor(GRAY);
|
|
|
this.actorpipsensors.push(actorpipsensor);
|
|
|
}
|
|
|
const actorpipsensor =this.actorpipsensors[0];
|
|
@@ -606,7 +729,7 @@ addpipjc(pid,site){
|
|
|
actorpipjc.setMapper(pipjcMapper);
|
|
|
actorpipjc.rotateZ(90);
|
|
|
actorpipjc.setScale(0.1,0.1,0.1);//放大
|
|
|
- actorpipjc.getProperty().setColor(JCDCOLOR);
|
|
|
+ actorpipjc.getProperty().setColor(GRAY);
|
|
|
this.actorpipjcs.push(actorpipjc);
|
|
|
}
|
|
|
const actorpipjc =this.actorpipjcs[0];
|
|
@@ -630,6 +753,114 @@ clearpipjc(){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// 显示所选管道水泵位置
|
|
|
+addpipPump(pid,site){
|
|
|
+
|
|
|
+ let pipe =this.pipeByPid(pid);
|
|
|
+ console.log("管道数据",pipe)
|
|
|
+ if(this.actorpippumps.length==0){
|
|
|
+ const actorpippump = vtkActor.newInstance();
|
|
|
+ const pippumpMapper = vtkMapper.newInstance();
|
|
|
+ pippumpMapper.setInputConnection(this.waterPumpreader.getOutputPort());
|
|
|
+ actorpippump.setMapper(pippumpMapper);
|
|
|
+ actorpippump.rotateZ(90);
|
|
|
+ actorpippump.setScale(0.1,0.1,0.1);//放大
|
|
|
+ actorpippump.getProperty().setColor(GRAY);
|
|
|
+ this.actorpippumps.push(actorpippump);
|
|
|
+ }
|
|
|
+ const actorpippump =this.actorpippumps[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),
|
|
|
+ ]
|
|
|
+ actorpippump.setPosition(pipsite_point);
|
|
|
+ this.renderer.addActor(actorpippump);
|
|
|
+ this.renderWindow.render();
|
|
|
+ }
|
|
|
+
|
|
|
+//移除水泵在所选择的巷道中的位置
|
|
|
+clearpipPump(){
|
|
|
+ this.actorpippumps.forEach((actor) => {
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 显示所选管道风机位置
|
|
|
+addpipfan(pid,site){
|
|
|
+
|
|
|
+ let pipe =this.pipeByPid(pid);
|
|
|
+ console.log("管道数据",pipe)
|
|
|
+ if(this.actorpipfans.length==0){
|
|
|
+ const actorpipfan = vtkActor.newInstance();
|
|
|
+ const pipfanMapper = vtkMapper.newInstance();
|
|
|
+ pipfanMapper.setInputConnection(this.fanreader.getOutputPort());
|
|
|
+ actorpipfan.setMapper(pipfanMapper);
|
|
|
+ actorpipfan.rotateZ(90);
|
|
|
+ actorpipfan.setScale(0.1,0.1,0.1);//放大
|
|
|
+ actorpipfan.getProperty().setColor(GRAY);
|
|
|
+ this.actorpipfans.push(actorpipfan);
|
|
|
+ }
|
|
|
+ const actorpipfan =this.actorpipfans[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),
|
|
|
+ ]
|
|
|
+ actorpipfan.setPosition(pipsite_point);
|
|
|
+ this.renderer.addActor(actorpipfan);
|
|
|
+ this.renderWindow.render();
|
|
|
+ }
|
|
|
+
|
|
|
+//移除风机在所选择的巷道中的位置
|
|
|
+clearpipfan(){
|
|
|
+ this.actorpipfans.forEach((actor) => {
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 显示所选管道风门位置
|
|
|
+addpipdoor(pid,site){
|
|
|
+
|
|
|
+ let pipe =this.pipeByPid(pid);
|
|
|
+ console.log("管道数据",pipe)
|
|
|
+ if(this.actorpipdoors.length==0){
|
|
|
+ const actorpipdoor = vtkActor.newInstance();
|
|
|
+ const pipdoorMapper = vtkMapper.newInstance();
|
|
|
+ pipdoorMapper.setInputConnection(this.doorreader.getOutputPort());
|
|
|
+ actorpipdoor.setMapper(pipdoorMapper);
|
|
|
+ // actorpipdoor.rotateZ(90);
|
|
|
+ actorpipdoor.setScale(0.1,0.1,0.1);//放大
|
|
|
+ actorpipdoor.getProperty().setColor(GRAY);
|
|
|
+ this.actorpipdoors.push(actorpipdoor);
|
|
|
+ }
|
|
|
+ const actorpipdoor =this.actorpipdoors[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),
|
|
|
+ ]
|
|
|
+ actorpipdoor.setPosition(pipsite_point);
|
|
|
+ this.renderer.addActor(actorpipdoor);
|
|
|
+ this.renderWindow.render();
|
|
|
+ }
|
|
|
+
|
|
|
+//移除风门在所选择的巷道中的位置
|
|
|
+clearpipdoor(){
|
|
|
+ this.actorpipdoors.forEach((actor) => {
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
// 安全路径显示
|
|
|
safetypath(rows){
|
|
|
this.renderWindowWith.resize();
|
|
@@ -1243,6 +1474,8 @@ safetypathremove(){
|
|
|
this.delSensor();
|
|
|
this.delSoures();
|
|
|
this.delpump();
|
|
|
+ this.deldoor();
|
|
|
+ this.delfan();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1502,13 +1735,20 @@ function processSelections(selections) {
|
|
|
input.getPoints().getPoint(pointId)
|
|
|
);
|
|
|
const scalarDataArray = input.getPointData().getScalars().getData();
|
|
|
- console.log(scalarDataArray[pointIds[0]]);//节点标量数据
|
|
|
+ // console.log('pointIds',pointIds);
|
|
|
+ // console.log('points',points);
|
|
|
+ console.log('节点标量数据',scalarDataArray[pointIds[0]]);//节点标量数据
|
|
|
|
|
|
// pointIds.forEach(pointId=>{
|
|
|
// console.log(input.getPointData().getScalars().getName());
|
|
|
// console.log(scalarDataArray[pointId]);//节点标量数据
|
|
|
// });
|
|
|
- vtkmodel.selectJgPointId = pointIds[0];
|
|
|
+ vtkmodel.selectJgPointId = {
|
|
|
+ scalar:pointIds[0],
|
|
|
+ x:points[0][0],
|
|
|
+ y:points[0][1],
|
|
|
+ z:points[0][2],
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
|