VTK
dox/Interaction/Widgets/vtkDistanceWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDistanceWidget.h,v
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00077 #ifndef __vtkDistanceWidget_h
00078 #define __vtkDistanceWidget_h
00079 
00080 #include "vtkInteractionWidgetsModule.h" // For export macro
00081 #include "vtkAbstractWidget.h"
00082 
00083 class vtkDistanceRepresentation;
00084 class vtkHandleWidget;
00085 class vtkDistanceWidgetCallback;
00086 
00087 
00088 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget
00089 {
00090 public:
00092   static vtkDistanceWidget *New();
00093 
00095 
00096   vtkTypeMacro(vtkDistanceWidget,vtkAbstractWidget);
00097   void PrintSelf(ostream& os, vtkIndent indent);
00099 
00103   virtual void SetEnabled(int);
00104 
00106 
00109   void SetRepresentation(vtkDistanceRepresentation *r)
00110     {this->Superclass::SetWidgetRepresentation(
00111       reinterpret_cast<vtkWidgetRepresentation*>(r));}
00113 
00115 
00116   vtkDistanceRepresentation *GetDistanceRepresentation()
00117     {return reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep);}
00119 
00121   void CreateDefaultRepresentation();
00122 
00125   virtual void SetProcessEvents(int);
00126 
00128 
00132   enum {Start=0,Define,Manipulate};
00133   //ETX
00135 
00137 
00145   virtual void SetWidgetStateToStart();
00146   virtual void SetWidgetStateToManipulate();
00148 
00150 
00151   virtual int GetWidgetState()
00152     {return this->WidgetState;}
00154 
00155 protected:
00156   vtkDistanceWidget();
00157   ~vtkDistanceWidget();
00158 
00159   // The state of the widget
00160   int WidgetState;
00161   int CurrentHandle;
00162 
00163   // Callback interface to capture events when
00164   // placing the widget.
00165   static void AddPointAction(vtkAbstractWidget*);
00166   static void MoveAction(vtkAbstractWidget*);
00167   static void EndSelectAction(vtkAbstractWidget*);
00168 
00169   // The positioning handle widgets
00170   vtkHandleWidget *Point1Widget;
00171   vtkHandleWidget *Point2Widget;
00172   vtkDistanceWidgetCallback *DistanceWidgetCallback1;
00173   vtkDistanceWidgetCallback *DistanceWidgetCallback2;
00174 
00175   // Methods invoked when the handles at the
00176   // end points of the widget are manipulated
00177   void StartDistanceInteraction(int handleNum);
00178   void DistanceInteraction(int handleNum);
00179   void EndDistanceInteraction(int handleNum);
00180 
00181 //BTX
00182   friend class vtkDistanceWidgetCallback;
00183 //ETX
00184 
00185 private:
00186   vtkDistanceWidget(const vtkDistanceWidget&);  //Not implemented
00187   void operator=(const vtkDistanceWidget&);  //Not implemented
00188 };
00189 
00190 #endif