Slicer  4.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLMarkupsDisplayableManager.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
17 
18 #ifndef __vtkMRMLMarkupsDisplayableManager_h
19 #define __vtkMRMLMarkupsDisplayableManager_h
20 
21 // MarkupsModule includes
22 #include "vtkSlicerMarkupsModuleMRMLDisplayableManagerExport.h"
23 
24 // MarkupsModule/MRMLDisplayableManager includes
26 
27 // MRMLDisplayableManager includes
29 
30 // VTK includes
31 #include <vtkSlicerMarkupsWidget.h>
32 
33 #include <set>
34 
35 class vtkMRMLMarkupsNode;
36 class vtkSlicerViewerWidget;
38 class vtkAbstractWidget;
39 
41 class VTK_SLICER_MARKUPS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLMarkupsDisplayableManager :
43 {
44 public:
45 
46  // Allow the helper to call protected methods of displayable manager
48 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
56  virtual bool Is2DDisplayableManager();
58  vtkMRMLSliceNode * GetMRMLSliceNode();
59 
60  vtkMRMLMarkupsDisplayableManagerHelper * GetHelper() { return this->Helper; };
61 
62  bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double &closestDistance2) override;
63  bool ProcessInteractionEvent(vtkMRMLInteractionEventData* eventData) override;
64 
65  void SetHasFocus(bool hasFocus) override;
66  bool GetGrabFocus() override;
67  bool GetInteractive() override;
68  int GetMouseCursor() override;
69 
70  // Updates markup point preview position.
71  // Returns true if the event is processed.
72  vtkSlicerMarkupsWidget* GetWidgetForPlacement();
73 
74  vtkMRMLMarkupsNode* GetActiveMarkupsNodeForPlacement();
75 
76  int GetCurrentInteractionMode();
77 
78  // Methods from vtkMRMLAbstractSliceViewDisplayableManager
79 
83  void ConvertDeviceToXYZ(double x, double y, double xyz[3]);
84 
87 
88 protected:
89 
92 
93  vtkSlicerMarkupsWidget* FindClosestWidget(vtkMRMLInteractionEventData *callData, double &closestDistance2);
94 
95  void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override;
96 
98  virtual void RequestRender();
99 
102  void UpdateFromMRML() override;
103 
104  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
105 
108  void UpdateFromMRMLScene() override;
109  void OnMRMLSceneEndClose() override;
110  void OnMRMLSceneEndImport() override;
111  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
112  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) override;
113 
116 
118  void OnMRMLDisplayableNodeModifiedEvent(vtkObject* caller) override;
119 
121  virtual void OnMRMLSliceNodeModifiedEvent();
122 
124  void AddObserversToInteractionNode();
125  void RemoveObserversFromInteractionNode();
126 
128  virtual bool IsCorrectDisplayableManager();
129 
134  virtual bool IsManageable(vtkMRMLNode* node);
139  virtual bool IsManageable(const char* nodeClassName);
140 
142  std::set<std::string> Focus;
143 
145  void OnInteractorStyleEvent(int eventid) override;
146 
148  vtkGetMacro(DisableInteractorStyleEventsProcessing, int);
149 
151 
152  double LastClickWorldCoordinates[4];
153 
154  vtkMRMLMarkupsNode* CreateNewMarkupsNode(const std::string &markupsNodeClassName);
155 
156  vtkWeakPointer<vtkSlicerMarkupsWidget> LastActiveWidget;
157 
158 private:
160  void operator=(const vtkMRMLMarkupsDisplayableManager&) = delete;
161 
162  int DisableInteractorStyleEventsProcessing;
163 
164  vtkMRMLSliceNode * SliceNode;
165 };
166 
167 #endif
virtual bool GetInteractive()
Displayable manager can indicate that the window is in interactive mode (faster updates).
Superclass for displayable manager classes.
virtual void SetHasFocus(bool hasFocus)
Set if the widget gets/loses focus (interaction events are processed by this displayable manager)...
virtual void OnMRMLSceneEndImport()
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void OnMRMLSceneEndClose()
vtkMRMLMarkupsDisplayableManagerHelper * Helper
static vtkMRMLAbstractDisplayableManager * New()
MRML node for storing a slice through RAS space.
virtual void OnMRMLDisplayableNodeModifiedEvent(vtkObject *caller)
vtkWeakPointer< vtkSlicerMarkupsWidget > LastActiveWidget
vtkMRMLMarkupsDisplayableManagerHelper * GetHelper()
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
virtual bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData)
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override
void SetMRMLSceneInternal(vtkMRMLScene *newScene) override
Process interaction events to update state of markup widget nodes.
virtual bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2)
std::set< std::string > Focus
Contains class names of markups nodes that this displayable manager can handle.
virtual int GetMouseCursor()
Displayable manager returns ID of the mouse cursor shape that should be displayed.
virtual bool GetGrabFocus()
Displayable manager can indicate that it would like to get all events (even when mouse pointer is out...
virtual void UpdateFromMRMLScene()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
vtkSlicerMarkupsWidget * GetWidget(vtkMRMLMarkupsDisplayNode *markupsDisplayNode)
Set all widget status to manipulate.
virtual void OnInteractorStyleEvent(int eventid)