VTK  9.3.20240419
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 
73 #ifndef vtkCompassWidget_h
74 #define vtkCompassWidget_h
75 
76 #include "vtkAbstractWidget.h"
77 #include "vtkInteractionWidgetsModule.h" // For export macro
78 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
79 
80 VTK_ABI_NAMESPACE_BEGIN
82 
83 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkCompassWidget : public vtkAbstractWidget
84 {
85 public:
89  static vtkCompassWidget* New();
90 
92 
96  void PrintSelf(ostream& os, vtkIndent indent) override;
98 
105  {
106  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
107  }
108 
113 
115 
118  double GetHeading();
119  void SetHeading(double v);
120  double GetTilt();
121  void SetTilt(double tilt);
122  double GetDistance();
123  void SetDistance(double distance);
125 
127 
131  vtkGetMacro(TimerDuration, int);
132  vtkSetMacro(TimerDuration, int);
134 
136 
140  vtkGetMacro(TiltSpeed, double);
141  vtkSetMacro(TiltSpeed, double);
143 
145 
149  vtkGetMacro(DistanceSpeed, double);
150  vtkSetMacro(DistanceSpeed, double);
152 
153 protected:
155  ~vtkCompassWidget() override = default;
156 
157  // These are the events that are handled
158  static void SelectAction(vtkAbstractWidget* widget);
159  static void EndSelectAction(vtkAbstractWidget* widget);
160  static void MoveAction(vtkAbstractWidget* widget);
161  static void TimerAction(vtkAbstractWidget* widget);
162 
165  {
166  Start = 0,
174  DistanceTimerAdjustingOut
175  };
176 
177  int TimerId = -1;
178  int TimerDuration = 50;
179  double StartTime;
180 
181  double TiltSpeed = 30.0;
182  double DistanceSpeed = 1.0;
183 
184 private:
185  vtkCompassWidget(const vtkCompassWidget&) = delete;
186  void operator=(const vtkCompassWidget&) = delete;
187 };
188 
189 VTK_ABI_NAMESPACE_END
190 #endif
define the API for widget / widget representation
provide a compass and distance, tilt sliders
widget to set distance, tilt and heading
static void SelectAction(vtkAbstractWidget *widget)
~vtkCompassWidget() override=default
void SetRepresentation(vtkCompassRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
void SetHeading(double v)
Get/set the value for this widget.
double GetHeading()
Get/set the value for this widget.
static vtkCompassWidget * New()
Instantiate the class.
static void MoveAction(vtkAbstractWidget *widget)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros.
static void TimerAction(vtkAbstractWidget *widget)
static void EndSelectAction(vtkAbstractWidget *widget)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
double GetDistance()
Get/set the value for this widget.
double GetTilt()
Get/set the value for this widget.
void SetTilt(double tilt)
Get/set the value for this widget.
void SetDistance(double distance)
Get/set the value for this widget.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract class defines interface between the widget and widget representation classes
#define VTK_MARSHALAUTO