CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
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// CTK includes
29#include "ctkVTKObject.h"
30#include "ctkVisualizationVTKWidgetsExport.h"
31class ctkVTKAbstractViewPrivate;
32
33class vtkCornerAnnotation;
34class vtkInteractorObserver;
35class vtkRenderWindowInteractor;
36class vtkRenderWindow;
37
39class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKAbstractView : public QWidget
40{
41 Q_OBJECT
43 Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
44 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
45 Q_PROPERTY(QColor backgroundColor2 READ backgroundColor2 WRITE setBackgroundColor)
46 Q_PROPERTY(bool gradientBackground READ gradientBackground WRITE setGradientBackground)
47 Q_PROPERTY(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
51 Q_PROPERTY(bool fpsVisible READ isFPSVisible WRITE setFPSVisible)
55 Q_PROPERTY(bool useDepthPeeling READ useDepthPeeling WRITE setUseDepthPeeling)
57 Q_PROPERTY(double maximumUpdateRate READ maximumUpdateRate WRITE setMaximumUpdateRate)
58
59public:
60
61 typedef QWidget Superclass;
62 explicit ctkVTKAbstractView(QWidget* parent = 0);
64
65public Q_SLOTS:
71 virtual void scheduleRender();
72
77 virtual void forceRender();
78
96 virtual int setRenderPaused(bool pause);
97
100 virtual int pauseRender();
101
104 virtual int resumeRender();
105
108 virtual bool isRenderPaused()const;
109
131 void setMaximumUpdateRate(double fps);
132
134 virtual void setBackgroundColor(const QColor& newBackgroundColor);
135
138 virtual void setBackgroundColor2(const QColor& newBackgroundColor);
139
142 virtual void setGradientBackground(bool enable);
143
145 void setRenderEnabled(bool value);
146
148 virtual void setCornerAnnotationText(const QString& text);
149
151 void setFPSVisible(bool show);
152
155 void setUseDepthPeeling(bool use);
156
157public:
159 Q_INVOKABLE vtkRenderWindow* renderWindow()const;
160
162 Q_INVOKABLE vtkRenderWindowInteractor* interactor()const;
167 virtual void setInteractor(vtkRenderWindowInteractor* interactor);
168
170 Q_INVOKABLE vtkInteractorObserver* interactorStyle()const;
171
173 QString cornerAnnotationText() const;
174 Q_INVOKABLE vtkCornerAnnotation* cornerAnnotation()const;
175
177 Q_INVOKABLE ctkVTKOpenGLNativeWidget * VTKWidget() const;
178
180 virtual QColor backgroundColor() const;
181
183 virtual QColor backgroundColor2() const;
184
186 virtual bool gradientBackground() const;
187
189 bool renderEnabled() const;
190
192 bool isFPSVisible() const;
193
195 double fps()const;
196
199 double maximumUpdateRate()const;
200
203 bool useDepthPeeling()const;
204
214 static void setMultiSamples(int);
215
218 static int multiSamples();
219
220 virtual QSize minimumSizeHint()const;
221 virtual QSize sizeHint()const;
222 virtual bool hasHeightForWidth()const;
223 virtual int heightForWidth(int width)const;
224
225protected Q_SLOTS:
226 void onRender();
227 void updateFPS();
228
231 virtual void requestRender();
232
233protected:
234 QScopedPointer<ctkVTKAbstractViewPrivate> d_ptr;
235 ctkVTKAbstractView(ctkVTKAbstractViewPrivate* pimpl, QWidget* parent);
236
237private:
238 Q_DECLARE_PRIVATE(ctkVTKAbstractView);
239 Q_DISABLE_COPY(ctkVTKAbstractView);
240};
241
242#endif
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...