VTK  9.2.6
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 =========================================================================*/
78 #ifndef vtkDistanceWidget_h
79 #define vtkDistanceWidget_h
80 
81 #include "vtkAbstractWidget.h"
82 #include "vtkInteractionWidgetsModule.h" // For export macro
83 
85 class vtkHandleWidget;
86 class vtkDistanceWidgetCallback;
87 
88 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
89 {
90 public:
94  static vtkDistanceWidget* New();
95 
97 
101  void PrintSelf(ostream& os, vtkIndent indent) override;
103 
109  void SetEnabled(int) override;
110 
117  {
118  this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));
119  }
120 
125  {
126  return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);
127  }
128 
132  void CreateDefaultRepresentation() override;
133 
138  void SetProcessEvents(vtkTypeBool) override;
139 
147  enum
148  {
149  Start = 0,
151  Manipulate
152  };
153 
155 
165  virtual void SetWidgetStateToStart();
166  virtual void SetWidgetStateToManipulate();
168 
172  virtual int GetWidgetState() { return this->WidgetState; }
173 
174 protected:
176  ~vtkDistanceWidget() override;
177 
178  // The state of the widget
181 
182  // Callback interface to capture events when
183  // placing the widget.
184  static void AddPointAction(vtkAbstractWidget*);
185  static void MoveAction(vtkAbstractWidget*);
186  static void EndSelectAction(vtkAbstractWidget*);
187  static void AddPointAction3D(vtkAbstractWidget*);
188  static void MoveAction3D(vtkAbstractWidget*);
189  static void EndSelectAction3D(vtkAbstractWidget*);
190 
191  // The positioning handle widgets
194  vtkDistanceWidgetCallback* DistanceWidgetCallback1;
195  vtkDistanceWidgetCallback* DistanceWidgetCallback2;
196 
197  // Methods invoked when the handles at the
198  // end points of the widget are manipulated
199  void StartDistanceInteraction(int handleNum);
200  void DistanceInteraction(int handleNum);
201  void EndDistanceInteraction(int handleNum);
202 
203  friend class vtkDistanceWidgetCallback;
204 
205 private:
206  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
207  void operator=(const vtkDistanceWidget&) = delete;
208 };
209 
210 #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:39
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