Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLLayoutViewFactory.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 __qMRMLLayoutViewFactory_h
22 #define __qMRMLLayoutViewFactory_h
23 
24 // Qt includes
25 #include <QStringList>
26 
27 // CTK includes
28 #include <ctkLayoutViewFactory.h>
29 #include <ctkVTKObject.h>
30 
31 // MRML includes
32 #include "qMRMLWidgetsExport.h"
33 class qMRMLLayoutManager;
34 class qMRMLLayoutViewFactoryPrivate;
36 class vtkMRMLNode;
37 class vtkMRMLScene;
38 
39 // VTK includes
40 class vtkCollection;
41 class vtkObject;
42 class vtkRenderer;
43 
44 class QMRML_WIDGETS_EXPORT qMRMLLayoutViewFactory : public ctkLayoutViewFactory
45 {
46  Q_OBJECT
47  QVTK_OBJECT
52  Q_PROPERTY(QString viewClassName READ viewClassName);
53 public:
55  typedef ctkLayoutViewFactory Superclass;
56 
58  explicit qMRMLLayoutViewFactory(QObject* parent=0);
59  virtual ~qMRMLLayoutViewFactory();
60 
65  virtual QString viewClassName()const;
66 
69  virtual bool isElementSupported(QDomElement layoutElement)const;
70 
73  virtual bool isViewNodeSupported(vtkMRMLAbstractViewNode* viewNode)const;
74 
78  Q_INVOKABLE qMRMLLayoutManager* layoutManager()const;
79 
82  Q_INVOKABLE void setLayoutManager(qMRMLLayoutManager*);
83 
86  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
87 
88  QWidget* viewWidget(int id)const;
89  QWidget* viewWidget(vtkMRMLAbstractViewNode* node)const;
90  QWidget* viewWidget(const QString& name)const;
91  int viewCount()const;
92 
93  virtual void beginSetupLayout();
94 
95  vtkMRMLAbstractViewNode* viewNode(QWidget* widget)const;
96 
98  QStringList viewNodeNames() const;
99 
100  void setActiveViewNode(vtkMRMLAbstractViewNode* viewNode);
101  vtkMRMLAbstractViewNode* activeViewNode()const;
102  virtual vtkRenderer* activeRenderer()const;
103 
104 public Q_SLOTS:
109  virtual void setMRMLScene(vtkMRMLScene* scene);
110 
111  virtual void onNodeAdded(vtkObject* scene, vtkObject* node);
112  virtual void onNodeRemoved(vtkObject* scene, vtkObject* node);
113  virtual void onNodeModified(vtkObject* node);
114  virtual void onViewNodeAdded(vtkMRMLAbstractViewNode* node);
115  virtual void onViewNodeRemoved(vtkMRMLAbstractViewNode* node);
116  virtual void onViewNodeModified(vtkMRMLAbstractViewNode* node);
117 
120  virtual void onSceneModified();
121 
122 Q_SIGNALS:
124  void viewCreated(QWidget* createdView);
125 
128  void activeViewNodeChanged(vtkMRMLAbstractViewNode*);
129 
130 
131 protected:
132  QScopedPointer<qMRMLLayoutViewFactoryPrivate> d_ptr;
133 
134  virtual void setupView(QDomElement viewElement, QWidget* view);
137  virtual QWidget* createViewFromXML(QDomElement layoutElement);
139  virtual QList<QWidget*> createViewsFromXML(QDomElement layoutElement);
140 
141  virtual vtkMRMLAbstractViewNode* viewNodeFromXML(QDomElement viewElement)const;
142  virtual QList<vtkMRMLAbstractViewNode*> viewNodesFromXML(QDomElement viewElement)const;
143 
147  virtual QWidget* createViewFromNode(vtkMRMLAbstractViewNode* node);
148  virtual void deleteView(vtkMRMLAbstractViewNode* node);
149 
150 private:
151  Q_DECLARE_PRIVATE(qMRMLLayoutViewFactory);
152  Q_DISABLE_COPY(qMRMLLayoutViewFactory);
153 };
154 
155 #endif
ctkLayoutViewFactory Superclass
Superclass typedef.
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
QScopedPointer< qMRMLLayoutViewFactoryPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135