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
72#ifndef vtkDistanceWidget_h
73#define vtkDistanceWidget_h
74
75#include "vtkAbstractWidget.h"
76#include "vtkInteractionWidgetsModule.h" // For export macro
77
78VTK_ABI_NAMESPACE_BEGIN
80class vtkHandleWidget;
81class vtkDistanceWidgetCallback;
82
83class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
84{
85public:
90
92
96 void PrintSelf(ostream& os, vtkIndent indent) override;
98
104 void SetEnabled(int) override;
105
112 {
113 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
114 }
115
120 {
121 return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
122 }
123
128
134
142 enum
143 {
144 Start = 0,
146 Manipulate
147 };
148
150
160 virtual void SetWidgetStateToStart();
163
167 virtual int GetWidgetState() { return this->WidgetState; }
168
169protected:
172
173 // The state of the widget
176
177 // Callback interface to capture events when
178 // placing the widget.
185
186 // The positioning handle widgets
189 vtkDistanceWidgetCallback* DistanceWidgetCallback1;
190 vtkDistanceWidgetCallback* DistanceWidgetCallback2;
191
192 // Methods invoked when the handles at the
193 // end points of the widget are manipulated
194 void StartDistanceInteraction(int handleNum);
195 void DistanceInteraction(int handleNum);
196 void EndDistanceInteraction(int handleNum);
197
198 friend class vtkDistanceWidgetCallback;
199
200private:
201 vtkDistanceWidget(const vtkDistanceWidget&) = delete;
202 void operator=(const vtkDistanceWidget&) = delete;
203};
204
205VTK_ABI_NAMESPACE_END
206#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.
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.
vtkDistanceRepresentation * GetDistanceRepresentation()
Return the representation as a vtkDistanceRepresentation.
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