|
@@ -152,6 +152,9 @@ export class VtkModel {
|
|
|
|
|
|
this.ways = [];
|
|
|
this.wayActors = [];
|
|
|
+ this.wayspath = [];
|
|
|
+ this.wayspathActors = [];
|
|
|
+ this.sensorobj={};
|
|
|
|
|
|
|
|
|
//管道位置数据
|
|
@@ -380,7 +383,77 @@ removejc(){
|
|
|
clearpipsite(){
|
|
|
this.renderer.removeActor(this.actorpipsite);
|
|
|
}
|
|
|
+// 安全路径显示
|
|
|
+safetypath(rows){
|
|
|
+
|
|
|
+ this.renderWindowWith.resize();
|
|
|
+ this.wayspath=rows;
|
|
|
+ let nodes1 = [];
|
|
|
+ let nodes2 = [];
|
|
|
+ this.wayspathActors=[];
|
|
|
+ for (let index = 0; index < this.wayspath.length - 1; index++) {
|
|
|
+ nodes1.push(this.wayspath[index]);
|
|
|
+ }
|
|
|
+ for (let index = 1; index < this.wayspath.length; index++) {
|
|
|
+ nodes2.push(this.wayspath[index]);
|
|
|
+ }
|
|
|
+ for (let index = 0; index < nodes2.length; index++) {
|
|
|
+ const lineSource = vtkLineSource.newInstance();
|
|
|
+ let snode = nodes1[index];
|
|
|
+ let enode = nodes2[index];
|
|
|
+ let wizhi1 = this.pointByPipeNodeId(snode.nid);
|
|
|
+ let wizhi2 = this.pointByPipeNodeId(enode.nid);
|
|
|
+ let point1 = [parseFloat(wizhi1[0]), parseFloat(wizhi1[1]), parseFloat(wizhi1[2])];
|
|
|
+ let point2 = [parseFloat(wizhi2[0]), parseFloat(wizhi2[1]), parseFloat(wizhi2[2])];
|
|
|
+ lineSource.setPoint1(point1);
|
|
|
+ lineSource.setPoint2(point2);
|
|
|
+ lineSource.setResolution(12);
|
|
|
+ const actor = vtkActor.newInstance();
|
|
|
+ const mapper = vtkMapper.newInstance();
|
|
|
+ actor.setMapper(mapper);
|
|
|
+ actor.getProperty().setLineWidth(3);//设置线宽
|
|
|
+ actor.getProperty().setColor(GREEN);
|
|
|
+ const initialValues = {
|
|
|
+ base: 0,
|
|
|
+ center: point2,
|
|
|
+ height: 9,
|
|
|
+ radius: 5,
|
|
|
+ resolution: 8,
|
|
|
+ direction: [
|
|
|
+ point2[0]-point1[0],
|
|
|
+ point2[1]-point1[1],
|
|
|
+ point2[2]-point1[2],
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ const vtk2d = vtkConeSource.newInstance(initialValues);
|
|
|
+ const mapper2 = vtkMapper.newInstance();
|
|
|
+ mapper2.setInputConnection(vtk2d.getOutputPort());
|
|
|
+ const actor2 = vtkActor.newInstance();
|
|
|
+ actor2.setMapper(mapper2);
|
|
|
+ actor2.getProperty().setColor(GREEN);
|
|
|
+ this.wayspathActors.push(actor2);
|
|
|
|
|
|
+ mapper.setInputConnection(lineSource.getOutputPort());
|
|
|
+ this.wayspathActors.push(actor);
|
|
|
+ }
|
|
|
+ this.wayspathActors.forEach((wayAcotor) => {
|
|
|
+ this.renderer.addActor(wayAcotor);
|
|
|
+ });
|
|
|
+ // vtkmodel.renderer.resetCamera();
|
|
|
+ vtkmodel.renderWindow.render();
|
|
|
+}
|
|
|
+// 清空安全路径
|
|
|
+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();
|
|
|
+
|
|
|
+}
|
|
|
waysInit(ways) {
|
|
|
this.renderWindowWith.resize();
|
|
|
this.ways = ways;
|