(String[] args)
| 26 | } |
| 27 | |
| 28 | public static void main(String[] args) { |
| 29 | |
| 30 | Display display = new Display(); |
| 31 | Shell shell = new Shell(display); |
| 32 | |
| 33 | // build VTK Pipeline |
| 34 | vtkConeSource cone = new vtkConeSource(); |
| 35 | cone.SetResolution(8); |
| 36 | |
| 37 | vtkPolyDataMapper coneMapper = new vtkPolyDataMapper(); |
| 38 | coneMapper.SetInputConnection(cone.GetOutputPort()); |
| 39 | |
| 40 | vtkActor coneActor = new vtkActor(); |
| 41 | coneActor.SetMapper(coneMapper); |
| 42 | |
| 43 | // VTK rendering part |
| 44 | final vtkSwtComponent swtWidget = new vtkSwtComponent(shell); |
| 45 | swtWidget.getRenderer().AddActor(coneActor); |
| 46 | |
| 47 | shell.addControlListener(new ControlListener() { |
| 48 | |
| 49 | @Override |
| 50 | public void controlResized(ControlEvent e) { |
| 51 | if (e.widget instanceof Shell) { |
| 52 | Shell s = (Shell) e.widget; |
| 53 | swtWidget.setSize(s.getClientArea().width, s.getClientArea().height); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public void controlMoved(ControlEvent e) { |
| 59 | // TODO Auto-generated method stub |
| 60 | |
| 61 | } |
| 62 | }); |
| 63 | |
| 64 | shell.pack(); |
| 65 | shell.open(); |
| 66 | while (!shell.isDisposed()) { |
| 67 | if (!display.readAndDispatch()) |
| 68 | display.sleep(); |
| 69 | } |
| 70 | display.dispose(); |
| 71 | } |
| 72 | } |
nothing calls this directly
no test coverage detected