|  | @@ -9,11 +9,13 @@ import vtkColorTransferFunction from "@kitware/vtk.js/Rendering/Core/ColorTransf
 | 
											
												
													
														|  |  import { Representation } from "@kitware/vtk.js/Rendering/Core/Property/Constants";
 |  |  import { Representation } from "@kitware/vtk.js/Rendering/Core/Property/Constants";
 | 
											
												
													
														|  |  import vtkPolyData from "@kitware/vtk.js/Common/DataModel/PolyData";
 |  |  import vtkPolyData from "@kitware/vtk.js/Common/DataModel/PolyData";
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import vtkOpenGLHardwareSelector from '@kitware/vtk.js/Rendering/OpenGL/HardwareSelector';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { throttle } from '@kitware/vtk.js/macros';
 | 
											
												
													
														|  |  import {
 |  |  import {
 | 
											
												
													
														|  |    FieldDataTypes,
 |  |    FieldDataTypes,
 | 
											
												
													
														|  |    FieldAssociations,
 |  |    FieldAssociations,
 | 
											
												
													
														|  |  } from '@kitware/vtk.js/Common/DataModel/DataSet/Constants';
 |  |  } from '@kitware/vtk.js/Common/DataModel/DataSet/Constants';
 | 
											
												
													
														|  | 
 |  | +import vtkSphereSource from '@kitware/vtk.js/Filters/Sources/SphereSource';
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  export class VtkModel {
 |  |  export class VtkModel {
 | 
											
												
													
														|  |    constructor() {
 |  |    constructor() {
 | 
											
										
											
												
													
														|  | @@ -31,25 +33,39 @@ export class VtkModel {
 | 
											
												
													
														|  |     
 |  |     
 | 
											
												
													
														|  |      this.mapper.setInputData(this.polyData);
 |  |      this.mapper.setInputData(this.polyData);
 | 
											
												
													
														|  |      this.actor.setMapper(this.mapper);
 |  |      this.actor.setMapper(this.mapper);
 | 
											
												
													
														|  | -  
 |  | 
 | 
											
												
													
														|  | 
 |  | +    this.renderer.addActor(this.actor);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      //点数据
 |  |      //点数据
 | 
											
												
													
														|  |      this.actor2 = vtkActor.newInstance();
 |  |      this.actor2 = vtkActor.newInstance();
 | 
											
												
													
														|  |      this.actor2.getProperty().setRepresentation(Representation.POINTS); //点   
 |  |      this.actor2.getProperty().setRepresentation(Representation.POINTS); //点   
 | 
											
												
													
														|  |      this.actor2.getProperty().setColor([2,0,0]);
 |  |      this.actor2.getProperty().setColor([2,0,0]);
 | 
											
												
													
														|  |      this.actor2.getProperty().setPointSize(2);
 |  |      this.actor2.getProperty().setPointSize(2);
 | 
											
												
													
														|  | -    this.actor2.setMapper(this.mapper);
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    this.renderer.addActor(this.actor);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    this.actor2.setMapper(this.mapper);  
 | 
											
												
													
														|  |      this.renderer.addActor(this.actor2);
 |  |      this.renderer.addActor(this.actor2);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      //选取
 |  |      //选取
 | 
											
												
													
														|  | -    const openGLRenderWindow = this.renderWindowWith.getApiSpecificRenderWindow();
 |  | 
 | 
											
												
													
														|  | -    const selector = vtkOpenGLHardwareSelector.newInstance({
 |  | 
 | 
											
												
													
														|  | -      captureZValues: true,
 |  | 
 | 
											
												
													
														|  | -    });
 |  | 
 | 
											
												
													
														|  | -    selector.setFieldAssociation(FieldAssociations.FIELD_ASSOCIATION_POINTS);
 |  | 
 | 
											
												
													
														|  | -    selector.attach(openGLRenderWindow, this.renderer)
 |  | 
 | 
											
												
													
														|  | 
 |  | +    this.interactor = this.renderer.getRenderWindow().getInteractor();
 | 
											
												
													
														|  | 
 |  | +    this.apiSpecificRenderWindow = this.interactor.getView();
 | 
											
												
													
														|  | 
 |  | +    this.hardwareSelector = this.apiSpecificRenderWindow.getSelector();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    this.hardwareSelector.setCaptureZValues(true);
 | 
											
												
													
														|  | 
 |  | +    // TODO: bug in FIELD_ASSOCIATION_POINTS mode
 | 
											
												
													
														|  | 
 |  | +    // hardwareSelector.setFieldAssociation(
 | 
											
												
													
														|  | 
 |  | +    //   FieldAssociations.FIELD_ASSOCIATION_POINTS
 | 
											
												
													
														|  | 
 |  | +    // );
 | 
											
												
													
														|  | 
 |  | +    this.hardwareSelector.setFieldAssociation(FieldAssociations.FIELD_ASSOCIATION_POINTS);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // this.pointerSource = vtkSphereSource.newInstance({
 | 
											
												
													
														|  | 
 |  | +    //   phiResolution: 15,
 | 
											
												
													
														|  | 
 |  | +    //   thetaResolution: 15,
 | 
											
												
													
														|  | 
 |  | +    //   radius: 0.01,
 | 
											
												
													
														|  | 
 |  | +    // });
 | 
											
												
													
														|  | 
 |  | +    // this.pointerMapper = vtkMapper.newInstance();
 | 
											
												
													
														|  | 
 |  | +    // this.pointerActor = vtkActor.newInstance();
 | 
											
												
													
														|  | 
 |  | +    // this.pointerActor.setMapper(this.pointerMapper);
 | 
											
												
													
														|  | 
 |  | +    // this.pointerMapper.setInputConnection(this.pointerSource.getOutputPort());
 | 
											
												
													
														|  | 
 |  | +    // this.renderer.addActor(this.pointerActor);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      //结果数据
 |  |      //结果数据
 | 
											
										
											
												
													
														|  | @@ -105,5 +121,7 @@ export class VtkModel {
 | 
											
												
													
														|  |    } 
 |  |    } 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  const vtkmodel = new VtkModel();
 |  |  const vtkmodel = new VtkModel();
 | 
											
												
													
														|  |  export { vtkmodel };
 |  |  export { vtkmodel };
 |