CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKRenderView.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 __ctkVTKRenderView_h
22 #define __ctkVTKRenderView_h
23 
24 // CTK includes
25 #include <ctkAxesWidget.h>
26 #include "ctkVTKAbstractView.h"
27 class ctkVTKRenderViewPrivate;
28 
29 class vtkCamera;
30 class vtkRenderer;
31 
33 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKRenderView : public ctkVTKAbstractView
34 {
35  Q_OBJECT
36  Q_PROPERTY(bool orientationWidgetVisible READ orientationWidgetVisible
37  WRITE setOrientationWidgetVisible)
38  Q_PROPERTY(double zoomFactor READ zoomFactor WRITE setZoomFactor)
39  Q_PROPERTY(double pitchRollYawIncrement READ pitchRollYawIncrement WRITE setPitchRollYawIncrement)
40  Q_ENUMS(RotateDirection)
41  Q_PROPERTY(RotateDirection pitchDirection READ pitchDirection WRITE setPitchDirection)
42  Q_PROPERTY(RotateDirection rollDirection READ rollDirection WRITE setRollDirection)
43  Q_PROPERTY(RotateDirection yawDirection READ yawDirection WRITE setYawDirection)
44  Q_PROPERTY(RotateDirection spinDirection READ spinDirection WRITE setSpinDirection)
45  Q_PROPERTY(bool spinEnabled READ spinEnabled WRITE setSpinEnabled)
46  Q_PROPERTY(double spinIncrement READ spinIncrement WRITE setSpinIncrement)
47  Q_PROPERTY(int animationIntervalMs READ animationIntervalMs WRITE setAnimationIntervalMs)
48  Q_PROPERTY(bool rockEnabled READ rockEnabled WRITE setRockEnabled)
49  Q_PROPERTY(int rockLength READ rockLength WRITE setRockLength)
50 
51 public:
52 
53  enum RotateDirection { PitchUp, PitchDown, RollLeft, RollRight, YawLeft, YawRight };
54 
56  explicit ctkVTKRenderView(QWidget* parent = 0);
57  virtual ~ctkVTKRenderView();
58 
59 public Q_SLOTS:
61  void setOrientationWidgetVisible(bool visible);
62 
66  void setPitchRollYawIncrement(double newPitchRollYawIncrement);
67 
70  void pitch();
71 
74  void roll();
75 
78  void yaw();
79 
81  void setSpinEnabled(bool enabled);
82 
85  void setSpinIncrement(double newSpinIncrement);
86 
89  void setAnimationIntervalMs(int ms);
90 
92  void setRockEnabled(bool enabled);
93 
95  void setRockLength(int newRockLength);
96 
99  void setRockIncrement(int newRockIncrement);
100 
104  void setZoomFactor(double newZoomFactor);
105 
108  void zoomIn();
109 
112  void zoomOut();
113 
115  void setFocalPoint(double x, double y, double z);
116 
120 
125  void lookFromAxis(const ctkAxesWidget::Axis& axis, double fov = 10.);
126 
127 public:
128 
131 
133  vtkCamera* activeCamera();
134 
136  void resetCamera();
137 
139  vtkRenderer* renderer()const;
140 
143  virtual void setInteractor(vtkRenderWindowInteractor* interactor);
144 
146  double pitchRollYawIncrement()const;
147 
149  bool spinEnabled() const;
150 
153  double spinIncrement()const;
154 
158 
160  bool rockEnabled() const;
161 
163  int rockLength() const;
164 
167  int rockIncrement() const;
168 
170  void setPitchDirection(RotateDirection newPitchDirection);
171 
173  void setRollDirection(RotateDirection newRollDirection);
174 
176  void setYawDirection(RotateDirection newYawDirection);
177 
179  void setSpinDirection(RotateDirection newSpinDirection);
180 
182  double zoomFactor()const;
183 
184 private:
185  Q_DECLARE_PRIVATE(ctkVTKRenderView);
186  Q_DISABLE_COPY(ctkVTKRenderView);
187 };
188 
189 #endif
ctkVTKRenderView::setPitchRollYawIncrement
void setPitchRollYawIncrement(double newPitchRollYawIncrement)
ctkVTKRenderView::animationIntervalMs
int animationIntervalMs() const
ctkVTKRenderView::setInteractor
virtual void setInteractor(vtkRenderWindowInteractor *interactor)
ctkVTKAbstractView.h
ctkVTKRenderView::activeCamera
vtkCamera * activeCamera()
Get active camera.
ctkVTKRenderView::RotateDirection
RotateDirection
Definition: ctkVTKRenderView.h:53
ctkVTKRenderView::orientationWidgetVisible
bool orientationWidgetVisible()
Get Orientation widget visibility.
ctkVTKRenderView::~ctkVTKRenderView
virtual ~ctkVTKRenderView()
ctkVTKRenderView::resetFocalPoint
void resetFocalPoint()
Reset focal point The visible scene bbox is computed, then the camera is recentered around its centro...
ctkVTKRenderView::zoomOut
void zoomOut()
ctkVTKRenderView::lookFromAxis
void lookFromAxis(const ctkAxesWidget::Axis &axis, double fov=10.)
Change camera to look from a given axis to the focal point Translate/Rotate the camera to look from a...
ctkVTKRenderView::resetCamera
void resetCamera()
Reset camera.
ctkVTKRenderView::yaw
void yaw()
ctkVTKRenderView::setSpinDirection
void setSpinDirection(RotateDirection newSpinDirection)
ctkVTKRenderView::setPitchDirection
void setPitchDirection(RotateDirection newPitchDirection)
ctkVTKRenderView::setYawDirection
void setYawDirection(RotateDirection newYawDirection)
ctkVTKRenderView::pitch
void pitch()
ctkVTKRenderView::spinEnabled
bool spinEnabled() const
Return if animated spin is enabled.
ctkVTKRenderView::rockEnabled
bool rockEnabled() const
Return if animated rock is enabled.
ctkVTKRenderView::ctkVTKRenderView
ctkVTKRenderView(QWidget *parent=0)
ctkVTKRenderView::rockIncrement
int rockIncrement() const
ctkVTKRenderView::renderer
vtkRenderer * renderer() const
Get a reference to the associated vtkRenderer.
ctkVTKRenderView::setRockLength
void setRockLength(int newRockLength)
Set length of a complete rock period (in number of animation steps)
ctkVTKRenderView::zoomFactor
double zoomFactor() const
Return zoom factor.
ctkVTKRenderView::setRockEnabled
void setRockEnabled(bool enabled)
Enable or Disbled the animated rock of the view.
ctkVTKRenderView::setRollDirection
void setRollDirection(RotateDirection newRollDirection)
ctkVTKRenderView::Superclass
ctkVTKAbstractView Superclass
Definition: ctkVTKRenderView.h:55
ctkVTKRenderView::setRockIncrement
void setRockIncrement(int newRockIncrement)
ctkVTKAbstractView
Definition: ctkVTKAbstractView.h:40
ctkAxesWidget::Axis
Axis
Definition: ctkAxesWidget.h:44
ctkVTKRenderView::setOrientationWidgetVisible
void setOrientationWidgetVisible(bool visible)
Show/Hide Orientation widget.
ctkVTKRenderView::yawDirection
RotateDirection yawDirection() const
ctkVTKRenderView
Definition: ctkVTKRenderView.h:34
ctkAxesWidget.h
ctkVTKRenderView::spinDirection
RotateDirection spinDirection() const
ctkVTKRenderView::setAnimationIntervalMs
void setAnimationIntervalMs(int ms)
ctkVTKRenderView::pitchRollYawIncrement
double pitchRollYawIncrement() const
Return pitch, roll or yaw increment (in degree)
ctkVTKRenderView::zoomIn
void zoomIn()
ctkVTKRenderView::setFocalPoint
void setFocalPoint(double x, double y, double z)
Set the focal point.
ctkVTKRenderView::pitchDirection
RotateDirection pitchDirection() const
ctkVTKRenderView::rockLength
int rockLength() const
Return length of the rock animation.
ctkVTKRenderView::setSpinEnabled
void setSpinEnabled(bool enabled)
Enable or Disbled the animated spin of the view.
ctkVTKRenderView::rollDirection
RotateDirection rollDirection() const
ctkVTKRenderView::setZoomFactor
void setZoomFactor(double newZoomFactor)
Set zoom factor zoomFactor is a value between 0.0 and 1.0.
ctkVTKRenderView::setSpinIncrement
void setSpinIncrement(double newSpinIncrement)
ctkVTKRenderView::roll
void roll()
ctkVTKRenderView::spinIncrement
double spinIncrement() const