VTK  9.7.1
vtkCompassWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 
54 #ifndef vtkCompassWidget_h
55 #define vtkCompassWidget_h
56 
57 #include "vtkAbstractWidget.h"
58 #include "vtkInteractionWidgetsModule.h" // For export macro
59 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
60 
61 VTK_ABI_NAMESPACE_BEGIN
63 
64 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkCompassWidget : public vtkAbstractWidget
65 {
66 public:
70  static vtkCompassWidget* New();
71 
73 
77  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
86  {
87  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
88  }
89 
93  void CreateDefaultRepresentation() override;
94 
96 
99  double GetHeading();
100  void SetHeading(double v);
101  double GetTilt();
102  void SetTilt(double tilt);
103  double GetDistance();
104  void SetDistance(double distance);
106 
108 
112  vtkGetMacro(TimerDuration, int);
113  vtkSetMacro(TimerDuration, int);
115 
117 
121  vtkGetMacro(TiltSpeed, double);
122  vtkSetMacro(TiltSpeed, double);
124 
126 
130  vtkGetMacro(DistanceSpeed, double);
131  vtkSetMacro(DistanceSpeed, double);
133 
134 protected:
136  ~vtkCompassWidget() override = default;
137 
138  // These are the events that are handled
139  static void SelectAction(vtkAbstractWidget* widget);
140  static void EndSelectAction(vtkAbstractWidget* widget);
141  static void MoveAction(vtkAbstractWidget* widget);
142  static void TimerAction(vtkAbstractWidget* widget);
143 
146  {
147  Start = 0,
155  DistanceTimerAdjustingOut
156  };
157 
158  int TimerId = -1;
159  int TimerDuration = 50;
160  double StartTime;
161 
162  double TiltSpeed = 30.0;
163  double DistanceSpeed = 1.0;
164 
165 private:
166  vtkCompassWidget(const vtkCompassWidget&) = delete;
167  void operator=(const vtkCompassWidget&) = delete;
168 };
169 
170 VTK_ABI_NAMESPACE_END
171 #endif
void SetRepresentation(vtkCompassRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
a simple class to control print indentation
Definition: vtkIndent.h:28
define the API for widget / widget representation
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
widget to set distance, tilt and heading
provide a compass and distance, tilt sliders