VTK
dox/Interaction/Widgets/vtkDistanceRepresentation3D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDistanceRepresentation3D.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 =========================================================================*/
00031 #ifndef __vtkDistanceRepresentation3D_h
00032 #define __vtkDistanceRepresentation3D_h
00033 
00034 #include "vtkInteractionWidgetsModule.h" // For export macro
00035 #include "vtkDistanceRepresentation.h"
00036 
00037 class vtkPoints;
00038 class vtkPolyData;
00039 class vtkPolyDataMapper;
00040 class vtkActor;
00041 class vtkVectorText;
00042 class vtkFollower;
00043 class vtkBox;
00044 class vtkCylinderSource;
00045 class vtkGlyph3D;
00046 class vtkDoubleArray;
00047 class vtkTransformPolyDataFilter;
00048 class vtkProperty;
00049 
00050 
00051 class VTKINTERACTIONWIDGETS_EXPORT vtkDistanceRepresentation3D : public vtkDistanceRepresentation
00052 {
00053 public:
00055   static vtkDistanceRepresentation3D *New();
00056 
00058 
00059   vtkTypeMacro(vtkDistanceRepresentation3D,vtkDistanceRepresentation);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00065   virtual double GetDistance()
00066     {return this->Distance;}
00068 
00070 
00072   void SetGlyphScale(double scale);
00073   vtkGetMacro(GlyphScale, double);
00075 
00077   virtual vtkProperty *GetLineProperty();
00078 
00080 
00082   void SetLabelPosition(double labelPosition);
00083   vtkGetMacro(LabelPosition, double);
00085 
00087 
00088   vtkSetClampMacro(MaximumNumberOfRulerTicks, int, 1, VTK_INT_MAX);
00089   vtkGetMacro(MaximumNumberOfRulerTicks, int);
00091 
00093 
00095   vtkGetObjectMacro(GlyphActor, vtkActor);
00097 
00099 
00101   vtkGetObjectMacro(LabelActor, vtkFollower);
00103 
00105 
00108   double* GetPoint1WorldPosition();
00109   double* GetPoint2WorldPosition();
00110   void GetPoint1WorldPosition(double pos[3]);
00111   void GetPoint2WorldPosition(double pos[3]);
00112   void SetPoint1WorldPosition(double pos[3]);
00113   void SetPoint2WorldPosition(double pos[3]);
00115 
00116   void SetPoint1DisplayPosition(double pos[3]);
00117   void SetPoint2DisplayPosition(double pos[3]);
00118   void GetPoint1DisplayPosition(double pos[3]);
00119   void GetPoint2DisplayPosition(double pos[3]);
00120 
00122 
00123   virtual void BuildRepresentation();
00124   virtual double *GetBounds();
00126 
00128 
00129   virtual void ReleaseGraphicsResources(vtkWindow *w);
00130   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00131   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00133 
00135 
00137   void SetLabelScale(double x, double y, double z)
00138   {
00139     double scale[3];
00140     scale[0] = x;
00141     scale[1] = y;
00142     scale[2] = z;
00143     this->SetLabelScale(scale);
00144   }
00145   virtual void SetLabelScale( double scale[3] );
00146   virtual double * GetLabelScale();
00148 
00150   virtual vtkProperty *GetLabelProperty();
00151 
00152 protected:
00153   vtkDistanceRepresentation3D();
00154   ~vtkDistanceRepresentation3D();
00155 
00156   // The line
00157   vtkPoints         *LinePoints;
00158   vtkPolyData       *LinePolyData;
00159   vtkPolyDataMapper *LineMapper;
00160   vtkActor          *LineActor;
00161 
00162   // The distance label
00163   vtkVectorText     *LabelText;
00164   vtkPolyDataMapper *LabelMapper;
00165   vtkFollower       *LabelActor;
00166 
00167   // Support internal operations
00168   bool LabelScaleSpecified;
00169 
00170   // The 3D disk tick marks
00171   vtkPoints         *GlyphPoints;
00172   vtkDoubleArray    *GlyphVectors;
00173   vtkPolyData       *GlyphPolyData;
00174   vtkCylinderSource *GlyphCylinder;
00175   vtkTransformPolyDataFilter *GlyphXForm;
00176   vtkGlyph3D        *Glyph3D;
00177   vtkPolyDataMapper *GlyphMapper;
00178   vtkActor          *GlyphActor;
00179 
00180   // Glyph3D scale
00181   double GlyphScale;
00182   bool   GlyphScaleSpecified;
00183 
00184   // The distance between the two points
00185   double Distance;
00186 
00187   // Support GetBounds() method
00188   vtkBox *BoundingBox;
00189 
00190   // Maximum number of ticks on the 3d ruler
00191   int MaximumNumberOfRulerTicks;
00192 
00193   // Label title position
00194   double LabelPosition;
00195 
00196 private:
00197   vtkDistanceRepresentation3D(const vtkDistanceRepresentation3D&);  //Not implemented
00198   void operator=(const vtkDistanceRepresentation3D&);  //Not implemented
00199 
00200   // Internal method to update the position of the label.
00201   void UpdateLabelPosition();
00202 };
00203 
00204 #endif