|  | @@ -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 };
 |