VTK
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 "vtkInteractionWidgetsModule.h" // For export macro
73 #include "vtkAbstractWidget.h"
74 
76 class vtkHandleWidget;
77 class vtkDistanceWidgetCallback;
78 
79 
80 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
81 {
82 public:
86  static vtkDistanceWidget *New();
87 
89 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
101  void SetEnabled(int) override;
102 
109  {this->Superclass::SetWidgetRepresentation(
110  reinterpret_cast<vtkWidgetRepresentation*>(r));}
111 
116  {return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);}
117 
121  void CreateDefaultRepresentation() override;
122 
127  void SetProcessEvents(vtkTypeBool) override;
128 
136  enum {Start=0,Define,Manipulate};
137 
139 
149  virtual void SetWidgetStateToStart();
150  virtual void SetWidgetStateToManipulate();
152 
156  virtual int GetWidgetState()
157  {return this->WidgetState;}
158 
159 protected:
161  ~vtkDistanceWidget() override;
162 
163  // The state of the widget
166 
167  // Callback interface to capture events when
168  // placing the widget.
169  static void AddPointAction(vtkAbstractWidget*);
170  static void MoveAction(vtkAbstractWidget*);
171  static void EndSelectAction(vtkAbstractWidget*);
172  static void AddPointAction3D(vtkAbstractWidget*);
173  static void MoveAction3D(vtkAbstractWidget*);
174  static void EndSelectAction3D(vtkAbstractWidget*);
175 
176  // The positioning handle widgets
179  vtkDistanceWidgetCallback *DistanceWidgetCallback1;
180  vtkDistanceWidgetCallback *DistanceWidgetCallback2;
181 
182  // Methods invoked when the handles at the
183  // end points of the widget are manipulated
184  void StartDistanceInteraction(int handleNum);
185  void DistanceInteraction(int handleNum);
186  void EndDistanceInteraction(int handleNum);
187 
188  friend class vtkDistanceWidgetCallback;
189 
190 private:
191  vtkDistanceWidget(const vtkDistanceWidget&) = delete;
192  void operator=(const vtkDistanceWidget&) = delete;
193 };
194 
195 #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.
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