Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkDisplayActionEvents.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef MITKDISPLAYACTIONEVENTS_H
14 #define MITKDISPLAYACTIONEVENTS_H
15 
16 #include <MitkCoreExports.h>
17 
18 // mitk core
19 #include "mitkInteractionEvent.h"
20 
21 // itk
22 #include <itkEventObject.h>
23 
24 #include <mitkVector.h>
25 #include <mitkPoint.h>
26 
27 namespace mitk
28 {
29  class MITKCORE_EXPORT DisplayActionEvent : public itk::AnyEvent
30  {
31  public:
33  typedef itk::AnyEvent Superclass;
34 
35  DisplayActionEvent() : m_InteractionEvent(nullptr) {}
36  DisplayActionEvent(InteractionEvent* interactionEvent) : m_InteractionEvent(interactionEvent) {}
37  ~DisplayActionEvent() override {}
38  const char* GetEventName() const override { return "DisplayActionEvent"; }
39  bool CheckEvent(const itk::EventObject* e) const override
40  { return dynamic_cast<const Self*>(e) != nullptr; }
41  itk::EventObject* MakeObject() const override { return new Self(m_InteractionEvent); }
42  InteractionEvent* GetInteractionEvent() const { return m_InteractionEvent; }
44  {
45  return m_InteractionEvent != nullptr ? m_InteractionEvent->GetSender() : nullptr;
46  }
47  DisplayActionEvent(const Self& s) : Superclass(s), m_InteractionEvent(s.GetInteractionEvent()) {};
48 
49  private:
50  InteractionEvent* m_InteractionEvent;
51  void operator=(const Self &);
52  };
53 
55  {
56  public:
59 
60  DisplayMoveEvent() : Superclass() {}
61  DisplayMoveEvent(InteractionEvent* interactionEvent, const Vector2D& moveVector)
62  : Superclass(interactionEvent)
63  , m_MoveVector(moveVector)
64  {
65  }
66  ~DisplayMoveEvent() override {}
67  const char* GetEventName() const override { return "DisplayMoveEvent"; }
68  bool CheckEvent(const itk::EventObject* e) const override
69  { return dynamic_cast<const Self*>(e) != nullptr; }
70  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_MoveVector); }
71  const Vector2D& GetMoveVector() const { return m_MoveVector; }
72  DisplayMoveEvent(const Self& s) : Superclass(s), m_MoveVector(s.GetMoveVector()) {};
73 
74  private:
75  Vector2D m_MoveVector;
76  };
77 
79  {
80  public:
83 
84  DisplaySetCrosshairEvent() : Superclass() {}
85  DisplaySetCrosshairEvent(InteractionEvent* interactionEvent, const Point3D& position)
86  : Superclass(interactionEvent)
87  , m_Position(position)
88  {
89  }
91  const char* GetEventName() const override { return "DisplaySetCrosshairEvent"; }
92  bool CheckEvent(const itk::EventObject* e) const override
93  { return dynamic_cast<const Self*>(e) != nullptr; }
94  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Position); }
95  const Point3D& GetPosition() const { return m_Position; }
96  DisplaySetCrosshairEvent(const Self& s) : Superclass(s), m_Position(s.GetPosition()) {};
97 
98  private:
99  Point3D m_Position;
100  };
101 
103  {
104  public:
107 
108  DisplayZoomEvent() : Superclass() {}
109  DisplayZoomEvent(InteractionEvent* interactionEvent, float zoomFactor, const Point2D& startCoordinate)
110  : Superclass(interactionEvent)
111  , m_ZoomFactor(zoomFactor)
112  , m_StartCoordinate(startCoordinate)
113  {
114  }
115  ~DisplayZoomEvent() override {}
116  const char* GetEventName() const override { return "DisplayZoomEvent"; }
117  bool CheckEvent(const itk::EventObject* e) const override
118  { return dynamic_cast<const Self*>(e) != nullptr; }
119  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_ZoomFactor, m_StartCoordinate); }
120  float GetZoomFactor() const { return m_ZoomFactor; }
121  const Point2D& GetStartCoordinate() const { return m_StartCoordinate; }
122  DisplayZoomEvent(const Self& s) : Superclass(s), m_ZoomFactor(s.GetZoomFactor()), m_StartCoordinate(s.GetStartCoordinate()) {};
123 
124  private:
125  float m_ZoomFactor;
126  Point2D m_StartCoordinate;
127  };
128 
130  {
131  public:
134 
135  DisplayScrollEvent() : Superclass() {}
136  DisplayScrollEvent(InteractionEvent* interactionEvent, int sliceDelta)
137  : Superclass(interactionEvent)
138  , m_SliceDelta(sliceDelta)
139  {
140  }
141  ~DisplayScrollEvent() override {}
142  const char* GetEventName() const override { return "DisplayScrollEvent"; }
143  bool CheckEvent(const itk::EventObject* e) const override
144  { return dynamic_cast<const Self*>(e) != nullptr; }
145  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_SliceDelta); }
146  int GetSliceDelta() const { return m_SliceDelta; }
147  DisplayScrollEvent(const Self& s) : Superclass(s), m_SliceDelta(s.GetSliceDelta()) {};
148 
149  private:
150  int m_SliceDelta;
151  };
152 
154  {
155  public:
158 
159  DisplaySetLevelWindowEvent() : Superclass() {}
161  : Superclass(interactionEvent)
162  , m_Level(level)
163  , m_Window(window)
164  {
165  }
167  const char* GetEventName() const override { return "DisplaySetLevelWindowEvent"; }
168  bool CheckEvent(const itk::EventObject* e) const override
169  {
170  return dynamic_cast<const Self*>(e) != nullptr;
171  }
172  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Level, m_Window); }
173  ScalarType GetLevel() const { return m_Level; }
174  ScalarType GetWindow() const { return m_Window; }
175  DisplaySetLevelWindowEvent(const Self& s) : Superclass(s), m_Level(s.GetLevel()), m_Window(s.GetWindow()) {};
176 
177  private:
178  ScalarType m_Level;
179  ScalarType m_Window;
180  };
181 
182 } // end namespace
183 
184 #endif // MITKDISPLAYACTIONEVENTS_H
DisplayScrollEvent(InteractionEvent *interactionEvent, int sliceDelta)
#define MITKCORE_EXPORT
DisplaySetCrosshairEvent(InteractionEvent *interactionEvent, const Point3D &position)
bool CheckEvent(const itk::EventObject *e) const override
bool CheckEvent(const itk::EventObject *e) const override
bool CheckEvent(const itk::EventObject *e) const override
double ScalarType
DisplayActionEvent(InteractionEvent *interactionEvent)
bool CheckEvent(const itk::EventObject *e) const override
Organizes the rendering process.
const Point2D & GetStartCoordinate() const
DataCollection - Class to facilitate loading/accessing structured data.
itk::EventObject * MakeObject() const override
bool CheckEvent(const itk::EventObject *e) const override
itk::EventObject * MakeObject() const override
bool CheckEvent(const itk::EventObject *e) const override
const char * GetEventName() const override
itk::EventObject * MakeObject() const override
const char * GetEventName() const override
const char * GetEventName() const override
DisplaySetLevelWindowEvent(InteractionEvent *interactionEvent, ScalarType level, ScalarType window)
BaseRenderer * GetSender() const
itk::EventObject * MakeObject() const override
InteractionEvent * GetInteractionEvent() const
const char * GetEventName() const override
const Vector2D & GetMoveVector() const
const char * GetEventName() const override
itk::EventObject * MakeObject() const override
itk::EventObject * MakeObject() const override
const char * GetEventName() const override
DisplayZoomEvent(InteractionEvent *interactionEvent, float zoomFactor, const Point2D &startCoordinate)
DisplayMoveEvent(InteractionEvent *interactionEvent, const Vector2D &moveVector)