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 =========================================================================*/ 00074 #ifndef __vtkDistanceWidget_h 00075 #define __vtkDistanceWidget_h 00076 00077 #include "vtkAbstractWidget.h" 00078 00079 class vtkDistanceRepresentation; 00080 class vtkHandleWidget; 00081 class vtkDistanceWidgetCallback; 00082 00083 00084 class VTK_WIDGETS_EXPORT vtkDistanceWidget : public vtkAbstractWidget 00085 { 00086 public: 00088 static vtkDistanceWidget *New(); 00089 00091 00092 vtkTypeMacro(vtkDistanceWidget,vtkAbstractWidget); 00093 void PrintSelf(ostream& os, vtkIndent indent); 00095 00099 virtual void SetEnabled(int); 00100 00102 00105 void SetRepresentation(vtkDistanceRepresentation *r) 00106 {this->Superclass::SetWidgetRepresentation( 00107 reinterpret_cast<vtkWidgetRepresentation*>(r));} 00109 00111 void CreateDefaultRepresentation(); 00112 00115 virtual void SetProcessEvents(int); 00116 00117 protected: 00118 vtkDistanceWidget(); 00119 ~vtkDistanceWidget(); 00120 00121 // The state of the widget 00122 //BTX 00123 enum {Start=0,Define,Manipulate}; 00124 //ETX 00125 int WidgetState; 00126 int CurrentHandle; 00127 00128 // Callback interface to capture events when 00129 // placing the widget. 00130 static void AddPointAction(vtkAbstractWidget*); 00131 static void MoveAction(vtkAbstractWidget*); 00132 static void EndSelectAction(vtkAbstractWidget*); 00133 00134 // The positioning handle widgets 00135 vtkHandleWidget *Point1Widget; 00136 vtkHandleWidget *Point2Widget; 00137 vtkDistanceWidgetCallback *DistanceWidgetCallback1; 00138 vtkDistanceWidgetCallback *DistanceWidgetCallback2; 00139 00140 // Methods invoked when the handles at the 00141 // end points of the widget are manipulated 00142 void StartDistanceInteraction(int handleNum); 00143 void DistanceInteraction(int handleNum); 00144 void EndDistanceInteraction(int handleNum); 00145 00146 //BTX 00147 friend class vtkDistanceWidgetCallback; 00148 //ETX 00149 00150 private: 00151 vtkDistanceWidget(const vtkDistanceWidget&); //Not implemented 00152 void operator=(const vtkDistanceWidget&); //Not implemented 00153 }; 00154 00155 #endif