VTK
dox/Interaction/Widgets/vtkDistanceRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDistanceRepresentation.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 =========================================================================*/
00026 #ifndef __vtkDistanceRepresentation_h
00027 #define __vtkDistanceRepresentation_h
00028 
00029 #include "vtkInteractionWidgetsModule.h" // For export macro
00030 #include "vtkWidgetRepresentation.h"
00031 
00032 class vtkHandleRepresentation;
00033 
00034 
00035 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
00036 {
00037 public:
00039 
00040   vtkTypeMacro(vtkDistanceRepresentation,vtkWidgetRepresentation);
00041   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00046   virtual double GetDistance() = 0;
00047 
00049 
00052   virtual void GetPoint1WorldPosition(double pos[3]) = 0;
00053   virtual void GetPoint2WorldPosition(double pos[3]) = 0;
00054   virtual double* GetPoint1WorldPosition() = 0;
00055   virtual double* GetPoint2WorldPosition() = 0;
00056   virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
00057   virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
00058   virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
00059   virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
00060   virtual void SetPoint1WorldPosition(double pos[3])=0;
00061   virtual void SetPoint2WorldPosition(double pos[3])=0;
00063 
00065 
00074   void SetHandleRepresentation(vtkHandleRepresentation *handle);
00075   void InstantiateHandleRepresentation();
00077 
00079 
00082   vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation);
00083   vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation);
00085 
00087 
00090   vtkSetClampMacro(Tolerance,int,1,100);
00091   vtkGetMacro(Tolerance,int);
00093 
00095 
00098   vtkSetStringMacro(LabelFormat);
00099   vtkGetStringMacro(LabelFormat);
00101 
00103 
00107   vtkSetMacro(RulerMode,int);
00108   vtkGetMacro(RulerMode,int);
00109   vtkBooleanMacro(RulerMode,int);
00111 
00113 
00115   vtkSetClampMacro(RulerDistance,double,0,VTK_FLOAT_MAX);
00116   vtkGetMacro(RulerDistance,double);
00118 
00120 
00125   vtkSetClampMacro(NumberOfRulerTicks,int,1,VTK_INT_MAX);
00126   vtkGetMacro(NumberOfRulerTicks,int);
00128 
00129 //BTX -- used to communicate about the state of the representation
00130   enum {Outside=0,NearP1,NearP2};
00131 //ETX
00132 
00134 
00135   virtual void BuildRepresentation();
00136   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00137   virtual void StartWidgetInteraction(double e[2]);
00138   virtual void WidgetInteraction(double e[2]);
00140 
00141 protected:
00142   vtkDistanceRepresentation();
00143   ~vtkDistanceRepresentation();
00144 
00145   // The handle and the rep used to close the handles
00146   vtkHandleRepresentation *HandleRepresentation;
00147   vtkHandleRepresentation *Point1Representation;
00148   vtkHandleRepresentation *Point2Representation;
00149 
00150   // Selection tolerance for the handles
00151   int Tolerance;
00152 
00153   // Format for printing the distance
00154   char *LabelFormat;
00155 
00156   // Ruler related stuff
00157   int RulerMode;
00158   double RulerDistance;
00159   int NumberOfRulerTicks;
00160 
00161 private:
00162   vtkDistanceRepresentation(const vtkDistanceRepresentation&);  //Not implemented
00163   void operator=(const vtkDistanceRepresentation&);  //Not implemented
00164 };
00165 
00166 #endif