VTK
dox/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 "vtkWidgetRepresentation.h"
00030 
00031 class vtkHandleRepresentation;
00032 
00033 
00034 class VTK_WIDGETS_EXPORT vtkDistanceRepresentation : public vtkWidgetRepresentation
00035 {
00036 public:
00038 
00039   vtkTypeMacro(vtkDistanceRepresentation,vtkWidgetRepresentation);
00040   void PrintSelf(ostream& os, vtkIndent indent);
00042 
00045   virtual double GetDistance() = 0;
00046 
00048 
00051   virtual void GetPoint1WorldPosition(double pos[3]) = 0;
00052   virtual void GetPoint2WorldPosition(double pos[3]) = 0;
00053   virtual double* GetPoint1WorldPosition() = 0;
00054   virtual double* GetPoint2WorldPosition() = 0;
00055   virtual void SetPoint1DisplayPosition(double pos[3]) = 0;
00056   virtual void SetPoint2DisplayPosition(double pos[3]) = 0;
00057   virtual void GetPoint1DisplayPosition(double pos[3]) = 0;
00058   virtual void GetPoint2DisplayPosition(double pos[3]) = 0;
00059   virtual void SetPoint1WorldPosition(double pos[3])=0;
00060   virtual void SetPoint2WorldPosition(double pos[3])=0;
00062 
00064 
00073   void SetHandleRepresentation(vtkHandleRepresentation *handle);
00074   void InstantiateHandleRepresentation();
00076 
00078 
00081   vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation);
00082   vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation);
00084 
00086 
00089   vtkSetClampMacro(Tolerance,int,1,100);
00090   vtkGetMacro(Tolerance,int);
00092 
00094 
00097   vtkSetStringMacro(LabelFormat);
00098   vtkGetStringMacro(LabelFormat);
00100 
00102 
00106   vtkSetMacro(RulerMode,int);
00107   vtkGetMacro(RulerMode,int);
00108   vtkBooleanMacro(RulerMode,int);
00110 
00112 
00114   vtkSetClampMacro(RulerDistance,double,0,VTK_LARGE_FLOAT);
00115   vtkGetMacro(RulerDistance,double);
00117 
00119 
00124   vtkSetClampMacro(NumberOfRulerTicks,int,1,VTK_LARGE_INTEGER);
00125   vtkGetMacro(NumberOfRulerTicks,int);
00127 
00128 //BTX -- used to communicate about the state of the representation
00129   enum {Outside=0,NearP1,NearP2};
00130 //ETX
00131 
00133 
00134   virtual void BuildRepresentation();
00135   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00136   virtual void StartWidgetInteraction(double e[2]);
00137   virtual void WidgetInteraction(double e[2]);
00139   
00140 protected:
00141   vtkDistanceRepresentation();
00142   ~vtkDistanceRepresentation();
00143 
00144   // The handle and the rep used to close the handles
00145   vtkHandleRepresentation *HandleRepresentation;
00146   vtkHandleRepresentation *Point1Representation;
00147   vtkHandleRepresentation *Point2Representation;
00148 
00149   // Selection tolerance for the handles
00150   int Tolerance;
00151 
00152   // Format for printing the distance
00153   char *LabelFormat;
00154 
00155   // Ruler related stuff
00156   int RulerMode;
00157   double RulerDistance;
00158   int NumberOfRulerTicks;
00159 
00160 private:
00161   vtkDistanceRepresentation(const vtkDistanceRepresentation&);  //Not implemented
00162   void operator=(const vtkDistanceRepresentation&);  //Not implemented
00163 };
00164 
00165 #endif