import java.util.Collection;
import java.util.List;
+import javax.vecmath.Point2d;
+import javax.vecmath.Point2i;
+import javax.vecmath.Point3d;
+
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
resetCameraClippingRange();
}
}
+ if (hoverActor.size() > 0) {
+ hoverActor.clear();
+ fireHoverChanged();
+ }
lastX = x;
lastY = y;
panel.Render();
return;
if (e.getButton() != MouseEvent.BUTTON1)
return;
+ lastX = e.getX();
+ lastY = e.getY();
vtkProp spick[] = panel.pick(e.getX(), e.getY());
if (spick != null && spick.length > 0) {
for (vtkProp selectActor : spick) {
}
}
+ @Override
+ public void mouseExited(MouseEvent e) {
+ if (hoverActor.size() > 0) {
+ hoverActor.clear();
+ fireHoverChanged();
+ }
+ }
+
+ /**
+ * Returns mouse position in AWT screen coordinates.
+ * @return
+ */
+ public Point2i getMousePositionAWT() {
+ return new Point2i(lastX, lastY);
+ }
+
+ /**
+ * Returns mouse position in VTK screen coordinates.
+ * @return
+ */
+ public Point2d getMousePosition() {
+ return new Point2d(lastX, rw.GetSize()[1]-lastY);
+ }
+
public List<vtkProp> getSelectActor() {
return selectActors;
}
});
}
- public void focus(double x, double y, double z) {
+ public vtkCamera getCamera() {
+ return cam;
+ }
+
+ public Point3d getPosition() {
+ double pos[] = cam.GetPosition();
+ return new Point3d(pos);
+ }
+
+ public Point3d getFocus() {
+ double pos[] = cam.GetFocalPoint();
+ return new Point3d(pos);
+ }
+
+ public void setFocus(Point3d focus) {
+ setFocus(focus.x,focus.y,focus.z);
+ }
+
+ public void setFocus(double x, double y, double z) {
Lock();
cam.SetFocalPoint(x, y, z);
if (doNotRotate)
cam.SetRoll(0);
cam.OrthogonalizeViewUp();
- resetCameraClippingRange();
+ ren.ResetCameraClippingRange();
panel.UpdateLight();
UnLock();
}
+ public void setPosition(Point3d position) {
+ setPosition(position.x,position.y,position.z);
+ }
+
+ public void setPosition(double x, double y, double z) {
+ Lock();
+ cam.SetPosition(x, y, z);
+ if (doNotRotate)
+ cam.SetRoll(0);
+ cam.OrthogonalizeViewUp();
+ ren.ResetCameraClippingRange();
+ panel.UpdateLight();
+ UnLock();
+ }
+
+
+
}