VTK  9.1.0
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 =========================================================================*/
55 #ifndef vtkCameraOrientationWidget_h
56 #define vtkCameraOrientationWidget_h
57 
58 #include "vtkAbstractWidget.h"
59 #include "vtkInteractionWidgetsModule.h" // needed for export macro
60 #include "vtkWeakPointer.h" // for weak pointer ivar
61 
64 class vtkRenderer;
65 
66 class VTKINTERACTIONWIDGETS_EXPORT vtkCameraOrientationWidget : public vtkAbstractWidget
67 {
68 public:
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
74 
78  vtkSetMacro(Animate, bool);
79  vtkGetMacro(Animate, bool);
80  vtkBooleanMacro(Animate, bool);
82 
84 
87  vtkSetClampMacro(AnimatorTotalFrames, int, 2, VTK_INT_MAX);
88  vtkGetMacro(AnimatorTotalFrames, int);
90 
94  void CreateDefaultRepresentation() override;
95 
99  void SquareResize();
100 
102 
112 
113 protected:
115  ~vtkCameraOrientationWidget() override = default;
116 
117  // These methods handle events
118  void ComputeWidgetState(int X, int Y, int modify = 0);
122 
123  // These control the representation and parent renderer's camera.
124  void OrientParentCamera(double back[3], double up[3]);
126  void InterpolateCamera(int t);
127 
128  // Manage the state of the widget
129  enum class WidgetStateType : int
130  {
131  Inactive, // mouse is not over the widget, none of the handles are selected.
132  Hot, // mouse is over the widget but none of the handles are selected
133  Active // any one handle is selected, representation could be rotating.
134  };
135  WidgetStateType WidgetState = WidgetStateType::Inactive;
136 
138 
139  // Store camera interpolations.
141 
142  bool Animate = true;
143  int AnimatorTotalFrames = 20;
144 
145  int ResizeObserverTag = -1;
146 
147 private:
149  void operator=(const vtkCameraOrientationWidget&) = delete;
150 };
151 
152 #endif
define the API for widget / widget representation
interpolate a series of cameras to update a new camera
a 3D axes representation for interactive widgets
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:34
abstract specification for renderers
Definition: vtkRenderer.h:73
#define VTK_INT_MAX
Definition: vtkType.h:155