VTK
dox/Interaction/Widgets/vtkBiDimensionalRepresentation.h
Go to the documentation of this file.
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 "vtkInteractionWidgetsModule.h" // For export macro
00046 #include "vtkWidgetRepresentation.h"
00047 
00048 class vtkHandleRepresentation;
00049 
00050 
00051 class VTKINTERACTIONWIDGETS_EXPORT vtkBiDimensionalRepresentation : public vtkWidgetRepresentation
00052 {
00053 public:
00055 
00056   vtkTypeMacro(vtkBiDimensionalRepresentation,vtkWidgetRepresentation);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00061 
00064   virtual void SetPoint1WorldPosition(double pos[3]);
00065   virtual void SetPoint2WorldPosition(double pos[3]);
00066   virtual void SetPoint3WorldPosition(double pos[3]);
00067   virtual void SetPoint4WorldPosition(double pos[3]);
00068   virtual void GetPoint1WorldPosition(double pos[3]);
00069   virtual void GetPoint2WorldPosition(double pos[3]);
00070   virtual void GetPoint3WorldPosition(double pos[3]);
00071   virtual void GetPoint4WorldPosition(double pos[3]);
00072   virtual void SetPoint1DisplayPosition(double pos[3]);
00073   virtual void SetPoint2DisplayPosition(double pos[3]);
00074   virtual void SetPoint3DisplayPosition(double pos[3]);
00075   virtual void SetPoint4DisplayPosition(double pos[3]);
00076   virtual void GetPoint1DisplayPosition(double pos[3]);
00077   virtual void GetPoint2DisplayPosition(double pos[3]);
00078   virtual void GetPoint3DisplayPosition(double pos[3]);
00079   virtual void GetPoint4DisplayPosition(double pos[3]);
00081 
00083 
00087   vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation);
00088   vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation);
00089   vtkGetObjectMacro(Point3Representation,vtkHandleRepresentation);
00090   vtkGetObjectMacro(Point4Representation,vtkHandleRepresentation);
00092 
00094 
00098   vtkSetMacro(Line1Visibility,int);
00099   vtkGetMacro(Line1Visibility,int);
00100   vtkBooleanMacro(Line1Visibility,int);
00101   vtkSetMacro(Line2Visibility,int);
00102   vtkGetMacro(Line2Visibility,int);
00103   vtkBooleanMacro(Line2Visibility,int);
00105 
00107 
00116   void SetHandleRepresentation(vtkHandleRepresentation *handle);
00117   virtual void InstantiateHandleRepresentation();
00119 
00121 
00124   vtkSetClampMacro(Tolerance,int,1,100);
00125   vtkGetMacro(Tolerance,int);
00127 
00130   virtual double GetLength1();
00131 
00134   virtual double GetLength2();
00135 
00137 
00140   vtkSetStringMacro(LabelFormat);
00141   vtkGetStringMacro(LabelFormat);
00143 
00144 //BTX -- used to communicate about the state of the representation
00145   enum {Outside=0,NearP1,NearP2,NearP3,NearP4,OnL1Inner,OnL1Outer,OnL2Inner,OnL2Outer,OnCenter};
00146 //ETX
00147 
00149 
00151   vtkSetMacro(ShowLabelAboveWidget, int);
00152   vtkGetMacro(ShowLabelAboveWidget, int);
00153   vtkBooleanMacro(ShowLabelAboveWidget, int);
00155 
00157 
00158   void SetID(vtkIdType id);
00159   vtkGetMacro(ID, vtkIdType);
00161 
00163   virtual char* GetLabelText() = 0;
00164 
00166 
00167   virtual double* GetLabelPosition() = 0;
00168   virtual void GetLabelPosition(double pos[3]) = 0;
00169   virtual void GetWorldLabelPosition(double pos[3]) = 0;
00171 
00173 
00174   virtual void StartWidgetDefinition(double e[2]) = 0;
00175   virtual void Point2WidgetInteraction(double e[2]) = 0;
00176   virtual void Point3WidgetInteraction(double e[2]) = 0;
00177   virtual void StartWidgetManipulation(double e[2]) = 0;
00179 
00180 protected:
00181   vtkBiDimensionalRepresentation();
00182   ~vtkBiDimensionalRepresentation();
00183 
00184   // Keep track if modifier is set
00185   int Modifier;
00186 
00187   // The handle and the rep used to close the handles
00188   vtkHandleRepresentation *HandleRepresentation;
00189   vtkHandleRepresentation *Point1Representation;
00190   vtkHandleRepresentation *Point2Representation;
00191   vtkHandleRepresentation *Point3Representation;
00192   vtkHandleRepresentation *Point4Representation;
00193 
00194   // Selection tolerance for the handles
00195   int Tolerance;
00196 
00197   // Visibility of the lines
00198   int Line1Visibility;
00199   int Line2Visibility;
00200 
00201   vtkIdType ID;
00202   int IDInitialized;
00203 
00204   // Internal variables
00205   double P1World[3];
00206   double P2World[3];
00207   double P3World[3];
00208   double P4World[3];
00209   double P21World[3];
00210   double P43World[3];
00211   double T21;
00212   double T43;
00213   double CenterWorld[3];
00214   double StartEventPositionWorld[4];
00215 
00216   // Format for printing the distance
00217   char *LabelFormat;
00218 
00219   // toggle to determine whether to place text above or below widget
00220   int ShowLabelAboveWidget;
00221 
00222 private:
00223   vtkBiDimensionalRepresentation(const vtkBiDimensionalRepresentation&);  //Not implemented
00224   void operator=(const vtkBiDimensionalRepresentation&);  //Not implemented
00225 };
00226 
00227 #endif