Slicer  4.11
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 
123 protected:
127  ~vtkMRMLLayoutLogic() override;
128  // disable copy constructor and operator
130  void operator=(const vtkMRMLLayoutLogic&);
131 
133  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
134 
135  void OnMRMLNodeModified(vtkMRMLNode* node) override;
136  void OnMRMLSceneStartRestore() override;
137  void OnMRMLSceneEndRestore() override;
138 
139  void UnobserveMRMLScene() override;
140  void UpdateFromMRMLScene() override;
141 
144  void UpdateViewNodes();
145 
148  void UpdateLayoutNode();
149 
151  void SetLayoutNode(vtkMRMLLayoutNode* layoutNode);
152 
154  void UpdateFromLayoutNode();
156  void UpdateViewCollectionsFromLayout();
157  void CreateMissingViews();
158  void CreateMissingViews(vtkXMLDataElement* layoutRootElement);
159 
162  vtkCollection* GetViewsFromLayout(vtkXMLDataElement* root);
163 
166  void UpdateCompareViewLayoutDefinitions();
167 
169  vtkXMLDataElement* GetNextViewElement(vtkXMLDataElement* viewElement);
170  vtkXMLDataElement* GetNextElement(vtkXMLDataElement* element);
171  ViewAttributes GetViewElementAttributes(vtkXMLDataElement* viewElement)const;
172  ViewProperties GetViewElementProperties(vtkXMLDataElement* viewElement)const;
173  ViewProperty GetViewElementProperty(vtkXMLDataElement* viewProperty)const;
174 
179  vtkCollection* ViewNodes;
180  vtkXMLDataElement* ConventionalLayoutRootElement;
181 };
182 
183 #endif
184 
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:61
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