VTK  9.3.1
vtkDistanceWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
66 #ifndef vtkDistanceWidget_h
67 #define vtkDistanceWidget_h
68 
69 #include "vtkAbstractWidget.h"
70 #include "vtkInteractionWidgetsModule.h" // For export macro
71 
72 VTK_ABI_NAMESPACE_BEGIN
74 class vtkHandleWidget;
75 class vtkDistanceWidgetCallback;
76 
77 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
78 {
79 public:
83  static vtkDistanceWidget* New();
84 
86 
90  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
98  void SetEnabled(int) override;
99 
106  {
107  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
108  }
109 
114  {
115  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
116  }
117 
121  void CreateDefaultRepresentation() override;
122 
127  void SetProcessEvents(vtkTypeBool) override;
128 
136  enum
137  {
138  Start = 0,
140  Manipulate
141  };
142 
144 
154  virtual void SetWidgetStateToStart();
155  virtual void SetWidgetStateToManipulate();
157 
161  virtual int GetWidgetState() { return this->WidgetState; }
162 
163 protected:
165  ~vtkDistanceWidget() override;
166 
167  // The state of the widget
170 
171  // Callback interface to capture events when
172  // placing the widget.
173  static void AddPointAction(vtkAbstractWidget*);
174  static void MoveAction(vtkAbstractWidget*);
175  static void EndSelectAction(vtkAbstractWidget*);
176  static void AddPointAction3D(vtkAbstractWidget*);
177  static void MoveAction3D(vtkAbstractWidget*);
178  static void EndSelectAction3D(vtkAbstractWidget*);
179 
180  // The positioning handle widgets
183  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
184  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
185 
186  // Methods invoked when the handles at the
187  // end points of the widget are manipulated
188  void StartDistanceInteraction(int handleNum);
189  void DistanceInteraction(int handleNum);
190  void EndDistanceInteraction(int handleNum);
191 
192  friend class vtkDistanceWidgetCallback;
193 
194 private:
195  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
196  void operator=(const vtkDistanceWidget&) = delete;
197 };
198 
199 VTK_ABI_NAMESPACE_END
200 #endif
vtkHandleWidget * Point1Widget
represent the vtkDistanceWidget
measure the distance between two points
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
a general widget for moving handles
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
virtual int GetWidgetState()
Return the current widget state.
vtkHandleWidget * Point2Widget
void SetRepresentation(vtkDistanceRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
vtkWidgetRepresentation * WidgetRep
int vtkTypeBool
Definition: vtkABI.h:64
vtkDistanceRepresentation * GetDistanceRepresentation()
Return the representation as a vtkDistanceRepresentation.
a simple class to control print indentation
Definition: vtkIndent.h:28
define the API for widget / widget representation
virtual void SetProcessEvents(vtkTypeBool)
Methods to change whether the widget responds to interaction.
void SetEnabled(int) override
Methods for activating this widget.
vtkDistanceWidgetCallback * DistanceWidgetCallback1
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkDistanceWidgetCallback * DistanceWidgetCallback2