VTK  9.2.6
vtkCameraOrientationWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCameraOrientationWidget.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
67 #ifndef vtkCameraOrientationWidget_h
68 #define vtkCameraOrientationWidget_h
69 
70 #include "vtkAbstractWidget.h"
71 #include "vtkInteractionWidgetsModule.h" // needed for export macro
72 #include "vtkWeakPointer.h" // for weak pointer ivar
73 
76 class vtkRenderer;
77 
78 class VTKINTERACTIONWIDGETS_EXPORT vtkCameraOrientationWidget : public vtkAbstractWidget
79 {
80 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
86 
90  vtkSetMacro(Animate, bool);
91  vtkGetMacro(Animate, bool);
92  vtkBooleanMacro(Animate, bool);
94 
96 
99  vtkSetClampMacro(AnimatorTotalFrames, int, 2, VTK_INT_MAX);
100  vtkGetMacro(AnimatorTotalFrames, int);
102 
107 
111  void SquareResize();
112 
114 
124 
125 protected:
127  ~vtkCameraOrientationWidget() override = default;
128 
129  // These methods handle events
130  void ComputeWidgetState(int X, int Y, int modify = 0);
134 
135  // These control the representation and parent renderer's camera.
136  void OrientParentCamera(double back[3], double up[3]);
138  void InterpolateCamera(int t);
139 
140  // Manage the state of the widget
141  enum class WidgetStateType : int
142  {
143  Inactive, // mouse is not over the widget, none of the handles are selected.
144  Hot, // mouse is over the widget but none of the handles are selected
145  Active // any one handle is selected, representation could be rotating.
146  };
147  WidgetStateType WidgetState = WidgetStateType::Inactive;
148 
150 
151  // Store camera interpolations.
153 
154  bool Animate = true;
155  int AnimatorTotalFrames = 20;
156 
157  int ResizeObserverTag = -1;
158 
159 private:
161  void operator=(const vtkCameraOrientationWidget&) = delete;
162 };
163 
164 #endif
define the API for widget / widget representation
interpolate a series of cameras to update a new camera
A 3D representation for vtkCameraOrientationWidget.
A widget to manipulate vtkCameraOrientationWidget.
vtkWeakPointer< vtkRenderer > ParentRenderer
vtkNew< vtkCameraInterpolator > CameraInterpolator
~vtkCameraOrientationWidget() override=default
static vtkCameraOrientationWidget * New()
static void SelectAction(vtkAbstractWidget *)
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 *)
void ComputeWidgetState(int X, int Y, int modify=0)
vtkRenderer * GetParentRenderer()
This widget shows and manipulates the orientation of the parent renderer's active camera.
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])
void SquareResize()
Fits the widget's renderer to a square viewport.
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract specification for renderers
Definition: vtkRenderer.h:82
#define VTK_INT_MAX
Definition: vtkType.h:155