VTK  9.0.3
vtkDistanceWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDistanceWidget.h,v
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
69 #ifndef vtkDistanceWidget_h
70 #define vtkDistanceWidget_h
71 
72 #include "vtkAbstractWidget.h"
73 #include "vtkInteractionWidgetsModule.h" // For export macro
74 
76 class vtkHandleWidget;
77 class vtkDistanceWidgetCallback;
78 
79 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
80 {
81 public:
86 
88 
92  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
100  void SetEnabled(int) override;
101 
108  {
109  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
110  }
111 
116  {
117  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
118  }
119 
124 
130 
138  enum
139  {
140  Start = 0,
142  Manipulate
143  };
144 
146 
156  virtual void SetWidgetStateToStart();
159 
163  virtual int GetWidgetState() { return this->WidgetState; }
164 
165 protected:
167  ~vtkDistanceWidget() override;
168 
169  // The state of the widget
172 
173  // Callback interface to capture events when
174  // placing the widget.
181 
182  // The positioning handle widgets
185  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
186  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
187 
188  // Methods invoked when the handles at the
189  // end points of the widget are manipulated
190  void StartDistanceInteraction(int handleNum);
191  void DistanceInteraction(int handleNum);
192  void EndDistanceInteraction(int handleNum);
193 
194  friend class vtkDistanceWidgetCallback;
195 
196 private:
197  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
198  void operator=(const vtkDistanceWidget&) = delete;
199 };
200 
201 #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
Methods invoked by print to print information about the object including superclasses.
virtual void SetWidgetStateToManipulate()
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:34
abstract class defines interface between the widget and widget representation classes
int vtkTypeBool
Definition: vtkABI.h:69