VTK
|
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 00101 //BTX -- used to communicate about the state of the representation 00102 enum {Outside=0,NearP1,NearP2}; 00103 //ETX 00104 00106 00107 virtual void BuildRepresentation(); 00108 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00109 virtual void StartWidgetInteraction(double e[2]); 00110 virtual void WidgetInteraction(double e[2]); 00112 00113 protected: 00114 vtkDistanceRepresentation(); 00115 ~vtkDistanceRepresentation(); 00116 00117 // The handle and the rep used to close the handles 00118 vtkHandleRepresentation *HandleRepresentation; 00119 vtkHandleRepresentation *Point1Representation; 00120 vtkHandleRepresentation *Point2Representation; 00121 00122 // Selection tolerance for the handles 00123 int Tolerance; 00124 00125 // Format for printing the distance 00126 char *LabelFormat; 00127 00128 private: 00129 vtkDistanceRepresentation(const vtkDistanceRepresentation&); //Not implemented 00130 void operator=(const vtkDistanceRepresentation&); //Not implemented 00131 }; 00132 00133 #endif