MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkPanelComponent

Class vtkPanelComponent

Wrapping/Java/vtk/rendering/awt/vtkPanelComponent.java:30–128  ·  view source on GitHub ↗

Provide AWT based vtk rendering component using the vtkPanel class while exposing everything as a new rendering component. @author Sebastien Jourdain - sebastien.jourdain@kitware.com Notes: This class should be replaced down the road by the vtkAwtComponent but on some platform such as Windo

Source from the content-addressed store, hash-verified

28 */
29
30public class vtkPanelComponent implements vtkComponent<vtkPanel> {
31 protected vtkPanel panel;
32 protected ReentrantLock lock;
33 protected vtkGenericRenderWindowInteractor windowInteractor;
34 protected vtkInteractorForwarder eventForwarder;
35
36 public vtkPanelComponent() {
37 this.panel = new vtkPanel();
38 this.lock = new ReentrantLock();
39
40 // Init interactor
41 this.windowInteractor = new vtkGenericRenderWindowInteractor();
42 this.windowInteractor.SetRenderWindow(this.panel.GetRenderWindow());
43 this.windowInteractor.TimerEventResetsTimerOff();
44
45 this.windowInteractor.SetSize(200, 200);
46 this.windowInteractor.ConfigureEvent();
47
48 // Update style
49 vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();
50 this.windowInteractor.SetInteractorStyle(style);
51
52 // Setup event forwarder
53 this.eventForwarder = new vtkInteractorForwarder(this);
54 this.windowInteractor.AddObserver("CreateTimerEvent", this.eventForwarder, "StartTimer");
55 this.windowInteractor.AddObserver("DestroyTimerEvent", this.eventForwarder, "DestroyTimer");
56
57 // Remove unwanted listeners
58 this.panel.removeKeyListener(this.panel);
59 this.panel.removeMouseListener(this.panel);
60 this.panel.removeMouseMotionListener(this.panel);
61 this.panel.removeMouseWheelListener(this.panel);
62
63 // Add mouse listener that update interactor
64 this.panel.addMouseListener(this.eventForwarder);
65 this.panel.addMouseMotionListener(this.eventForwarder);
66 this.panel.addMouseWheelListener(this.eventForwarder);
67
68 // Make sure we update the light position when interacting
69 this.panel.addMouseMotionListener(new MouseMotionAdapter() {
70 public void mouseDragged(MouseEvent e) {
71 panel.UpdateLight();
72 }
73 });
74 }
75
76 public void resetCamera() {
77 this.panel.resetCamera();
78 }
79
80 public void resetCameraClippingRange() {
81 this.panel.resetCameraClippingRange();
82 }
83
84 public vtkCamera getActiveCamera() {
85 return this.panel.GetRenderer().GetActiveCamera();
86 }
87

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected