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 =========================================================================*/
75 #ifndef vtkDistanceWidget_h
76 #define vtkDistanceWidget_h
77 
78 #include "vtkInteractionWidgetsModule.h" // For export macro
79 #include "vtkAbstractWidget.h"
80 
82 class vtkHandleWidget;
83 class vtkDistanceWidgetCallback;
84 
85 
86 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
87 {
88 public:
92  static vtkDistanceWidget *New();
93 
95 
99  void PrintSelf(ostream& os, vtkIndent indent) override;
101 
107  void SetEnabled(int) override;
108 
115  {this->Superclass::SetWidgetRepresentation(
116  reinterpret_cast<vtkWidgetRepresentation*>(r));}
117 
122  {return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);}
123 
127  void CreateDefaultRepresentation() override;
128 
133  void SetProcessEvents(vtkTypeBool) override;
134 
142  enum {Start=0,Define,Manipulate};
143 
145 
155  virtual void SetWidgetStateToStart();
156  virtual void SetWidgetStateToManipulate();
158 
162  virtual int GetWidgetState()
163  {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.
175  static void AddPointAction(vtkAbstractWidget*);
176  static void MoveAction(vtkAbstractWidget*);
177  static void EndSelectAction(vtkAbstractWidget*);
178  static void AddPointAction3D(vtkAbstractWidget*);
179  static void MoveAction3D(vtkAbstractWidget*);
180  static void EndSelectAction3D(vtkAbstractWidget*);
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
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