1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.vtk.gizmo;
\r
14 import java.util.ArrayList;
\r
15 import java.util.Collection;
\r
16 import java.util.List;
\r
18 import javax.vecmath.Point3d;
\r
20 import org.simantics.g3d.vtk.action.RotateAction;
\r
21 import org.simantics.g3d.vtk.shape.vtkShape;
\r
23 import vtk.vtkActor;
\r
26 public class RotateAxisGizmo extends vtkGizmo{
\r
28 private List<vtkProp> parts = new ArrayList<vtkProp>();
\r
33 public Collection<vtkProp> getGizmo() {
\r
34 for (vtkProp p : parts)
\r
40 case RotateAction.X:{
\r
41 vtkActor lineActorX = vtkShape.createLineActor(new Point3d(-l,0,0), new Point3d(l,0,0));
\r
42 lineActorX.GetProperty().SetColor(1, 0, 0);
\r
43 lineActorX.GetProperty().SetLineWidth(w);
\r
44 lineActorX.GetProperty().Delete();
\r
45 parts.add(lineActorX);
\r
48 case RotateAction.Y: {
\r
49 vtkActor lineActorY = vtkShape.createLineActor(new Point3d(0,-l,0), new Point3d(0,l,0));
\r
50 lineActorY.GetProperty().SetColor(0, 1, 0);
\r
51 lineActorY.GetProperty().SetLineWidth(w);
\r
52 lineActorY.GetProperty().Delete();
\r
53 parts.add(lineActorY);
\r
56 case RotateAction.Z: {
\r
57 vtkActor lineActorZ = vtkShape.createLineActor(new Point3d(0,0,-l), new Point3d(0,0,l));
\r
58 lineActorZ.GetProperty().SetColor(0, 0, 1);
\r
59 lineActorZ.GetProperty().SetLineWidth(w);
\r
60 lineActorZ.GetProperty().Delete();
\r
61 parts.add(lineActorZ);
\r
71 public void setType(int type) {
\r
72 if (this.type == type)
\r