VTK
dox/Widgets/vtkHandleRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkHandleRepresentation.h
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   vtkTypeMacro(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 DeepCopy(vtkProp *prop);
00137   virtual void SetRenderer(vtkRenderer *ren);
00139 
00142   virtual unsigned long GetMTime();
00143 
00145 
00152   virtual void SetPointPlacer ( vtkPointPlacer * );
00153   vtkGetObjectMacro( PointPlacer, vtkPointPlacer );
00155 
00156 protected:
00157   vtkHandleRepresentation();
00158   ~vtkHandleRepresentation();
00159 
00160   int Tolerance;
00161   int ActiveRepresentation;
00162   int Constrained;
00163   
00164   // Two vtkCoordinates are available to subclasses, one in display
00165   // coordinates and the other in world coordinates. These facilitate
00166   // the conversion between these two systems. Note that the WorldPosition
00167   // is the ultimate maintainer of position.
00168   vtkCoordinate *DisplayPosition;
00169   vtkCoordinate *WorldPosition;
00170   
00171   // Keep track of when coordinates were changed
00172   vtkTimeStamp DisplayPositionTime;
00173   vtkTimeStamp WorldPositionTime;
00174 
00175   // Constrain the placement of handles.
00176   vtkPointPlacer * PointPlacer;
00177 
00178 private:
00179   vtkHandleRepresentation(const vtkHandleRepresentation&);  //Not implemented
00180   void operator=(const vtkHandleRepresentation&);  //Not implemented
00181 };
00182 
00183 #endif