X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d.vtk%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fvtk%2Fgizmo%2FRotateAxisGizmo.java;h=94ea902c4f441bbb7819220d72c8e1867ba53364;hb=84132a1d750c45f9161afbd58b78572964e50d26;hp=266a73c257c89007854b50c76e0b6bac3e29ccc9;hpb=87b3241ec277ba3d8e414b26186a032c9cdcaeed;p=simantics%2F3d.git diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/gizmo/RotateAxisGizmo.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/gizmo/RotateAxisGizmo.java index 266a73c2..94ea902c 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/gizmo/RotateAxisGizmo.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/gizmo/RotateAxisGizmo.java @@ -1,69 +1,80 @@ -package org.simantics.g3d.vtk.gizmo; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.vecmath.Point3d; - -import org.simantics.g3d.vtk.action.RotateAction; -import org.simantics.g3d.vtk.shape.vtkShape; - -import vtk.vtkActor; -import vtk.vtkProp; - -public class RotateAxisGizmo extends vtkGizmo{ - - private List parts = new ArrayList(); - int type = -1; - - - @Override - public Collection getGizmo() { - for (vtkProp p : parts) - p.Delete(); - parts.clear(); - double l = 100; - double w = 3; - switch (type) { - case RotateAction.X:{ - vtkActor lineActorX = vtkShape.createLineActor(new Point3d(-l,0,0), new Point3d(l,0,0)); - lineActorX.GetProperty().SetColor(1, 0, 0); - lineActorX.GetProperty().SetLineWidth(w); - lineActorX.GetProperty().Delete(); - parts.add(lineActorX); - break; - } - case RotateAction.Y: { - vtkActor lineActorY = vtkShape.createLineActor(new Point3d(0,-l,0), new Point3d(0,l,0)); - lineActorY.GetProperty().SetColor(0, 1, 0); - lineActorY.GetProperty().SetLineWidth(w); - lineActorY.GetProperty().Delete(); - parts.add(lineActorY); - break; - } - case RotateAction.Z: { - vtkActor lineActorZ = vtkShape.createLineActor(new Point3d(0,0,-l), new Point3d(0,0,l)); - lineActorZ.GetProperty().SetColor(0, 0, 1); - lineActorZ.GetProperty().SetLineWidth(w); - lineActorZ.GetProperty().Delete(); - parts.add(lineActorZ); - break; - } - default: { - - } - } - return parts; - } - - public void setType(int type) { - if (this.type == type) - return; - this.type = type; - deattachActors(); - attachActors(); - } - - -} +/******************************************************************************* + * Copyright (c) 2012, 2013 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.g3d.vtk.gizmo; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import javax.vecmath.Point3d; + +import org.simantics.g3d.vtk.awt.RotateAction; +import org.simantics.g3d.vtk.shape.vtkShape; + +import vtk.vtkActor; +import vtk.vtkProp; + +public class RotateAxisGizmo extends vtkGizmo{ + + private List parts = new ArrayList(); + int type = -1; + + + @Override + public Collection getGizmo() { + for (vtkProp p : parts) + p.Delete(); + parts.clear(); + double l = 100; + double w = 3; + switch (type) { + case RotateAction.X:{ + vtkActor lineActorX = vtkShape.createLineActor(new Point3d(-l,0,0), new Point3d(l,0,0)); + lineActorX.GetProperty().SetColor(1, 0, 0); + lineActorX.GetProperty().SetLineWidth(w); + lineActorX.GetProperty().Delete(); + parts.add(lineActorX); + break; + } + case RotateAction.Y: { + vtkActor lineActorY = vtkShape.createLineActor(new Point3d(0,-l,0), new Point3d(0,l,0)); + lineActorY.GetProperty().SetColor(0, 1, 0); + lineActorY.GetProperty().SetLineWidth(w); + lineActorY.GetProperty().Delete(); + parts.add(lineActorY); + break; + } + case RotateAction.Z: { + vtkActor lineActorZ = vtkShape.createLineActor(new Point3d(0,0,-l), new Point3d(0,0,l)); + lineActorZ.GetProperty().SetColor(0, 0, 1); + lineActorZ.GetProperty().SetLineWidth(w); + lineActorZ.GetProperty().Delete(); + parts.add(lineActorZ); + break; + } + default: { + + } + } + return parts; + } + + public void setType(int type) { + if (this.type == type) + return; + this.type = type; + deattachActors(); + attachActors(); + } + + +}