27 #include <vtkCamera.h>
28 #include <vtkInteractorStyle.h>
29 #include <vtkMatrix4x4.h>
30 #include <vtkPointData.h>
31 #include <vtkPolyData.h>
32 #include <vtkRenderWindowInteractor.h>
77 return object &&
object->GetGeometry()->GetBoundingBox()->IsInside(currentPickedPoint);
92 void mitk::AffineImageCropperInteractor::Deselect()
111 if (wheelEvent == NULL)
114 if (m_SelectedNode.IsNull())
119 newScale[0] = newScale[1] = newScale[2] = scale;
123 m_SelectedNode->GetData()->GetGeometry()->ExecuteOperation(doOp);
130 if (m_SelectedNode.IsNull())
133 if (positionEvent == NULL)
141 m_InitialOrigin = surGeo->GetOrigin();
147 if (positionEvent == NULL)
161 if (positionEvent == NULL)
175 if (positionEvent == NULL)
181 interactionMove[0] = currentPickedPoint[0] - m_InitialPickedPoint[0];
182 interactionMove[1] = currentPickedPoint[1] - m_InitialPickedPoint[1];
183 interactionMove[2] = currentPickedPoint[2] - m_InitialPickedPoint[2];
187 surGeo->SetOrigin(m_InitialOrigin);
188 surGeo->Translate(interactionMove);
196 if (positionEvent == NULL)
200 Vector3D interactionMove = currentPickedPoint - m_InitialPickedPoint;
203 surface->SetGeometry(m_OriginalGeometry);
206 surGeo->WorldToIndex(interactionMove, interactionMove);
208 for (
int i = 0; i < 3; ++i)
210 scale[i] = (interactionMove[i] * surGeo->GetMatrixColumn(i).magnitude()) - 1;
216 surGeo->ExecuteOperation(doOp);
224 if (positionEvent == NULL)
228 if (currentPickedDisplayPoint.EuclideanDistanceTo(m_InitialPickedDisplayPoint) < 1)
233 if (currentVtkRenderer && currentVtkRenderer->GetActiveCamera())
236 currentVtkRenderer->GetActiveCamera()->GetViewPlaneNormal(vpn);
239 rotationAxis[0] = vpn[0];
240 rotationAxis[1] = vpn[1];
241 rotationAxis[2] = vpn[2];
242 rotationAxis.Normalize();
244 Vector2D move = currentPickedDisplayPoint - m_InitialPickedDisplayPoint;
246 double rotationAngle = -57.3 * atan(move[0] / move[1]);
248 rotationAngle += 180;
251 Point3D rotationCenter = m_OriginalGeometry->GetCenter();
253 rotationCenter = m_InitialPickedPoint;
259 newGeometry->ExecuteOperation(&op);
260 m_SelectedNode->GetData()->SetGeometry(newGeometry);
Class for storing surfaces (vtkPolyData).
Super class for all position events.
Standard implementation of BaseGeometry.
virtual bool CheckOverObject(const InteractionEvent *)
Checks if the mouse pointer is over the object.
BaseRenderer * GetSender() const
virtual void InitTranslate(StateMachineAction *, InteractionEvent *)
virtual void DeformObject(StateMachineAction *, InteractionEvent *)
Point3D GetPositionInWorld() const
virtual void InitRotate(StateMachineAction *, InteractionEvent *)
Constants for most interaction classes, due to the generic StateMachines.
virtual void ScaleRadius(StateMachineAction *, InteractionEvent *interactionEvent)
virtual void ConnectActionsAndFunctions() override
virtual void DeselectObject(StateMachineAction *, InteractionEvent *)
Called if the mouse pointer leaves the area of the object.
Point2D GetPointerPositionOnScreen() const
virtual void SelectObject(StateMachineAction *, InteractionEvent *)
Called if the mouse pointer is over the object indicated by a color change.
superclass of all bounding objects (cylinder, cuboid,...)
virtual void DataNodeChanged() override
AffineImageCropperInteractor()
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
virtual void TranslateObject(StateMachineAction *, InteractionEvent *)
Performs a translation of the object relative to the mouse movement.
virtual ~AffineImageCropperInteractor()
static RenderingManager * GetInstance()
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual MapperSlotId GetMapperID()
Get the MapperSlotId to use.
virtual void DeselectObject(StateMachineAction *, InteractionEvent *)
virtual bool CheckOverObject(const InteractionEvent *interactionEvent)
virtual void RotateObject(StateMachineAction *, InteractionEvent *interactionEvent)
#define CONNECT_CONDITION(a, f)
virtual void InitDeformation(StateMachineAction *, InteractionEvent *)
The ScaleOperation is an operation to scale any mitk::BaseGeometry.
virtual void SelectObject(StateMachineAction *, InteractionEvent *)
int GetWheelDelta() const
#define CONNECT_FUNCTION(a, f)
vtkRenderer * GetVtkRenderer() const
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
Operation, that holds everything necessary for an rotation operation on mitk::BaseData.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
virtual void TranslateObject(StateMachineAction *, InteractionEvent *interactionEvent)
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (in mm) of a point to (continuous!) index coordinates.