VTK  9.7.0
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
48
49#ifndef vtkCameraOrientationWidget_h
50#define vtkCameraOrientationWidget_h
51
52#include "vtkAbstractWidget.h"
53#include "vtkInteractionWidgetsModule.h" // needed for export macro
54#include "vtkWeakPointer.h" // for weak pointer ivar
55#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
56
57VTK_ABI_NAMESPACE_BEGIN
60class vtkRenderer;
61
62class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkCameraOrientationWidget
63 : public vtkAbstractWidget
64{
65public:
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
71
75 vtkSetMacro(Animate, bool);
76 vtkGetMacro(Animate, bool);
77 vtkBooleanMacro(Animate, bool);
79
81
84 vtkSetClampMacro(AnimatorTotalFrames, int, 2, VTK_INT_MAX);
85 vtkGetMacro(AnimatorTotalFrames, int);
87
94
99
104
110 void SetDefaultRenderer(vtkRenderer* renderer) override;
111
113
123
125
129 vtkSetMacro(ShouldResetCamera, bool);
130 vtkGetMacro(ShouldResetCamera, bool);
131 vtkBooleanMacro(ShouldResetCamera, bool);
133
135
141 vtkSetMacro(UseCenterOfRotation, bool);
142 vtkGetMacro(UseCenterOfRotation, bool);
143 vtkBooleanMacro(UseCenterOfRotation, bool);
145
146protected:
149
150 // These methods handle events
151 void ComputeWidgetState(int X, int Y, int modify = 0);
155
156 // These control the representation and parent renderer's camera.
157 void OrientParentCamera(double back[3], double up[3]);
159 void InterpolateCamera(int t);
160
162 void PlayAnimationSingleFrame(vtkObject* caller, unsigned long event, void* callData);
164
165 // Manage the state of the widget
166 enum class WidgetStateType : int
167 {
168 Inactive, // mouse is not over the widget, none of the handles are selected.
169 Hot, // mouse is over the widget but none of the handles are selected
170 Active // any one handle is selected, representation could be rotating.
171 };
173
175
176 // Store camera interpolations.
178
179 bool Animate = true;
180 bool ShouldResetCamera = true;
185
189
190private:
192 void operator=(const vtkCameraOrientationWidget&) = delete;
193};
194
195VTK_ABI_NAMESPACE_END
196#endif
interpolate a series of cameras to update a new camera
A 3D representation for vtkCameraOrientationWidget.
vtkWeakPointer< vtkRenderer > ParentRenderer
vtkNew< vtkCameraInterpolator > CameraInterpolator
void PlayAnimationSingleFrame(vtkObject *caller, unsigned long event, void *callData)
void SetRepresentation(vtkCameraOrientationRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
static void SelectAction(vtkAbstractWidget *)
void SetDefaultRenderer(vtkRenderer *renderer) override
Override super class method for default renderer.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
static void MoveAction(vtkAbstractWidget *)
void CreateDefaultRepresentation() override
Create a vtkCameraOrientationRepresentation.
static void EndSelectAction(vtkAbstractWidget *)
~vtkCameraOrientationWidget() override
void ComputeWidgetState(int X, int Y, int modify=0)
void SetParentRenderer(vtkRenderer *renderer)
This widget shows and manipulates the orientation of the parent renderer's active camera.
void OrientParentCamera(double back[3], double up[3])
vtkRenderer * GetParentRenderer()
This widget shows and manipulates the orientation of the parent renderer's active camera.
static vtkCameraOrientationWidget * New()
void SquareResize()
Fits the widget's renderer to a square viewport.
a simple class to control print indentation
Definition vtkIndent.h:29
Allocate and hold a VTK object.
Definition vtkNew.h:59
abstract specification for renderers
Definition vtkRenderer.h:64
a weak reference to a vtkObject.
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_MARSHALAUTO