VTK  9.3.20240422
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
85#ifndef vtkDistanceWidget_h
86#define vtkDistanceWidget_h
87
88#include "vtkAbstractWidget.h"
89#include "vtkInteractionWidgetsModule.h" // For export macro
90#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
91
92VTK_ABI_NAMESPACE_BEGIN
94class vtkHandleWidget;
95class vtkDistanceWidgetCallback;
96
97class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkDistanceWidget : public vtkAbstractWidget
98{
99public:
104
106
110 void PrintSelf(ostream& os, vtkIndent indent) override;
112
118 void SetEnabled(int) override;
119
126 {
127 this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
128 }
129
134 {
135 return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
136 }
137
142
148
156 enum
157 {
158 Start = 0,
160 Manipulate
161 };
162
164
174 virtual void SetWidgetStateToStart();
177
181 virtual int GetWidgetState() { return this->WidgetState; }
182
183protected:
186
187 // The state of the widget
190
191 // Callback interface to capture events when
192 // placing the widget.
199
200 // The positioning handle widgets
203 vtkDistanceWidgetCallback* DistanceWidgetCallback1;
204 vtkDistanceWidgetCallback* DistanceWidgetCallback2;
205
206 // Methods invoked when the handles at the
207 // end points of the widget are manipulated
208 void StartDistanceInteraction(int handleNum);
209 void DistanceInteraction(int handleNum);
210 void EndDistanceInteraction(int handleNum);
211
212 friend class vtkDistanceWidgetCallback;
213
214private:
215 vtkDistanceWidget(const vtkDistanceWidget&) = delete;
216 void operator=(const vtkDistanceWidget&) = delete;
217};
218
219VTK_ABI_NAMESPACE_END
220#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:108
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHALAUTO