VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkHandleRepresentation.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 =========================================================================*/ 00047 #ifndef __vtkHandleRepresentation_h 00048 #define __vtkHandleRepresentation_h 00049 00050 #include "vtkWidgetRepresentation.h" 00051 00052 class vtkCoordinate; 00053 class vtkRenderer; 00054 class vtkPointPlacer; 00055 00056 class VTK_WIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation 00057 { 00058 public: 00060 00061 vtkTypeRevisionMacro(vtkHandleRepresentation,vtkWidgetRepresentation); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00064 00066 00072 virtual void SetDisplayPosition(double pos[3]); 00073 virtual void GetDisplayPosition(double pos[3]); 00074 virtual double* GetDisplayPosition(); 00075 virtual void SetWorldPosition(double pos[3]); 00076 virtual void GetWorldPosition(double pos[3]); 00077 virtual double* GetWorldPosition(); 00079 00081 00084 vtkSetClampMacro(Tolerance,int,1,100); 00085 vtkGetMacro(Tolerance,int); 00087 00089 00093 vtkSetMacro(ActiveRepresentation,int); 00094 vtkGetMacro(ActiveRepresentation,int); 00095 vtkBooleanMacro(ActiveRepresentation,int); 00097 00098 //BTX 00099 // Enums define the state of the representation relative to the mouse pointer 00100 // position. Used by ComputeInteractionState() to communicate with the 00101 // widget. Note that ComputeInteractionState() and several other methods 00102 // must be implemented by subclasses. 00103 enum _InteractionState { Outside=0, Nearby, Selecting, Translating, Scaling }; 00104 //ETX 00105 00107 00114 vtkSetClampMacro(InteractionState,int,Outside,Scaling); 00116 00118 00121 vtkSetMacro(Constrained,int); 00122 vtkGetMacro(Constrained,int); 00123 vtkBooleanMacro(Constrained,int); 00125 00130 virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]); 00131 00133 00135 virtual void ShallowCopy(vtkProp *prop); 00136 virtual void SetRenderer(vtkRenderer *ren); 00138 00141 virtual unsigned long GetMTime(); 00142 00144 00151 virtual void SetPointPlacer ( vtkPointPlacer * ); 00152 vtkGetObjectMacro( PointPlacer, vtkPointPlacer ); 00154 00155 protected: 00156 vtkHandleRepresentation(); 00157 ~vtkHandleRepresentation(); 00158 00159 int Tolerance; 00160 int ActiveRepresentation; 00161 int Constrained; 00162 00163 // Two vtkCoordinates are available to subclasses, one in display 00164 // coordinates and the other in world coordinates. These facilitate 00165 // the conversion between these two systems. Note that the WorldPosition 00166 // is the ultimate maintainer of position. 00167 vtkCoordinate *DisplayPosition; 00168 vtkCoordinate *WorldPosition; 00169 00170 // Keep track of when coordinates were changed 00171 vtkTimeStamp DisplayPositionTime; 00172 vtkTimeStamp WorldPositionTime; 00173 00174 // Constrain the placement of handles. 00175 vtkPointPlacer * PointPlacer; 00176 00177 private: 00178 vtkHandleRepresentation(const vtkHandleRepresentation&); //Not implemented 00179 void operator=(const vtkHandleRepresentation&); //Not implemented 00180 }; 00181 00182 #endif