• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Widgets/vtkBiDimensionalRepresentation2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkBiDimensionalRepresentation2D.h,v $
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 =========================================================================*/
00043 #ifndef __vtkBiDimensionalRepresentation2D_h
00044 #define __vtkBiDimensionalRepresentation2D_h
00045 
00046 #include "vtkWidgetRepresentation.h"
00047 
00048 class vtkHandleRepresentation;
00049 class vtkCellArray;
00050 class vtkPoints;
00051 class vtkPolyData;
00052 class vtkPolyDataMapper2D;
00053 class vtkTextMapper;
00054 class vtkActor2D;
00055 class vtkProperty2D;
00056 class vtkTextProperty;
00057 
00058 
00059 class VTK_WIDGETS_EXPORT vtkBiDimensionalRepresentation2D : public vtkWidgetRepresentation
00060 {
00061 public:
00063   static vtkBiDimensionalRepresentation2D *New();
00064 
00066 
00067   vtkTypeRevisionMacro(vtkBiDimensionalRepresentation2D,vtkWidgetRepresentation);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00072 
00075   virtual void SetPoint1WorldPosition(double pos[3]);
00076   virtual void SetPoint2WorldPosition(double pos[3]);
00077   virtual void SetPoint3WorldPosition(double pos[3]);
00078   virtual void SetPoint4WorldPosition(double pos[3]);
00079   virtual void GetPoint1WorldPosition(double pos[3]);
00080   virtual void GetPoint2WorldPosition(double pos[3]);
00081   virtual void GetPoint3WorldPosition(double pos[3]);
00082   virtual void GetPoint4WorldPosition(double pos[3]);
00083   virtual void SetPoint1DisplayPosition(double pos[3]);
00084   virtual void SetPoint2DisplayPosition(double pos[3]);
00085   virtual void SetPoint3DisplayPosition(double pos[3]);
00086   virtual void SetPoint4DisplayPosition(double pos[3]);
00087   virtual void GetPoint1DisplayPosition(double pos[3]);
00088   virtual void GetPoint2DisplayPosition(double pos[3]);
00089   virtual void GetPoint3DisplayPosition(double pos[3]);
00090   virtual void GetPoint4DisplayPosition(double pos[3]);
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   void InstantiateHandleRepresentation();
00119 
00121 
00125   vtkGetObjectMacro(Point1Representation,vtkHandleRepresentation);
00126   vtkGetObjectMacro(Point2Representation,vtkHandleRepresentation);
00127   vtkGetObjectMacro(Point3Representation,vtkHandleRepresentation);
00128   vtkGetObjectMacro(Point4Representation,vtkHandleRepresentation);
00130 
00132 
00134   vtkGetObjectMacro(LineProperty,vtkProperty2D);
00135   vtkGetObjectMacro(SelectedLineProperty,vtkProperty2D);
00137 
00139 
00141   vtkGetObjectMacro(TextProperty,vtkTextProperty);
00143 
00145 
00148   vtkSetClampMacro(Tolerance,int,1,100);
00149   vtkGetMacro(Tolerance,int);
00151 
00154   virtual double GetLength1();
00155 
00158   virtual double GetLength2();
00159 
00161 
00164   vtkSetStringMacro(LabelFormat);
00165   vtkGetStringMacro(LabelFormat);
00167 
00168 //BTX -- used to communicate about the state of the representation
00169   enum {Outside=0,NearP1,NearP2,NearP3,NearP4,OnL1Inner,OnL1Outer,OnL2Inner,OnL2Outer,OnCenter};
00170 //ETX
00171 
00173 
00174   virtual void BuildRepresentation();
00175   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00176   virtual void StartWidgetDefinition(double e[2]);
00177   virtual void Point2WidgetInteraction(double e[2]);
00178   virtual void Point3WidgetInteraction(double e[2]);
00179   virtual void StartWidgetManipulation(double e[2]);
00180   virtual void WidgetInteraction(double e[2]);
00181   virtual void Highlight(int highlightOn);
00183 
00185 
00186   virtual void ReleaseGraphicsResources(vtkWindow *w);
00187   virtual int RenderOverlay(vtkViewport *viewport);
00189 
00191 
00193   vtkSetMacro(ShowLabelAboveWidget, int);
00194   vtkGetMacro(ShowLabelAboveWidget, int);
00195   vtkBooleanMacro(ShowLabelAboveWidget, int);
00197 
00199 
00200   void SetID(unsigned long id);
00201   vtkGetMacro(ID, unsigned long);
00203 
00205   char* GetLabelText();
00206 
00208 
00209   double* GetLabelPosition();
00210   void GetLabelPosition(double pos[3]);
00211   void GetWorldLabelPosition(double pos[3]);
00213 
00214 protected:
00215   vtkBiDimensionalRepresentation2D();
00216   ~vtkBiDimensionalRepresentation2D();
00217 
00218   // Keep track if modifier is set
00219   int Modifier;
00220 
00221   // The handle and the rep used to close the handles
00222   vtkHandleRepresentation *HandleRepresentation;
00223   vtkHandleRepresentation *Point1Representation;
00224   vtkHandleRepresentation *Point2Representation;
00225   vtkHandleRepresentation *Point3Representation;
00226   vtkHandleRepresentation *Point4Representation;
00227 
00228   // Selection tolerance for the handles
00229   int Tolerance;
00230 
00231   // Visibility of the lines
00232   int Line1Visibility;
00233   int Line2Visibility;
00234 
00235   // Geometry of the lines
00236   vtkCellArray        *LineCells;
00237   vtkPoints           *LinePoints;
00238   vtkPolyData         *LinePolyData;
00239   vtkPolyDataMapper2D *LineMapper;
00240   vtkActor2D          *LineActor;
00241   vtkProperty2D       *LineProperty;
00242   vtkProperty2D       *SelectedLineProperty;
00243 
00244   // The labels for the line lengths
00245   vtkTextProperty *TextProperty;
00246   vtkTextMapper   *TextMapper;
00247   vtkActor2D      *TextActor;
00248 
00249   unsigned long ID;
00250   int IDInitialized;
00251 
00252   // Internal variables
00253   double P1World[3];
00254   double P2World[3];
00255   double P3World[3];
00256   double P4World[3];
00257   double P21World[3];
00258   double P43World[3];
00259   double T21;
00260   double T43;
00261   double CenterWorld[3];
00262   double StartEventPositionWorld[4];
00263 
00264   // Format for printing the distance
00265   char *LabelFormat;
00266 
00267   // toggle to determine whether to place text above or below widget
00268   int ShowLabelAboveWidget;
00269 
00270   // Helper method
00271   void ProjectOrthogonalPoint(double x[4], double y[3], double x1[3], double x2[3], double x21[3], 
00272                               double dir, double xP[3]);
00273 
00274 private:
00275   vtkBiDimensionalRepresentation2D(const vtkBiDimensionalRepresentation2D&);  //Not implemented
00276   void operator=(const vtkBiDimensionalRepresentation2D&);  //Not implemented
00277 };
00278 
00279 #endif

Generated by  doxygen 1.7.1