VTK  9.3.0
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
75 #ifndef vtkDistanceWidget_h
76 #define vtkDistanceWidget_h
77 
78 #include "vtkAbstractWidget.h"
79 #include "vtkInteractionWidgetsModule.h" // For export macro
80 
81 VTK_ABI_NAMESPACE_BEGIN
83 class vtkHandleWidget;
84 class vtkDistanceWidgetCallback;
85 
86 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
87 {
88 public:
93 
95 
99  void PrintSelf(ostream& os, vtkIndent indent) override;
101 
107  void SetEnabled(int) override;
108 
115  {
116  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
117  }
118 
123  {
124  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
125  }
126 
131 
137 
145  enum
146  {
147  Start = 0,
149  Manipulate
150  };
151 
153 
163  virtual void SetWidgetStateToStart();
166 
170  virtual int GetWidgetState() { return this->WidgetState; }
171 
172 protected:
174  ~vtkDistanceWidget() override;
175 
176  // The state of the widget
179 
180  // Callback interface to capture events when
181  // placing the widget.
188 
189  // The positioning handle widgets
192  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
193  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
194 
195  // Methods invoked when the handles at the
196  // end points of the widget are manipulated
197  void StartDistanceInteraction(int handleNum);
198  void DistanceInteraction(int handleNum);
199  void EndDistanceInteraction(int handleNum);
200 
201  friend class vtkDistanceWidgetCallback;
202 
203 private:
204  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
205  void operator=(const vtkDistanceWidget&) = delete;
206 };
207 
208 VTK_ABI_NAMESPACE_END
209 #endif
define the API for widget / widget representation
vtkWidgetRepresentation * WidgetRep
represent the vtkDistanceWidget
measure the distance between two points
virtual void SetWidgetStateToStart()
Set the state of the widget.
virtual int GetWidgetState()
Return the current widget state.
vtkDistanceRepresentation * GetDistanceRepresentation()
Return the representation as a vtkDistanceRepresentation.
static void MoveAction3D(vtkAbstractWidget *)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for a VTK class.
virtual void SetWidgetStateToManipulate()
Set the state of the widget.
static void EndSelectAction(vtkAbstractWidget *)
void SetRepresentation(vtkDistanceRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
void EndDistanceInteraction(int handleNum)
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
static void AddPointAction3D(vtkAbstractWidget *)
~vtkDistanceWidget() override
vtkHandleWidget * Point2Widget
void StartDistanceInteraction(int handleNum)
vtkHandleWidget * Point1Widget
vtkDistanceWidgetCallback * DistanceWidgetCallback1
void DistanceInteraction(int handleNum)
vtkDistanceWidgetCallback * DistanceWidgetCallback2
static vtkDistanceWidget * New()
Instantiate this class.
static void MoveAction(vtkAbstractWidget *)
void SetEnabled(int) override
The method for activating and deactivating this widget.
void SetProcessEvents(vtkTypeBool) override
Methods to change the whether the widget responds to interaction.
static void AddPointAction(vtkAbstractWidget *)
static void EndSelectAction3D(vtkAbstractWidget *)
a general widget for moving handles
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:64