|
@@ -154,9 +154,12 @@ export class VtkModel {
|
|
|
this.wayActors = [];
|
|
|
this.wayspath = [];
|
|
|
this.wayspathActors = [];
|
|
|
+
|
|
|
+
|
|
|
this.sensorobj={};
|
|
|
|
|
|
|
|
|
+
|
|
|
//管道位置数据
|
|
|
const sphereSource = vtkSphereSource.newInstance({
|
|
|
center: [0, 0, 0],
|
|
@@ -183,6 +186,15 @@ export class VtkModel {
|
|
|
// 读取PLY数据
|
|
|
this.soureReader.parseAsArrayBuffer(arrayBuffer);
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.cgqActors=[];
|
|
|
+ this.cgqreader = vtkPLYReader.newInstance();
|
|
|
+ fetchJSFileAsArrayBuffer('src/assets/3d/jiancd.ply').then(arrayBuffer => {
|
|
|
+ // 读取PLY数据
|
|
|
+ this.cgqreader.parseAsArrayBuffer(arrayBuffer);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
xyz_back(){
|
|
@@ -280,6 +292,45 @@ delSoures(){
|
|
|
this.removeSoure();
|
|
|
this.soureActors=[];
|
|
|
}
|
|
|
+
|
|
|
+addSensor(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),
|
|
|
+ ]
|
|
|
+ const mapper = vtkMapper.newInstance();
|
|
|
+ mapper.setInputConnection(this.cgqreader.getOutputPort());
|
|
|
+ const actor = vtkActor.newInstance();
|
|
|
+ actor.setPosition(pipsite_point[0],pipsite_point[1],pipsite_point[2]);
|
|
|
+ actor.getProperty().setColor(SOURECOLOR);
|
|
|
+ actor.setMapper(mapper);
|
|
|
+ actor.setScale(5,5,5);//放大
|
|
|
+ // 旋转actor
|
|
|
+ actor.rotateY(90);// 绕y轴旋转
|
|
|
+ this.cgqActors.push(actor);
|
|
|
+}
|
|
|
+showSensor(){
|
|
|
+ this.cgqActors.forEach((actor)=>{
|
|
|
+ this.renderer.addActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+}
|
|
|
+removeSensor(){
|
|
|
+ this.cgqActors.forEach((actor)=>{
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+ this.renderWindow.render();
|
|
|
+}
|
|
|
+delSensor(){
|
|
|
+ this.removeSensor();
|
|
|
+ this.cgqActors=[];
|
|
|
+}
|
|
|
+
|
|
|
//添加一个灾源点
|
|
|
addSoures(pid,site){
|
|
|
let pipe =this.pipeByPid(pid);
|
|
@@ -444,15 +495,11 @@ safetypath(rows){
|
|
|
}
|
|
|
// 清空安全路径
|
|
|
safetypathremove(){
|
|
|
- console.log(11111);
|
|
|
- // this.wayspathActors=[];
|
|
|
-// this.wayspathActors.forEach(actor => {
|
|
|
-// console.log(this.renderer.removeActor(actor));
|
|
|
-// this.renderer.removeActor(actor);
|
|
|
-// });
|
|
|
-// console.log(this.wayspathActors);
|
|
|
-// vtkmodel.renderWindow.render();
|
|
|
-
|
|
|
+ this.wayspathActors.forEach(actor => {
|
|
|
+ console.log(this.renderer.removeActor(actor));
|
|
|
+ this.renderer.removeActor(actor);
|
|
|
+ });
|
|
|
+ vtkmodel.renderWindow.render();
|
|
|
}
|
|
|
waysInit(ways) {
|
|
|
this.renderWindowWith.resize();
|