forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkCameraHandleSource.h
101 lines (84 loc) · 3.15 KB
/
vtkCameraHandleSource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCameraHandleSource.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkCameraHandleSource
* @brief handle source used to represent one camera.
*
* vtkCameraHandleSource is deriving vtkHandleSource interface.
* This handle represents a camera pointing in the focal point direction.
* Its position and size can be modified.
* If the directional parameter is set to true,
* the camera is represented by one big arrow in the focal point direction
* and one smaller pointing in the view up direction.
* Else, the camera is only displayed as a simple sphere.
*/
#ifndef vtkCameraHandleSource_h
#define vtkCameraHandleSource_h
#include "vtkCamera.h" // for vtkCamera
#include "vtkHandleSource.h"
#include "vtkInteractionWidgetsModule.h" // For export macro
class vtkArrowSource;
class vtkActor;
class vtkAppendPolyData;
class vtkSphereSource;
class vtkTransform;
class vtkTransformFilter;
class VTKINTERACTIONWIDGETS_EXPORT vtkCameraHandleSource : public vtkHandleSource
{
public:
static vtkCameraHandleSource* New();
vtkTypeMacro(vtkCameraHandleSource, vtkHandleSource);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Set the camera represented by this handle.
* The camera can't be set to nullptr.
*/
void SetCamera(vtkCamera* cam);
///@{
/**
* Set/Get the position of the camera handle.
*/
using vtkHandleSource::SetPosition;
void SetPosition(double xPos, double yPos, double zPos) override;
using vtkHandleSource::GetPosition;
double* GetPosition() override;
///@}
///@{
/**
* Set/Get the direction of the camera handle.
* The direction is used in case the camera handle is
* represented as two arrows (when this->Directional = true).
*/
using vtkHandleSource::SetDirection;
void SetDirection(double xTarget, double yTarget, double zTarget) override;
using vtkHandleSource::GetDirection;
double* GetDirection() override;
///@}
vtkCameraHandleSource(const vtkCameraHandleSource&) = delete;
void operator=(const vtkCameraHandleSource&) = delete;
protected:
vtkCameraHandleSource();
~vtkCameraHandleSource() override;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
void RecomputeArrows();
void RecomputeSphere();
private:
vtkSmartPointer<vtkCamera> Camera = vtkSmartPointer<vtkCamera>::New();
vtkNew<vtkArrowSource> UpArrow;
vtkNew<vtkArrowSource> FrontArrow;
vtkNew<vtkTransform> UpTransform;
vtkNew<vtkTransformFilter> UpTransformFilter;
vtkNew<vtkTransform> FrontTransform;
vtkNew<vtkTransformFilter> FrontTransformFilter;
vtkNew<vtkAppendPolyData> ArrowsAppend;
vtkNew<vtkSphereSource> PositionSphere;
};
#endif