1 package org.simantics.g3d.vtk.gizmo;
\r
3 import java.util.ArrayList;
\r
4 import java.util.Collection;
\r
5 import java.util.List;
\r
7 import javax.vecmath.Point3d;
\r
9 import org.simantics.g3d.vtk.action.RotateAction;
\r
10 import org.simantics.g3d.vtk.shape.vtkShape;
\r
12 import vtk.vtkActor;
\r
15 public class RotateAxisGizmo extends vtkGizmo{
\r
17 private List<vtkProp> parts = new ArrayList<vtkProp>();
\r
22 public Collection<vtkProp> getGizmo() {
\r
23 for (vtkProp p : parts)
\r
29 case RotateAction.X:{
\r
30 vtkActor lineActorX = vtkShape.createLineActor(new Point3d(-l,0,0), new Point3d(l,0,0));
\r
31 lineActorX.GetProperty().SetColor(1, 0, 0);
\r
32 lineActorX.GetProperty().SetLineWidth(w);
\r
33 lineActorX.GetProperty().Delete();
\r
34 parts.add(lineActorX);
\r
37 case RotateAction.Y: {
\r
38 vtkActor lineActorY = vtkShape.createLineActor(new Point3d(0,-l,0), new Point3d(0,l,0));
\r
39 lineActorY.GetProperty().SetColor(0, 1, 0);
\r
40 lineActorY.GetProperty().SetLineWidth(w);
\r
41 lineActorY.GetProperty().Delete();
\r
42 parts.add(lineActorY);
\r
45 case RotateAction.Z: {
\r
46 vtkActor lineActorZ = vtkShape.createLineActor(new Point3d(0,0,-l), new Point3d(0,0,l));
\r
47 lineActorZ.GetProperty().SetColor(0, 0, 1);
\r
48 lineActorZ.GetProperty().SetLineWidth(w);
\r
49 lineActorZ.GetProperty().Delete();
\r
50 parts.add(lineActorZ);
\r
60 public void setType(int type) {
\r
61 if (this.type == type)
\r