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 =========================================================================*/
58 #ifndef vtkCameraOrientationWidget_h
59 #define vtkCameraOrientationWidget_h
60 
61 #include "vtkAbstractWidget.h"
62 #include "vtkInteractionWidgetsModule.h" // needed for export macro
63 #include "vtkWeakPointer.h" // for weak pointer ivar
64 
67 class vtkRenderer;
68 
69 class VTKINTERACTIONWIDGETS_EXPORT vtkCameraOrientationWidget : public vtkAbstractWidget
70 {
71 public:
74  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
77 
81  vtkSetMacro(Animate, bool);
82  vtkGetMacro(Animate, bool);
83  vtkBooleanMacro(Animate, bool);
85 
87 
90  vtkSetClampMacro(AnimatorTotalFrames, int, 2, VTK_INT_MAX);
91  vtkGetMacro(AnimatorTotalFrames, int);
93 
97  void CreateDefaultRepresentation() override;
98 
102  void SquareResize();
103 
105 
112  void SetParentRenderer(vtkRenderer* renderer);
113  vtkRenderer* GetParentRenderer();
115 
116 protected:
118  ~vtkCameraOrientationWidget() override = default;
119 
120  // These methods handle events
121  void ComputeWidgetState(int X, int Y, int modify = 0);
122  static void SelectAction(vtkAbstractWidget*);
123  static void EndSelectAction(vtkAbstractWidget*);
124  static void MoveAction(vtkAbstractWidget*);
125 
126  // These control the representation and parent renderer's camera.
127  void OrientParentCamera(double back[3], double up[3]);
128  void OrientWidgetRepresentation();
129  void InterpolateCamera(int t);
130 
131  // Manage the state of the widget
132  enum class WidgetStateType : int
133  {
134  Inactive, // mouse is not over the widget, none of the handles are selected.
135  Hot, // mouse is over the widget but none of the handles are selected
136  Active // any one handle is selected, representation could be rotating.
137  };
138  WidgetStateType WidgetState = WidgetStateType::Inactive;
139 
141 
142  // Store camera interpolations.
144 
145  bool Animate = true;
146  int AnimatorTotalFrames = 20;
147 
148  int ResizeObserverTag = -1;
149 
150 private:
152  void operator=(const vtkCameraOrientationWidget&) = delete;
153 };
154 
155 #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:155
abstract specification for renderers
Definition: vtkRenderer.h:72
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:39
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...