Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkBoundingShapeInteractor.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkBoundingShapeInteractor_h
18 #define mitkBoundingShapeInteractor_h
19 
20 #include <mitkDataInteractor.h>
21 #include <mitkEventConfig.h>
22 #include <mitkGeometry3D.h>
23 
24 #include <usServiceRegistration.h>
25 
27 
28 namespace mitk
29 {
30 // create events for interactions
31 #pragma GCC visibility push(default)
32  itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent)
33 #pragma GCC visibility pop
34 
42  class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor : public DataInteractor
43  {
44  public:
45  mitkClassMacro(BoundingShapeInteractor, DataInteractor);
46  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
47 
48  virtual void SetDataNode(DataNode *dataNode) override;
49  void SetRotationEnabled(bool rotationEnabled);
50 
51  protected:
53  virtual ~BoundingShapeInteractor();
54 
59  virtual void ConnectActionsAndFunctions() override;
60 
64  virtual void DataNodeChanged() override;
65 
66  void HandlePositionChanged(const InteractionEvent *interactionEvent, Point3D &center);
67 
71  virtual bool CheckOverObject(const InteractionEvent *);
72 
76  virtual bool CheckOverHandles(const InteractionEvent *interactionEvent);
77 
81  virtual void SelectObject(StateMachineAction *, InteractionEvent *);
82 
86  virtual void DeselectObject(StateMachineAction *, InteractionEvent *);
87 
91  virtual void SelectHandle(StateMachineAction *, InteractionEvent *);
92 
96  virtual void TranslateObject(StateMachineAction *, InteractionEvent *);
97 
101  virtual void ScaleObject(StateMachineAction *, InteractionEvent *);
102 
106  // virtual void RotateObject(StateMachineAction*, InteractionEvent* interactionEvent); /* not implemented */
107 
111  virtual void InitInteraction(StateMachineAction *, InteractionEvent *interactionEvent);
115  virtual void DeselectHandles(StateMachineAction *, InteractionEvent *interactionEvent);
119  virtual void RestoreNodeProperties();
123  bool InitMembers(InteractionEvent *interactionEvent);
124 
125  private:
129  void EnableCrosshairNavigation();
133  void DisableCrosshairNavigation();
134 
135  class Impl;
136  Impl *m_Impl;
137  };
138 }
139 #endif
bool InitMembers(InteractionEvent *interactionEvent)
Initializes member variables.
virtual bool CheckOverObject(const InteractionEvent *)
Checks if the mouse pointer is over the object.
#define MITKBOUNDINGSHAPE_EXPORT
virtual void DataNodeChanged() override
Called when a DataNode has been set/changed.
DataCollection - Class to facilitate loading/accessing structured data.
virtual void DeselectObject(StateMachineAction *, InteractionEvent *)
Called if the mouse pointer leaves the area of the object.
virtual void SelectObject(StateMachineAction *, InteractionEvent *)
Called if the mouse pointer is over the object indicated by a color change.
virtual void RestoreNodeProperties()
Restore default properties of bounding box and handles.
virtual void TranslateObject(StateMachineAction *, InteractionEvent *)
Performs a translation of the object relative to the mouse movement.
virtual void DeselectHandles(StateMachineAction *, InteractionEvent *interactionEvent)
Deselects all Handles at the end of interaction.
virtual bool CheckOverHandles(const InteractionEvent *interactionEvent)
Checks if the mouse pointer is over one of the assigned handles.
virtual void ConnectActionsAndFunctions() override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Point< ScalarType, 3 > Point3D
Definition: mitkPoint.h:99
itkEventMacro(ContourModelEvent, itk::AnyEvent)
virtual void SetDataNode(DataNode *dataNode) override
void SetRotationEnabled(bool rotationEnabled)
void HandlePositionChanged(const InteractionEvent *interactionEvent, Point3D &center)
virtual void SelectHandle(StateMachineAction *, InteractionEvent *)
Called if the mouse pointer is over one of the handles indicated by a color change.
virtual void ScaleObject(StateMachineAction *, InteractionEvent *)
Performs a object shape change by influencing the scaling of the initial bounding box...
BoundingShapeInteractor()
virtual void InitInteraction(StateMachineAction *, InteractionEvent *interactionEvent)
Performs a rotation of the object relative to the mouse movement.