CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ctkVTKAbstractView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVTKAbstractView_h
22 #define __ctkVTKAbstractView_h
23 
24 // Qt includes
25 #include <QWidget>
26 
27 // VTK includes
28 #include <QVTKWidget.h>
29 
30 // CTK includes
31 #include "ctkVTKObject.h"
32 #include "ctkVisualizationVTKWidgetsExport.h"
33 class ctkVTKAbstractViewPrivate;
34 
35 class vtkCornerAnnotation;
36 class vtkInteractorObserver;
37 class vtkRenderWindowInteractor;
38 class vtkRenderWindow;
39 
41 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKAbstractView : public QWidget
42 {
43  Q_OBJECT
45  Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
46  Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
47  Q_PROPERTY(QColor backgroundColor2 READ backgroundColor2 WRITE setBackgroundColor)
48  Q_PROPERTY(bool gradientBackground READ gradientBackground WRITE setGradientBackground)
49  Q_PROPERTY(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
53  Q_PROPERTY(bool fpsVisible READ isFPSVisible WRITE setFPSVisible)
57  Q_PROPERTY(bool useDepthPeeling READ useDepthPeeling WRITE setUseDepthPeeling)
58 public:
59 
60  typedef QWidget Superclass;
61  explicit ctkVTKAbstractView(QWidget* parent = 0);
62  virtual ~ctkVTKAbstractView();
63 
64 public Q_SLOTS:
69  virtual void scheduleRender();
70 
74  virtual void forceRender();
75 
77  virtual void setBackgroundColor(const QColor& newBackgroundColor);
78 
81  virtual void setBackgroundColor2(const QColor& newBackgroundColor);
82 
85  virtual void setGradientBackground(bool enable);
86 
88  void setRenderEnabled(bool value);
89 
91  virtual void setCornerAnnotationText(const QString& text);
92 
94  void setFPSVisible(bool show);
95 
98  void setUseDepthPeeling(bool use);
99 
100 public:
102  Q_INVOKABLE vtkRenderWindow* renderWindow()const;
103 
105  Q_INVOKABLE vtkRenderWindowInteractor* interactor()const;
110  virtual void setInteractor(vtkRenderWindowInteractor* interactor);
111 
113  Q_INVOKABLE vtkInteractorObserver* interactorStyle()const;
114 
116  QString cornerAnnotationText() const;
117  Q_INVOKABLE vtkCornerAnnotation* cornerAnnotation()const;
118 
120  Q_INVOKABLE QVTKWidget * VTKWidget() const;
121 
123  virtual QColor backgroundColor() const;
124 
126  virtual QColor backgroundColor2() const;
127 
129  virtual bool gradientBackground() const;
130 
132  bool renderEnabled() const;
133 
135  bool isFPSVisible() const;
136 
138  double fps()const;
139 
142  bool useDepthPeeling()const;
143 
153  static void setMultiSamples(int);
154 
157  static int multiSamples();
158 
159  virtual QSize minimumSizeHint()const;
160  virtual QSize sizeHint()const;
161  virtual bool hasHeightForWidth()const;
162  virtual int heightForWidth(int width)const;
163 
164 protected Q_SLOTS:
165  void onRender();
166  void updateFPS();
167 
168 protected:
169  QScopedPointer<ctkVTKAbstractViewPrivate> d_ptr;
170  ctkVTKAbstractView(ctkVTKAbstractViewPrivate* pimpl, QWidget* parent);
171 
172 private:
173  Q_DECLARE_PRIVATE(ctkVTKAbstractView);
174  Q_DISABLE_COPY(ctkVTKAbstractView);
175 };
176 
177 #endif
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222