VTK
vtkBiDimensionalWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBiDimensionalWidget.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 =========================================================================*/
94 #ifndef vtkBiDimensionalWidget_h
95 #define vtkBiDimensionalWidget_h
96 
97 #include "vtkInteractionWidgetsModule.h" // For export macro
98 #include "vtkAbstractWidget.h"
99 
101 class vtkHandleWidget;
102 class vtkBiDimensionalWidgetCallback;
103 
104 
105 class VTKINTERACTIONWIDGETS_EXPORT vtkBiDimensionalWidget : public vtkAbstractWidget
106 {
107 public:
111  static vtkBiDimensionalWidget *New();
112 
114 
118  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
120 
126  void SetEnabled(int) VTK_OVERRIDE;
127 
134  {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
135 
140  {return reinterpret_cast<vtkBiDimensionalRepresentation*>(this->WidgetRep);}
141 
145  void CreateDefaultRepresentation() VTK_OVERRIDE;
146 
151  int IsMeasureValid();
152 
156  enum
157  {
158  EndWidgetSelectEvent = 10050
159  };
160 
165  void SetProcessEvents(int) VTK_OVERRIDE;
166 
173  enum {Start=0,Define,Manipulate};
174 
176 
186  virtual void SetWidgetStateToStart();
187  virtual void SetWidgetStateToManipulate();
189 
193  virtual int GetWidgetState()
194  {return this->WidgetState;}
195 
196 protected:
198  ~vtkBiDimensionalWidget() VTK_OVERRIDE;
199 
200  // The state of the widget
201  int WidgetState;
202  int CurrentHandle;
203  int HandleLine1Selected;
204  int HandleLine2Selected;
205  int Line1InnerSelected;
206  int Line1OuterSelected;
207  int Line2InnerSelected;
208  int Line2OuterSelected;
209  int CenterSelected;
210 
211  // Callback interface to capture events when
212  // placing the widget.
213  static void AddPointAction(vtkAbstractWidget*);
214  static void MoveAction(vtkAbstractWidget*);
215  static void EndSelectAction(vtkAbstractWidget*);
216 
217  // The positioning handle widgets
218  vtkHandleWidget *Point1Widget;
219  vtkHandleWidget *Point2Widget;
220  vtkHandleWidget *Point3Widget;
221  vtkHandleWidget *Point4Widget;
222  vtkBiDimensionalWidgetCallback *BiDimensionalWidgetCallback1;
223  vtkBiDimensionalWidgetCallback *BiDimensionalWidgetCallback2;
224  vtkBiDimensionalWidgetCallback *BiDimensionalWidgetCallback3;
225  vtkBiDimensionalWidgetCallback *BiDimensionalWidgetCallback4;
226 
227  // Methods invoked when the handles at the
228  // end points of the widget are manipulated
229  void StartBiDimensionalInteraction();
230  virtual void EndBiDimensionalInteraction();
231 
232  friend class vtkBiDimensionalWidgetCallback;
233 
234 private:
235  vtkBiDimensionalWidget(const vtkBiDimensionalWidget&) VTK_DELETE_FUNCTION;
236  void operator=(const vtkBiDimensionalWidget&) VTK_DELETE_FUNCTION;
237 };
238 
239 #endif
measure the bi-dimensional lengths of an object
represent the vtkBiDimensionalWidget
virtual void SetProcessEvents(int)
Methods to change whether the widget responds to interaction.
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.
vtkWidgetRepresentation * WidgetRep
void SetRepresentation(vtkBiDimensionalRepresentation *r)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene...
a simple class to control print indentation
Definition: vtkIndent.h:33
define the API for widget / widget representation
void SetEnabled(int) override
Methods for activating this widget.
virtual int GetWidgetState()
Return the current widget state.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkBiDimensionalRepresentation * GetBiDimensionalRepresentation()
Return the representation as a vtkBiDimensionalRepresentation.