VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBiDimensionalRepresentation.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 =========================================================================*/ 00042 #ifndef __vtkBiDimensionalRepresentation_h 00043 #define __vtkBiDimensionalRepresentation_h 00044 00045 #include "vtkWidgetRepresentation.h" 00046 00047 class vtkHandleRepresentation; 00048 00049 00050 class VTK_WIDGETS_EXPORT vtkBiDimensionalRepresentation : public vtkWidgetRepresentation 00051 { 00052 public: 00054 00055 vtkTypeMacro(vtkBiDimensionalRepresentation,vtkWidgetRepresentation); 00056 void PrintSelf(ostream& os, vtkIndent indent); 00058 00060 00063 virtual void SetPoint1WorldPosition(double pos[3]); 00064 virtual void SetPoint2WorldPosition(double pos[3]); 00065 virtual void SetPoint3WorldPosition(double pos[3]); 00066 virtual void SetPoint4WorldPosition(double pos[3]); 00067 virtual void GetPoint1WorldPosition(double pos[3]); 00068 virtual void GetPoint2WorldPosition(double pos[3]); 00069 virtual void GetPoint3WorldPosition(double pos[3]); 00070 virtual void GetPoint4WorldPosition(double pos[3]); 00071 virtual void SetPoint1DisplayPosition(double pos[3]); 00072 virtual void SetPoint2DisplayPosition(double pos[3]); 00073 virtual void SetPoint3DisplayPosition(double pos[3]); 00074 virtual void SetPoint4DisplayPosition(double pos[3]); 00075 virtual void GetPoint1DisplayPosition(double pos[3]); 00076 virtual void GetPoint2DisplayPosition(double pos[3]); 00077 virtual void GetPoint3DisplayPosition(double pos[3]); 00078 virtual void GetPoint4DisplayPosition(double pos[3]); 00080 00082 00086 vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation); 00087 vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation); 00088 vtkGetObjectMacro(Point3Representation,vtkHandleRepresentation); 00089 vtkGetObjectMacro(Point4Representation,vtkHandleRepresentation); 00091 00093 00097 vtkSetMacro(Line1Visibility,int); 00098 vtkGetMacro(Line1Visibility,int); 00099 vtkBooleanMacro(Line1Visibility,int); 00100 vtkSetMacro(Line2Visibility,int); 00101 vtkGetMacro(Line2Visibility,int); 00102 vtkBooleanMacro(Line2Visibility,int); 00104 00106 00115 void SetHandleRepresentation(vtkHandleRepresentation *handle); 00116 virtual void InstantiateHandleRepresentation(); 00118 00120 00123 vtkSetClampMacro(Tolerance,int,1,100); 00124 vtkGetMacro(Tolerance,int); 00126 00129 virtual double GetLength1(); 00130 00133 virtual double GetLength2(); 00134 00136 00139 vtkSetStringMacro(LabelFormat); 00140 vtkGetStringMacro(LabelFormat); 00142 00143 //BTX -- used to communicate about the state of the representation 00144 enum {Outside=0,NearP1,NearP2,NearP3,NearP4,OnL1Inner,OnL1Outer,OnL2Inner,OnL2Outer,OnCenter}; 00145 //ETX 00146 00148 00150 vtkSetMacro(ShowLabelAboveWidget, int); 00151 vtkGetMacro(ShowLabelAboveWidget, int); 00152 vtkBooleanMacro(ShowLabelAboveWidget, int); 00154 00156 00157 void SetID(vtkIdType id); 00158 vtkGetMacro(ID, vtkIdType); 00160 00162 virtual char* GetLabelText() = 0; 00163 00165 00166 virtual double* GetLabelPosition() = 0; 00167 virtual void GetLabelPosition(double pos[3]) = 0; 00168 virtual void GetWorldLabelPosition(double pos[3]) = 0; 00170 00172 00173 virtual void StartWidgetDefinition(double e[2]) = 0; 00174 virtual void Point2WidgetInteraction(double e[2]) = 0; 00175 virtual void Point3WidgetInteraction(double e[2]) = 0; 00176 virtual void StartWidgetManipulation(double e[2]) = 0; 00178 00179 protected: 00180 vtkBiDimensionalRepresentation(); 00181 ~vtkBiDimensionalRepresentation(); 00182 00183 // Keep track if modifier is set 00184 int Modifier; 00185 00186 // The handle and the rep used to close the handles 00187 vtkHandleRepresentation *HandleRepresentation; 00188 vtkHandleRepresentation *Point1Representation; 00189 vtkHandleRepresentation *Point2Representation; 00190 vtkHandleRepresentation *Point3Representation; 00191 vtkHandleRepresentation *Point4Representation; 00192 00193 // Selection tolerance for the handles 00194 int Tolerance; 00195 00196 // Visibility of the lines 00197 int Line1Visibility; 00198 int Line2Visibility; 00199 00200 vtkIdType ID; 00201 int IDInitialized; 00202 00203 // Internal variables 00204 double P1World[3]; 00205 double P2World[3]; 00206 double P3World[3]; 00207 double P4World[3]; 00208 double P21World[3]; 00209 double P43World[3]; 00210 double T21; 00211 double T43; 00212 double CenterWorld[3]; 00213 double StartEventPositionWorld[4]; 00214 00215 // Format for printing the distance 00216 char *LabelFormat; 00217 00218 // toggle to determine whether to place text above or below widget 00219 int ShowLabelAboveWidget; 00220 00221 private: 00222 vtkBiDimensionalRepresentation(const vtkBiDimensionalRepresentation&); //Not implemented 00223 void operator=(const vtkBiDimensionalRepresentation&); //Not implemented 00224 }; 00225 00226 #endif