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(int 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(int 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(int newPitchRollYawIncrement);
67 
70  void pitch();
71 
74  void roll();
75 
78  void yaw();
79 
81  void setSpinEnabled(bool enabled);
82 
85  void setSpinIncrement(int newSpinIncrement);
86 
89  void setAnimationIntervalMs(int ms);
90 
92  void setRockEnabled(bool enabled);
93 
95  void setRockLength(int newRockLength);
96 
98  void setRockIncrement(int newRockIncrement);
99 
103  void setZoomFactor(double newZoomFactor);
104 
107  void zoomIn();
108 
111  void zoomOut();
112 
114  void setFocalPoint(int x, int y, int z);
115 
118  void resetFocalPoint();
119 
124  void lookFromAxis(const ctkAxesWidget::Axis& axis, double fov = 10.);
125 
126 public:
127 
129  bool orientationWidgetVisible();
130 
132  vtkCamera* activeCamera();
133 
135  void resetCamera();
136 
138  vtkRenderer* renderer()const;
139 
142  virtual void setInteractor(vtkRenderWindowInteractor* interactor);
143 
145  int pitchRollYawIncrement()const;
146 
148  bool spinEnabled() const;
149 
152  int spinIncrement()const;
153 
156  int animationIntervalMs()const;
157 
159  bool rockEnabled() const;
160 
162  int rockLength() const;
163 
165  int rockIncrement() const;
166 
167  RotateDirection pitchDirection()const;
168  void setPitchDirection(RotateDirection newPitchDirection);
169 
170  RotateDirection rollDirection()const;
171  void setRollDirection(RotateDirection newRollDirection);
172 
173  RotateDirection yawDirection()const;
174  void setYawDirection(RotateDirection newYawDirection);
175 
176  RotateDirection spinDirection()const;
177  void setSpinDirection(RotateDirection newSpinDirection);
178 
180  double zoomFactor()const;
181 
182 private:
183  Q_DECLARE_PRIVATE(ctkVTKRenderView);
184  Q_DISABLE_COPY(ctkVTKRenderView);
185 };
186 
187 #endif
virtual void setInteractor(vtkRenderWindowInteractor *interactor)
ctkVTKAbstractView Superclass