Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLLayoutLogic.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
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 This file was originally developed by Julien Finet, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __vtkMRMLLayoutLogic_h
22#define __vtkMRMLLayoutLogic_h
23
24// MRMLLogic includes
26#include "vtkMRMLLogicExport.h"
27
28// MRML includes
31
32// VTK includes
33class vtkCollection;
34class vtkXMLDataElement;
35
36// STD includes
37#include <cstdlib>
38#include <vector>
39
72class VTK_MRML_LOGIC_EXPORT vtkMRMLLayoutLogic : public vtkMRMLAbstractLogic
73{
74public:
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
80 typedef std::map<std::string, std::string> ViewAttributes;
82 typedef std::vector<ViewProperty> ViewProperties;
83
86 virtual void AddDefaultLayouts();
87
91 vtkMRMLNode* GetViewFromElement(vtkXMLDataElement* element);
94
96 vtkCollection* GetViewsFromAttributes(const ViewAttributes& attributes);
97
99
100 void ApplyProperties(const ViewProperties& properties, vtkMRMLNode* view, const std::string& action);
101 void ApplyProperty(const ViewProperty& property, vtkMRMLNode* view);
102
105 vtkGetObjectMacro(ViewNodes, vtkCollection);
106
109 vtkGetObjectMacro(LayoutNode, vtkMRMLLayoutNode);
110
116
121
123 std::string GetMaximizedViewLayoutDescription(vtkMRMLAbstractViewNode* viewToMaximize, const char* currentLayoutDescription);
124
125protected:
130 // disable copy constructor and operator
133
135 void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
136
137 void OnMRMLNodeModified(vtkMRMLNode* node) override;
138 void OnMRMLSceneStartRestore() override;
139 void OnMRMLSceneEndRestore() override;
140
141 void UnobserveMRMLScene() override;
142 void UpdateFromMRMLScene() override;
143
147
151
154
160 void CreateMissingViews(vtkXMLDataElement* layoutRootElement);
161
164 vtkCollection* GetViewsFromLayout(vtkXMLDataElement* root);
165
169
171 vtkXMLDataElement* GetNextViewElement(vtkXMLDataElement* viewElement);
172 vtkXMLDataElement* GetNextElement(vtkXMLDataElement* element);
173 ViewAttributes GetViewElementAttributes(vtkXMLDataElement* viewElement) const;
174 ViewProperties GetViewElementProperties(vtkXMLDataElement* viewElement) const;
175 ViewProperty GetViewElementProperty(vtkXMLDataElement* viewProperty) const;
176
177 vtkXMLDataElement* GetViewportElementForView(vtkXMLDataElement* layoutRootElement, vtkMRMLAbstractViewNode* viewNode);
178
183 vtkCollection* ViewNodes;
185};
186
187#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
void PrintSelf(ostream &os, vtkIndent indent) override
std::map< std::string, std::string > ViewAttributes
void CreateMaximizedViewLayoutDescription(int layout, vtkMRMLAbstractViewNode *viewToMaximize)
void operator=(const vtkMRMLLayoutLogic &)
void SetMRMLSceneInternal(vtkMRMLScene *newScene) override
Reimplemented to listen to specific scene events.
void UpdateViewCollectionsFromLayout()
Make sure the view node list mapped in the current layout is up-to-date.
vtkXMLDataElement * GetNextElement(vtkXMLDataElement *element)
ViewProperties GetViewElementProperties(vtkXMLDataElement *viewElement) const
void UpdateCompareViewLayoutDefinitions()
vtkXMLDataElement * ConventionalLayoutRootElement
void UpdateFromMRMLScene() override
ViewAttributes GetViewElementAttributes(vtkXMLDataElement *viewElement) const
vtkMRMLNode * CreateViewFromAttributes(const ViewAttributes &attributes)
void ApplyProperty(const ViewProperty &property, vtkMRMLNode *view)
vtkXMLDataElement * GetViewportElementForView(vtkXMLDataElement *layoutRootElement, vtkMRMLAbstractViewNode *viewNode)
vtkCollection * GetViewsFromLayout(vtkXMLDataElement *root)
vtkMRMLLayoutLogic()
Logic constructor.
vtkCollection * GetViewsFromAttributes(const ViewAttributes &attributes)
This returns the best view node that matches the attributes.
std::string GetMaximizedViewLayoutDescription(vtkMRMLAbstractViewNode *viewToMaximize, const char *currentLayoutDescription)
Returns layout description that shows the specified view maximized.
void ApplyProperties(const ViewProperties &properties, vtkMRMLNode *view, const std::string &action)
vtkCollection * ViewNodes
Up-to-date list of the nodes that are mapped into the scene.
~vtkMRMLLayoutLogic() override
Logic destructor.
ViewProperty GetViewElementProperty(vtkXMLDataElement *viewProperty) const
vtkMRMLNode * GetViewFromAttributes(const ViewAttributes &attributes)
This returns the best view node that matches the attributes.
void SetLayoutNode(vtkMRMLLayoutNode *layoutNode)
Not public as we internally take care of choosing/updating the layout node.
void OnMRMLSceneEndRestore() override
void CreateMissingViews(vtkXMLDataElement *layoutRootElement)
void UpdateFromLayoutNode()
Update the logic when the layout node is set or modified.
vtkMRMLNode * GetViewFromElement(vtkXMLDataElement *element)
std::vector< ViewProperty > ViewProperties
vtkMRMLLayoutNode * LayoutNode
Pointer on the unique Layout node of the mrml node.
vtkMRMLLayoutLogic(const vtkMRMLLayoutLogic &)
void UnobserveMRMLScene() override
void OnMRMLNodeModified(vtkMRMLNode *node) override
void MaximizeView(vtkMRMLAbstractViewNode *viewToMaximize)
ViewAttributes ViewProperty
virtual void AddDefaultLayouts()
static vtkMRMLLayoutLogic * New()
The Usual vtk class functions.
void OnMRMLSceneStartRestore() override
vtkXMLDataElement * GetNextViewElement(vtkXMLDataElement *viewElement)
Utility functions to browse XML data elements.
Node that describes the view layout of the application.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.