VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
72 
73 VTK_ABI_NAMESPACE_BEGIN
75 class vtkHandleWidget;
76 class vtkDistanceWidgetCallback;
77 
78 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkDistanceWidget : public vtkAbstractWidget
79 {
80 public:
84  static vtkDistanceWidget* New();
85 
87 
91  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
99  void SetEnabled(int) override;
100 
107  {
108  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
109  }
110 
115  {
116  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
117  }
118 
122  void CreateDefaultRepresentation() override;
123 
128  void SetProcessEvents(vtkTypeBool) override;
129 
137  enum
138  {
139  Start = 0,
141  Manipulate
142  };
143 
145 
155  virtual void SetWidgetStateToStart();
156  virtual void SetWidgetStateToManipulate();
158 
162  virtual int GetWidgetState() { return this->WidgetState; }
163 
164 protected:
166  ~vtkDistanceWidget() override;
167 
168  // The state of the widget
171 
172  // Callback interface to capture events when
173  // placing the widget.
174  static void AddPointAction(vtkAbstractWidget*);
175  static void MoveAction(vtkAbstractWidget*);
176  static void EndSelectAction(vtkAbstractWidget*);
177  static void AddPointAction3D(vtkAbstractWidget*);
178  static void MoveAction3D(vtkAbstractWidget*);
179  static void EndSelectAction3D(vtkAbstractWidget*);
180 
181  // The positioning handle widgets
184  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
185  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
186 
187  // Methods invoked when the handles at the
188  // end points of the widget are manipulated
189  void StartDistanceInteraction(int handleNum);
190  void DistanceInteraction(int handleNum);
191  void EndDistanceInteraction(int handleNum);
192 
193  friend class vtkDistanceWidgetCallback;
194 
195 private:
196  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
197  void operator=(const vtkDistanceWidget&) = delete;
198 };
199 
200 VTK_ABI_NAMESPACE_END
201 #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
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkDistanceWidgetCallback * DistanceWidgetCallback2