huangxingxing 1 жил өмнө
parent
commit
f072018f60

+ 76 - 64
src/control/vtkModel.js

@@ -59,6 +59,15 @@ export class VtkModel {
     this.renderer =null;
     this.renderWindow = null;
 
+
+        //选取
+        this.lastActor = null;
+        this.nodeActors = []; //节点actor 数据
+        this.pipeActors = []; //管道actor 数据
+        this.interactor = null;
+        this.apiSpecificRenderWindow = null;
+        this.hardwareSelector = null;
+
      //模板数据
      this.polyData = vtkPolyData.newInstance();
      this.mapper = vtkMapper.newInstance();
@@ -123,69 +132,69 @@ export class VtkModel {
 
 
     
-    //箭头
-    this.arrowActors = []; 
-    const viewColors = [
-      [1, 0, 0], // sagittal
-      [0, 1, 0], // coronal
-      [0, 0, 1], // axial
-      [0.5, 0.5, 0.5], // 3D
-    ];
-    // create axes
-    const axes = vtkAnnotatedCubeActor.newInstance();
-    axes.setDefaultStyle({
-      text: '+X',
-      fontStyle: 'bold',
-      fontFamily: 'Arial',
-      fontColor: 'black',
-      fontSizeScale: (res) => res / 2,
-      faceColor: createRGBStringFromRGBValues(viewColors[0]),
-      faceRotation: 0,
-      edgeThickness: 0.1,
-      edgeColor: 'black',
-      resolution: 400,
-    });
-    // axes.setXPlusFaceProperty({ text: '+X' });
-    axes.setXMinusFaceProperty({
-      text: '-X',
-      faceColor: createRGBStringFromRGBValues(viewColors[0]),
-      faceRotation: 90,
-      fontStyle: 'italic',
-    });
-    axes.setYPlusFaceProperty({
-      text: '+Y',
-      faceColor: createRGBStringFromRGBValues(viewColors[1]),
-      fontSizeScale: (res) => res / 4,
-    });
-    axes.setYMinusFaceProperty({
-      text: '-Y',
-      faceColor: createRGBStringFromRGBValues(viewColors[1]),
-      fontColor: 'white',
-    });
-    axes.setZPlusFaceProperty({
-      text: '+Z',
-      faceColor: createRGBStringFromRGBValues(viewColors[2]),
-    });
-    axes.setZMinusFaceProperty({
-      text: '-Z',
-      faceColor: createRGBStringFromRGBValues(viewColors[2]),
-      faceRotation: 45,
-    });
-
-
-    // const vtkAxesActor = vtkAxesActor.newInstance();
-      // create orientation widget
-    this.orientationWidget = vtkOrientationMarkerWidget.newInstance({
-      actor: axes,
-      interactor: this.renderWindow.getInteractor(),
-    });
-    this.orientationWidget.setEnabled(true);
-    this.orientationWidget.setViewportCorner(
-      vtkOrientationMarkerWidget.Corners.BOTTOM_LEFT
-    );
-    this.orientationWidget.setViewportSize(0.15);
-    this.orientationWidget.setMinPixelSize(100);
-    this.orientationWidget.setMaxPixelSize(300);
+    // //箭头
+    // this.arrowActors = []; 
+    // const viewColors = [
+    //   [1, 0, 0], // sagittal
+    //   [0, 1, 0], // coronal
+    //   [0, 0, 1], // axial
+    //   [0.5, 0.5, 0.5], // 3D
+    // ];
+    // // create axes
+    // const axes = vtkAnnotatedCubeActor.newInstance();
+    // axes.setDefaultStyle({
+    //   text: '+X',
+    //   fontStyle: 'bold',
+    //   fontFamily: 'Arial',
+    //   fontColor: 'black',
+    //   fontSizeScale: (res) => res / 2,
+    //   faceColor: createRGBStringFromRGBValues(viewColors[0]),
+    //   faceRotation: 0,
+    //   edgeThickness: 0.1,
+    //   edgeColor: 'black',
+    //   resolution: 400,
+    // });
+    // // axes.setXPlusFaceProperty({ text: '+X' });
+    // axes.setXMinusFaceProperty({
+    //   text: '-X',
+    //   faceColor: createRGBStringFromRGBValues(viewColors[0]),
+    //   faceRotation: 90,
+    //   fontStyle: 'italic',
+    // });
+    // axes.setYPlusFaceProperty({
+    //   text: '+Y',
+    //   faceColor: createRGBStringFromRGBValues(viewColors[1]),
+    //   fontSizeScale: (res) => res / 4,
+    // });
+    // axes.setYMinusFaceProperty({
+    //   text: '-Y',
+    //   faceColor: createRGBStringFromRGBValues(viewColors[1]),
+    //   fontColor: 'white',
+    // });
+    // axes.setZPlusFaceProperty({
+    //   text: '+Z',
+    //   faceColor: createRGBStringFromRGBValues(viewColors[2]),
+    // });
+    // axes.setZMinusFaceProperty({
+    //   text: '-Z',
+    //   faceColor: createRGBStringFromRGBValues(viewColors[2]),
+    //   faceRotation: 45,
+    // });
+
+
+    // // const vtkAxesActor = vtkAxesActor.newInstance();
+    //   // create orientation widget
+    // this.orientationWidget = vtkOrientationMarkerWidget.newInstance({
+    //   actor: axes,
+    //   interactor: this.renderWindow.getInteractor(),
+    // });
+    // this.orientationWidget.setEnabled(true);
+    // this.orientationWidget.setViewportCorner(
+    //   vtkOrientationMarkerWidget.Corners.BOTTOM_LEFT
+    // );
+    // this.orientationWidget.setViewportSize(0.15);
+    // this.orientationWidget.setMinPixelSize(100);
+    // this.orientationWidget.setMaxPixelSize(300);
   }
   generateTicks(numberOfTicks) {
     return (helper) => {
@@ -257,6 +266,7 @@ export class VtkModel {
   }
 
   modelInit(validNodes, pipes) {
+    this.renderWindowWith.resize();
     this.validNodes = validNodes;
     this.pipes = pipes;
     this.modelCreate();
@@ -553,6 +563,8 @@ function eventToWindowXY(event) {
   const x = Math.round((width * clientX) / window.innerWidth);
   const y = Math.round(height * (1 - clientY / window.innerHeight)); // Need to flip Y
   return [x, y];
+  
+  
 }
 function processSelections(selections) {
   if (!selections || selections.length === 0) {//没有选择
@@ -630,7 +642,7 @@ function processSelections(selections) {
 
 }
 const throttleMouseHandler = throttle(pickOnMouseEvent, 20);
-const WHITE = [0, 0, 1];
+const WHITE = [1, 0.2, 1];
 const GREEN = [0.1, 0.8, 0.1];
 const vtkmodel = new VtkModel();
 export { vtkmodel };

+ 4 - 3
src/view/components/InfoVtkmodel.vue

@@ -17,8 +17,8 @@ onMounted(() => {
 
   const rootContainer = document.getElementById("infomodel");
   // rootContainer.style.position = "relative";
-  rootContainer.style.width = "100%";
-  rootContainer.style.height = "100%";
+  // rootContainer.style.width = "100%";
+  // rootContainer.style.height = "100%";
   vtkmodel.initMode(rootContainer);
   readNodeAndPipe();
   vtkmodel.clearJgAddMode();
@@ -72,7 +72,8 @@ async function readePipe() {
 /**
  * 在管道中已存在的点才可以使用
  */
-function nodeIsValid(node) {
+function 
+nodeIsValid(node) {
   let isValid = false;
   pipes.value.forEach((pipe) => {
     if (node.id == pipe.snId || node.id == pipe.enId) {

+ 2 - 0
src/view/result/resultLeft.vue

@@ -69,11 +69,13 @@ onMounted(() => {
   vtkObj.fcon = createFireControl();
   vtkObj.renderWindow = vtkGenericRenderWindow.newInstance();
   vtkObj.renderWindow.setContainer(rootContainer);
+  
   vtkObj.jgMapper = vtkMapper.newInstance();
   vtkObj.jgActor = vtkActor.newInstance();
   vtkObj.jgActor.getProperty().setRepresentation(Representation.SURFACE); //面
   vtkObj.jgActor.setMapper(vtkObj.jgMapper);
   // vtkObj.renderWindow.getRenderer().addActor(vtkObj.jgActor);
+    vtkObj.renderWindow.getRenderer().setBackground(0.0, 0.0, 0.0, 0.0);
 
   vtkObj.scalarBarActor = vtkScalarBarActor.newInstance();
   vtkObj.scalarBarActor.setGenerateTicks(generateTicks(5));

+ 1 - 0
src/view/result/resultRight.vue

@@ -70,6 +70,7 @@ onMounted(() => {
   vtkObj.jgActor.getProperty().setRepresentation(Representation.SURFACE); //面
   vtkObj.jgActor.setMapper(vtkObj.jgMapper);
   // vtkObj.renderWindow.getRenderer().addActor(vtkObj.jgActor);
+    vtkObj.renderWindow.getRenderer().setBackground(0.0, 0.0, 0.0, 0.0);
 
   vtkObj.scalarBarActor = vtkScalarBarActor.newInstance();
   vtkObj.scalarBarActor.setGenerateTicks(generateTicks(5));