VTK
dox/Interaction/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 "vtkInteractionWidgetsModule.h" // For export macro
00051 #include "vtkWidgetRepresentation.h"
00052 
00053 class vtkCoordinate;
00054 class vtkRenderer;
00055 class vtkPointPlacer;
00056 
00057 class VTKINTERACTIONWIDGETS_EXPORT vtkHandleRepresentation : public vtkWidgetRepresentation
00058 {
00059 public:
00061 
00062   vtkTypeMacro(vtkHandleRepresentation,vtkWidgetRepresentation);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067 
00073   virtual void SetDisplayPosition(double pos[3]);
00074   virtual void GetDisplayPosition(double pos[3]);
00075   virtual double* GetDisplayPosition();
00076   virtual void SetWorldPosition(double pos[3]);
00077   virtual void GetWorldPosition(double pos[3]);
00078   virtual double* GetWorldPosition();
00080 
00082 
00085   vtkSetClampMacro(Tolerance,int,1,100);
00086   vtkGetMacro(Tolerance,int);
00088 
00090 
00094   vtkSetMacro(ActiveRepresentation,int);
00095   vtkGetMacro(ActiveRepresentation,int);
00096   vtkBooleanMacro(ActiveRepresentation,int);
00098 
00099 //BTX
00100   // Enums define the state of the representation relative to the mouse pointer
00101   // position. Used by ComputeInteractionState() to communicate with the
00102   // widget. Note that ComputeInteractionState() and several other methods
00103   // must be implemented by subclasses.
00104   enum _InteractionState { Outside=0, Nearby, Selecting, Translating, Scaling };
00105 //ETX
00106 
00108 
00115   vtkSetClampMacro(InteractionState,int,Outside,Scaling);
00117 
00119 
00122   vtkSetMacro(Constrained,int);
00123   vtkGetMacro(Constrained,int);
00124   vtkBooleanMacro(Constrained,int);
00126 
00131   virtual int CheckConstraint(vtkRenderer *renderer, double pos[2]);
00132 
00134 
00136   virtual void ShallowCopy(vtkProp *prop);
00137   virtual void DeepCopy(vtkProp *prop);
00138   virtual void SetRenderer(vtkRenderer *ren);
00140 
00143   virtual unsigned long GetMTime();
00144 
00146 
00153   virtual void SetPointPlacer ( vtkPointPlacer * );
00154   vtkGetObjectMacro( PointPlacer, vtkPointPlacer );
00156 
00157 protected:
00158   vtkHandleRepresentation();
00159   ~vtkHandleRepresentation();
00160 
00161   int Tolerance;
00162   int ActiveRepresentation;
00163   int Constrained;
00164 
00165   // Two vtkCoordinates are available to subclasses, one in display
00166   // coordinates and the other in world coordinates. These facilitate
00167   // the conversion between these two systems. Note that the WorldPosition
00168   // is the ultimate maintainer of position.
00169   vtkCoordinate *DisplayPosition;
00170   vtkCoordinate *WorldPosition;
00171 
00172   // Keep track of when coordinates were changed
00173   vtkTimeStamp DisplayPositionTime;
00174   vtkTimeStamp WorldPositionTime;
00175 
00176   // Constrain the placement of handles.
00177   vtkPointPlacer * PointPlacer;
00178 
00179 private:
00180   vtkHandleRepresentation(const vtkHandleRepresentation&);  //Not implemented
00181   void operator=(const vtkHandleRepresentation&);  //Not implemented
00182 };
00183 
00184 #endif