Slicer  4.8
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  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
79 
80  typedef std::map<std::string, std::string> ViewAttributes;
81  typedef ViewAttributes ViewProperty;
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  virtual ~vtkMRMLLayoutLogic();
128  // disable copy constructor and operator
130  void operator=(const vtkMRMLLayoutLogic&);
131 
133  virtual void SetMRMLSceneInternal(vtkMRMLScene* newScene) VTK_OVERRIDE;
134 
135  virtual void OnMRMLNodeModified(vtkMRMLNode* node) VTK_OVERRIDE;
136  virtual void OnMRMLSceneStartRestore() VTK_OVERRIDE;
137  virtual void OnMRMLSceneEndRestore() VTK_OVERRIDE;
138 
139  virtual void UnobserveMRMLScene() VTK_OVERRIDE;
140  virtual void UpdateFromMRMLScene() VTK_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 
176  vtkMRMLLayoutNode* LayoutNode;
177  int LastValidViewArrangement;
179  vtkCollection* ViewNodes;
180  vtkXMLDataElement* ConventionalLayoutRootElement;
181 };
182 
183 #endif
184 
Superclass for MRML logic classes.
std::vector< ViewProperty > ViewProperties
MRML logic class for layout manipulation.
Node that describes the view layout of the application.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void OnMRMLNodeModified(vtkMRMLNode *)
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:54
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
virtual void OnMRMLSceneStartRestore()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
std::map< std::string, std::string > ViewAttributes
ViewAttributes ViewProperty
static vtkMRMLAbstractLogic * New()