VTK  9.0.1
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 =========================================================================*/
72 #ifndef vtkDistanceWidget_h
73 #define vtkDistanceWidget_h
74 
75 #include "vtkAbstractWidget.h"
76 #include "vtkInteractionWidgetsModule.h" // For export macro
77 
79 class vtkHandleWidget;
80 class vtkDistanceWidgetCallback;
81 
82 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
83 {
84 public:
88  static vtkDistanceWidget* New();
89 
91 
95  void PrintSelf(ostream& os, vtkIndent indent) override;
97 
103  void SetEnabled(int) override;
104 
111  {
112  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
113  }
114 
119  {
120  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
121  }
122 
126  void CreateDefaultRepresentation() override;
127 
132  void SetProcessEvents(vtkTypeBool) override;
133 
141  enum
142  {
143  Start = 0,
145  Manipulate
146  };
147 
149 
159  virtual void SetWidgetStateToStart();
160  virtual void SetWidgetStateToManipulate();
162 
166  virtual int GetWidgetState() { return this->WidgetState; }
167 
168 protected:
170  ~vtkDistanceWidget() override;
171 
172  // The state of the widget
175 
176  // Callback interface to capture events when
177  // placing the widget.
178  static void AddPointAction(vtkAbstractWidget*);
179  static void MoveAction(vtkAbstractWidget*);
180  static void EndSelectAction(vtkAbstractWidget*);
181  static void AddPointAction3D(vtkAbstractWidget*);
182  static void MoveAction3D(vtkAbstractWidget*);
183  static void EndSelectAction3D(vtkAbstractWidget*);
184 
185  // The positioning handle widgets
188  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
189  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
190 
191  // Methods invoked when the handles at the
192  // end points of the widget are manipulated
193  void StartDistanceInteraction(int handleNum);
194  void DistanceInteraction(int handleNum);
195  void EndDistanceInteraction(int handleNum);
196 
197  friend class vtkDistanceWidgetCallback;
198 
199 private:
200  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
201  void operator=(const vtkDistanceWidget&) = delete;
202 };
203 
204 #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:69
vtkDistanceRepresentation * GetDistanceRepresentation()
Return the representation as a vtkDistanceRepresentation.
a simple class to control print indentation
Definition: vtkIndent.h:33
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
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkDistanceWidgetCallback * DistanceWidgetCallback2