Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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
25 #include "vtkMRMLAbstractLogic.h"
26 #include "vtkMRMLLogicExport.h"
27 
28 // MRML includes
30 class vtkMRMLLayoutNode;
31 
32 // VTK includes
33 class vtkCollection;
34 class vtkXMLDataElement;
35 
36 // STD includes
37 #include <cstdlib>
38 #include <vector>
39 
72 class VTK_MRML_LOGIC_EXPORT vtkMRMLLayoutLogic : public vtkMRMLAbstractLogic
73 {
74 public:
76  static vtkMRMLLayoutLogic *New();
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);
93  vtkMRMLNode* GetViewFromAttributes(const ViewAttributes& attributes);
94 
96  vtkCollection* GetViewsFromAttributes(const ViewAttributes& attributes);
97 
98  vtkMRMLNode* CreateViewFromAttributes(const ViewAttributes& attributes);
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 
115  void MaximizeView(vtkMRMLAbstractViewNode* viewToMaximize);
116 
120  void CreateMaximizedViewLayoutDescription(int layout,
121  vtkMRMLAbstractViewNode* viewToMaximize);
122 
124  std::string GetMaximizedViewLayoutDescription(vtkMRMLAbstractViewNode* viewToMaximize);
125 
126 protected:
130  ~vtkMRMLLayoutLogic() override;
131  // disable copy constructor and operator
133  void operator=(const vtkMRMLLayoutLogic&);
134 
136  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
137 
138  void OnMRMLNodeModified(vtkMRMLNode* node) override;
139  void OnMRMLSceneStartRestore() override;
140  void OnMRMLSceneEndRestore() override;
141 
142  void UnobserveMRMLScene() override;
143  void UpdateFromMRMLScene() override;
144 
147  void UpdateViewNodes();
148 
151  void UpdateLayoutNode();
152 
154  void SetLayoutNode(vtkMRMLLayoutNode* layoutNode);
155 
157  void UpdateFromLayoutNode();
159  void UpdateViewCollectionsFromLayout();
160  void CreateMissingViews();
161  void CreateMissingViews(vtkXMLDataElement* layoutRootElement);
162 
165  vtkCollection* GetViewsFromLayout(vtkXMLDataElement* root);
166 
169  void UpdateCompareViewLayoutDefinitions();
170 
172  vtkXMLDataElement* GetNextViewElement(vtkXMLDataElement* viewElement);
173  vtkXMLDataElement* GetNextElement(vtkXMLDataElement* element);
174  ViewAttributes GetViewElementAttributes(vtkXMLDataElement* viewElement)const;
175  ViewProperties GetViewElementProperties(vtkXMLDataElement* viewElement)const;
176  ViewProperty GetViewElementProperty(vtkXMLDataElement* viewProperty)const;
177 
182  vtkCollection* ViewNodes;
183  vtkXMLDataElement* ConventionalLayoutRootElement;
184 };
185 
186 #endif
187 
Superclass for MRML logic classes.
std::vector< ViewProperty > ViewProperties
void PrintSelf(ostream &os, vtkIndent indent) override
MRML logic class for layout manipulation.
Node that describes the view layout of the application.
virtual void OnMRMLNodeModified(vtkMRMLNode *)
vtkMRMLLayoutNode * LayoutNode
Pointer on the unique Layout node of the mrml node.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
vtkCollection * ViewNodes
Up-to-date list of the nodes that are mapped into the scene.
virtual void UnobserveMRMLScene()
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
virtual void OnMRMLSceneEndRestore()
virtual void OnMRMLSceneStartRestore()
virtual void UpdateFromMRMLScene()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
std::map< std::string, std::string > ViewAttributes
ViewAttributes ViewProperty
static vtkMRMLAbstractLogic * New()
vtkXMLDataElement * ConventionalLayoutRootElement