VTK  9.3.1
vtkCameraOrientationWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
46 #ifndef vtkCameraOrientationWidget_h
47 #define vtkCameraOrientationWidget_h
48 
49 #include "vtkAbstractWidget.h"
50 #include "vtkInteractionWidgetsModule.h" // needed for export macro
51 #include "vtkWeakPointer.h" // for weak pointer ivar
52 
53 VTK_ABI_NAMESPACE_BEGIN
56 class vtkRenderer;
57 
58 class VTKINTERACTIONWIDGETS_EXPORT vtkCameraOrientationWidget : public vtkAbstractWidget
59 {
60 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
70  vtkSetMacro(Animate, bool);
71  vtkGetMacro(Animate, bool);
72  vtkBooleanMacro(Animate, bool);
74 
76 
79  vtkSetClampMacro(AnimatorTotalFrames, int, 2, VTK_INT_MAX);
80  vtkGetMacro(AnimatorTotalFrames, int);
82 
86  void CreateDefaultRepresentation() override;
87 
91  void SquareResize();
92 
94 
101  void SetParentRenderer(vtkRenderer* renderer);
102  vtkRenderer* GetParentRenderer();
104 
105 protected:
107  ~vtkCameraOrientationWidget() override = default;
108 
109  // These methods handle events
110  void ComputeWidgetState(int X, int Y, int modify = 0);
111  static void SelectAction(vtkAbstractWidget*);
112  static void EndSelectAction(vtkAbstractWidget*);
113  static void MoveAction(vtkAbstractWidget*);
114 
115  // These control the representation and parent renderer's camera.
116  void OrientParentCamera(double back[3], double up[3]);
117  void OrientWidgetRepresentation();
118  void InterpolateCamera(int t);
119 
120  // Manage the state of the widget
121  enum class WidgetStateType : int
122  {
123  Inactive, // mouse is not over the widget, none of the handles are selected.
124  Hot, // mouse is over the widget but none of the handles are selected
125  Active // any one handle is selected, representation could be rotating.
126  };
127  WidgetStateType WidgetState = WidgetStateType::Inactive;
128 
130 
131  // Store camera interpolations.
133 
134  bool Animate = true;
135  int AnimatorTotalFrames = 20;
136 
137  int ResizeObserverTag = -1;
138 
139 private:
141  void operator=(const vtkCameraOrientationWidget&) = delete;
142 };
143 
144 VTK_ABI_NAMESPACE_END
145 #endif
interpolate a series of cameras to update a new camera
vtkWeakPointer< vtkRenderer > ParentRenderer
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
#define VTK_INT_MAX
Definition: vtkType.h:144
abstract specification for renderers
Definition: vtkRenderer.h:61
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
vtkNew< vtkCameraInterpolator > CameraInterpolator
a simple class to control print indentation
Definition: vtkIndent.h:28
A widget to manipulate vtkCameraOrientationWidget.
define the API for widget / widget representation
A 3D representation for vtkCameraOrientationWidget.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...