Medical Imaging Interaction Toolkit  2022.04.99-194dd5d8
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 { return dynamic_cast<const Self *>(e) != nullptr; }
40  itk::EventObject* MakeObject() const override { return new Self(m_InteractionEvent); }
41  InteractionEvent* GetInteractionEvent() const { return m_InteractionEvent; }
43  {
44  return m_InteractionEvent != nullptr ? m_InteractionEvent->GetSender() : nullptr;
45  }
46  DisplayActionEvent(const Self& s) : Superclass(s), m_InteractionEvent(s.GetInteractionEvent()) {};
47 
48  private:
49  InteractionEvent* m_InteractionEvent;
50  void operator=(const Self &);
51  };
52 
54  {
55  public:
58 
59  DisplayMoveEvent() : Superclass() {}
60  DisplayMoveEvent(InteractionEvent* interactionEvent, const Vector2D& moveVector)
61  : Superclass(interactionEvent)
62  , m_MoveVector(moveVector)
63  {
64  }
65  ~DisplayMoveEvent() override {}
66  const char* GetEventName() const override { return "DisplayMoveEvent"; }
67  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
68  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_MoveVector); }
69  const Vector2D& GetMoveVector() const { return m_MoveVector; }
70  DisplayMoveEvent(const Self& s) : Superclass(s), m_MoveVector(s.GetMoveVector()) {};
71 
72  private:
73  Vector2D m_MoveVector;
74  };
75 
77  {
78  public:
81 
82  DisplaySetCrosshairEvent() : Superclass() {}
83  DisplaySetCrosshairEvent(InteractionEvent* interactionEvent, const Point3D& position)
84  : Superclass(interactionEvent)
85  , m_Position(position)
86  {
87  }
89  const char* GetEventName() const override { return "DisplaySetCrosshairEvent"; }
90  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
91  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Position); }
92  const Point3D& GetPosition() const { return m_Position; }
93  DisplaySetCrosshairEvent(const Self& s) : Superclass(s), m_Position(s.GetPosition()) {};
94 
95  private:
96  Point3D m_Position;
97  };
98 
100  {
101  public:
104 
105  DisplayZoomEvent() : Superclass() {}
106  DisplayZoomEvent(InteractionEvent* interactionEvent, float zoomFactor, const Point2D& startCoordinate)
107  : Superclass(interactionEvent)
108  , m_ZoomFactor(zoomFactor)
109  , m_StartCoordinate(startCoordinate)
110  {
111  }
112  ~DisplayZoomEvent() override {}
113  const char* GetEventName() const override { return "DisplayZoomEvent"; }
114  bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
115  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_ZoomFactor, m_StartCoordinate); }
116  float GetZoomFactor() const { return m_ZoomFactor; }
117  const Point2D& GetStartCoordinate() const { return m_StartCoordinate; }
118  DisplayZoomEvent(const Self& s) : Superclass(s), m_ZoomFactor(s.GetZoomFactor()), m_StartCoordinate(s.GetStartCoordinate()) {};
119 
120  private:
121  float m_ZoomFactor;
122  Point2D m_StartCoordinate;
123  };
124 
126  {
127  public:
130 
131  DisplayScrollEvent() : Superclass() {}
132  DisplayScrollEvent(InteractionEvent* interactionEvent, int sliceDelta, bool autoRepeat)
133  : Superclass(interactionEvent)
134  , m_SliceDelta(sliceDelta)
135  , m_AutoRepeat(autoRepeat)
136  {
137  }
138  ~DisplayScrollEvent() override {}
139  const char* GetEventName() const override { return "DisplayScrollEvent"; }
140  bool CheckEvent(const itk::EventObject *e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
141  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_SliceDelta, m_AutoRepeat); }
142  int GetSliceDelta() const { return m_SliceDelta; }
143  bool GetAutoRepeat() const { return m_AutoRepeat; }
144  DisplayScrollEvent(const Self& s) : Superclass(s), m_SliceDelta(s.GetSliceDelta()), m_AutoRepeat(s.GetAutoRepeat()) {};
145 
146  private:
147  int m_SliceDelta;
148  bool m_AutoRepeat;
149  };
150 
152  {
153  public:
156 
157  DisplaySetLevelWindowEvent() : Superclass() {}
159  : Superclass(interactionEvent)
160  , m_Level(level)
161  , m_Window(window)
162  {
163  }
165  const char* GetEventName() const override { return "DisplaySetLevelWindowEvent"; }
166  bool CheckEvent(const itk::EventObject *e) const override { return dynamic_cast<const Self *>(e) != nullptr; }
167  itk::EventObject* MakeObject() const override { return new Self(GetInteractionEvent(), m_Level, m_Window); }
168  ScalarType GetLevel() const { return m_Level; }
169  ScalarType GetWindow() const { return m_Window; }
170  DisplaySetLevelWindowEvent(const Self& s) : Superclass(s), m_Level(s.GetLevel()), m_Window(s.GetWindow()) {};
171 
172  private:
173  ScalarType m_Level;
174  ScalarType m_Window;
175  };
176 
177 } // end namespace
178 
179 #endif // MITKDISPLAYACTIONEVENTS_H
#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
DisplayScrollEvent(InteractionEvent *interactionEvent, int sliceDelta, bool autoRepeat)
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)