CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
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"
31 class ctkVTKAbstractViewPrivate;
32 
33 class vtkCornerAnnotation;
34 class vtkInteractorObserver;
35 class vtkRenderWindowInteractor;
36 class vtkRenderWindow;
37 
39 class 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 
59 public:
60 
61  typedef QWidget Superclass;
62  explicit ctkVTKAbstractView(QWidget* parent = 0);
64 
65 public 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 
157 public:
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 
225 protected Q_SLOTS:
226  void onRender();
227  void updateFPS();
228 
231  virtual void requestRender();
232 
233 protected:
234  QScopedPointer<ctkVTKAbstractViewPrivate> d_ptr;
235  ctkVTKAbstractView(ctkVTKAbstractViewPrivate* pimpl, QWidget* parent);
236 
237 private:
238  Q_DECLARE_PRIVATE(ctkVTKAbstractView);
239  Q_DISABLE_COPY(ctkVTKAbstractView);
240 };
241 
242 #endif
ctkVTKAbstractView::setMultiSamples
static void setMultiSamples(int)
ctkVTKObject.h
ctkVTKAbstractView::interactor
Q_INVOKABLE vtkRenderWindowInteractor * interactor() const
Set/Get window interactor.
ctkVTKAbstractView::forceRender
virtual void forceRender()
ctkVTKAbstractView::isFPSVisible
bool isFPSVisible() const
Return true if the FPS annotation is visible, false otherwise.
ctkVTKOpenGLNativeWidget
Definition: ctkVTKOpenGLNativeWidget.h:63
ctkVTKAbstractView::requestRender
virtual void requestRender()
ctkVTKAbstractView::setBackgroundColor
virtual void setBackgroundColor(const QColor &newBackgroundColor)
Set the background color of the rendering screen.
ctkVTKAbstractView::ctkVTKAbstractView
ctkVTKAbstractView(QWidget *parent=0)
ctkVTKAbstractView::setRenderPaused
virtual int setRenderPaused(bool pause)
ctkVTKOpenGLNativeWidget.h
ctkVTKAbstractView::heightForWidth
virtual int heightForWidth(int width) const
ctkVTKAbstractView::onRender
void onRender()
ctkVTKAbstractView::scheduleRender
virtual void scheduleRender()
ctkVTKAbstractView::setInteractor
virtual void setInteractor(vtkRenderWindowInteractor *interactor)
QVTK_OBJECT
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222
ctkVTKAbstractView::setMaximumUpdateRate
void setMaximumUpdateRate(double fps)
ctkVTKAbstractView::useDepthPeeling
bool useDepthPeeling() const
ctkVTKAbstractView::ctkVTKAbstractView
ctkVTKAbstractView(ctkVTKAbstractViewPrivate *pimpl, QWidget *parent)
ctkVTKAbstractView::hasHeightForWidth
virtual bool hasHeightForWidth() const
ctkVTKAbstractView::~ctkVTKAbstractView
virtual ~ctkVTKAbstractView()
ctkVTKAbstractView::cornerAnnotationText
QString cornerAnnotationText() const
Get corner annotation text.
ctkVTKAbstractView::pauseRender
virtual int pauseRender()
ctkVTKAbstractView::gradientBackground
virtual bool gradientBackground() const
Is the background a gradient.
ctkVTKAbstractView::Superclass
QWidget Superclass
Definition: ctkVTKAbstractView.h:61
ctkVTKAbstractView::interactorStyle
Q_INVOKABLE vtkInteractorObserver * interactorStyle() const
Get current interactor style.
ctkVTKAbstractView::backgroundColor2
virtual QColor backgroundColor2() const
Get the second background color.
ctkVTKAbstractView
Definition: ctkVTKAbstractView.h:40
ctkVTKAbstractView::d_ptr
QScopedPointer< ctkVTKAbstractViewPrivate > d_ptr
Definition: ctkVTKAbstractView.h:234
ctkVTKAbstractView::backgroundColor
virtual QColor backgroundColor() const
Get background color.
ctkVTKAbstractView::setUseDepthPeeling
void setUseDepthPeeling(bool use)
ctkVTKAbstractView::resumeRender
virtual int resumeRender()
ctkVTKAbstractView::multiSamples
static int multiSamples()
ctkVTKAbstractView::sizeHint
virtual QSize sizeHint() const
ctkVTKAbstractView::renderEnabled
bool renderEnabled() const
Return if rendering is enabled.
ctkVTKAbstractView::maximumUpdateRate
double maximumUpdateRate() const
ctkVTKAbstractView::fps
double fps() const
Return the current FPS.
ctkVTKAbstractView::VTKWidget
Q_INVOKABLE ctkVTKOpenGLNativeWidget * VTKWidget() const
Get the underlying QVTKWidget.
ctkVTKAbstractView::updateFPS
void updateFPS()
ctkVTKAbstractView::setCornerAnnotationText
virtual void setCornerAnnotationText(const QString &text)
Set corner annotation text.
ctkVTKAbstractView::setRenderEnabled
void setRenderEnabled(bool value)
Enable/Disable rendering.
ctkVTKAbstractView::isRenderPaused
virtual bool isRenderPaused() const
ctkVTKAbstractView::setFPSVisible
void setFPSVisible(bool show)
Show/Hide the FPS annotation.
ctkVTKAbstractView::minimumSizeHint
virtual QSize minimumSizeHint() const
ctkVTKAbstractView::renderWindow
Q_INVOKABLE vtkRenderWindow * renderWindow() const
Get underlying RenderWindow.
ctkVTKAbstractView::cornerAnnotation
Q_INVOKABLE vtkCornerAnnotation * cornerAnnotation() const
ctkVTKAbstractView::setGradientBackground
virtual void setGradientBackground(bool enable)
ctkVTKAbstractView::setBackgroundColor2
virtual void setBackgroundColor2(const QColor &newBackgroundColor)