Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
32
33// STD includes
34#include <map>
35
37class vtkSlicerViewerWidget;
39class vtkAbstractWidget;
40
41class VTK_SLICER_MARKUPS_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLMarkupsDisplayableManager :
43{
44public:
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();
59
61
62 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double &closestDistance2) override;
64
65 void SetHasFocus(bool hasFocus, vtkMRMLInteractionEventData* eventData) 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.
73
75
77
78 // Methods from vtkMRMLAbstractSliceViewDisplayableManager
79
83 void ConvertDeviceToXYZ(double x, double y, double xyz[3]);
84
87
90
91protected:
92
95
97
98 void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override;
99
101 virtual void RequestRender();
102
105 void UpdateFromMRML() override;
106
107 void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
108
111 void UpdateFromMRMLScene() override;
112 void OnMRMLSceneEndClose() override;
113 void OnMRMLSceneEndImport() override;
114 void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
116
118 void Create() override;
119
122
125
127 void OnMRMLDisplayableNodeModifiedEvent(vtkObject* caller) override;
128
131
135
138
143 virtual bool IsManageable(vtkMRMLNode* node);
148 virtual bool IsManageable(const char* nodeClassName);
149
151 vtkGetMacro(DisableInteractorStyleEventsProcessing, int);
152
153 vtkSmartPointer<vtkMRMLMarkupsDisplayableManagerHelper> Helper;
154
156
157 vtkWeakPointer<vtkMRMLAbstractWidget> LastActiveWidget;
158
159 vtkSmartPointer<vtkRenderer> InteractionRenderer;
160
161private:
163 void operator=(const vtkMRMLMarkupsDisplayableManager&) = delete;
164
165 int DisableInteractorStyleEventsProcessing;
166
167 // by default, this displayableManager handles a 2d view, so the SliceNode
168 // must be set when it's assigned to a viewer
169 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
170};
171
172#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
Process interaction events to update state of MRML widget nodes.
vtkMRMLAbstractWidget * FindClosestWidget(vtkMRMLInteractionEventData *callData, double &closestDistance2)
virtual bool IsManageable(const char *nodeClassName)
void SetMRMLSceneInternal(vtkMRMLScene *newScene) override
bool GetInteractive() override
Displayable manager can indicate that the window is in interactive mode (faster updates).
void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override
void Create() override
Initialize the displayable manager.
vtkSmartPointer< vtkRenderer > InteractionRenderer
vtkSlicerMarkupsWidget * GetWidget(vtkMRMLMarkupsDisplayNode *node)
Get the widget of a node.
void ConvertDeviceToXYZ(double x, double y, double xyz[3])
void OnMRMLSceneNodeRemoved(vtkMRMLNode *node) override
vtkMRMLSliceNode * GetMRMLSliceNode()
Get the sliceNode, if registered. This would mean it is a 2D SliceView displayableManager.
int GetMouseCursor() override
Displayable manager returns ID of the mouse cursor shape that should be displayed.
vtkSlicerMarkupsInteractionWidget * GetInteractionWidget(vtkMRMLMarkupsDisplayNode *node)
Get the interaction widget of a node.
static vtkMRMLMarkupsDisplayableManager * New()
vtkMRMLMarkupsNode * GetActiveMarkupsNodeForPlacement()
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSlicerMarkupsInteractionWidget * CreateInteractionWidget(vtkMRMLMarkupsDisplayNode *node)
Create an interaction widget.
void SetHasFocus(bool hasFocus, vtkMRMLInteractionEventData *eventData) override
Set if the widget gets/loses focus (interaction events are processed by this displayable manager).
virtual bool IsManageable(vtkMRMLNode *node)
vtkSlicerMarkupsWidget * GetWidgetForPlacement()
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &closestDistance2) override
vtkSlicerMarkupsWidget * CreateWidget(vtkMRMLMarkupsDisplayNode *node)
Create a widget.
void AddObserversToInteractionNode()
Observe the interaction node.
void OnMRMLDisplayableNodeModifiedEvent(vtkObject *caller) override
Called after the corresponding MRML View container was modified.
virtual void RequestRender()
Wrap the superclass render request in a check for batch processing.
vtkMRMLMarkupsDisplayableManagerHelper * GetHelper()
vtkSmartPointer< vtkMRMLMarkupsDisplayableManagerHelper > Helper
void OnMRMLSceneNodeAdded(vtkMRMLNode *node) override
virtual void OnMRMLViewNodeModifiedEvent(vtkMRMLAbstractViewNode *viewNode)
Update all widgets in response to view node modification.
virtual bool IsCorrectDisplayableManager()
Check if it is the right displayManager.
bool GetGrabFocus() override
Displayable manager can indicate that it would like to get all events (even when mouse pointer is out...
vtkWeakPointer< vtkMRMLAbstractWidget > LastActiveWidget
void OnMRMLSceneEndImport() override
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) override
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for storing a slice through RAS space.
Process interaction events to update state of interaction widgets.
Process interaction events to update state of markup widget nodes.