VTK
|
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 "vtkDistanceRepresentation.h" 00035 00036 class vtkPoints; 00037 class vtkPolyData; 00038 class vtkPolyDataMapper; 00039 class vtkActor; 00040 class vtkVectorText; 00041 class vtkFollower; 00042 class vtkBox; 00043 class vtkCylinderSource; 00044 class vtkGlyph3D; 00045 class vtkDoubleArray; 00046 class vtkTransformPolyDataFilter; 00047 class vtkProperty; 00048 00049 00050 class VTK_WIDGETS_EXPORT vtkDistanceRepresentation3D : public vtkDistanceRepresentation 00051 { 00052 public: 00054 static vtkDistanceRepresentation3D *New(); 00055 00057 00058 vtkTypeMacro(vtkDistanceRepresentation3D,vtkDistanceRepresentation); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00061 00063 00064 virtual double GetDistance() 00065 {return this->Distance;} 00067 00069 00071 void SetGlyphScale(double scale); 00072 vtkGetMacro(GlyphScale, double); 00074 00076 virtual vtkProperty *GetLineProperty(); 00077 00079 00081 void SetLabelPosition(double labelPosition); 00082 vtkGetMacro(LabelPosition, double); 00084 00086 00087 vtkSetClampMacro(MaximumNumberOfRulerTicks, int, 1, VTK_LARGE_INTEGER); 00088 vtkGetMacro(MaximumNumberOfRulerTicks, int); 00090 00092 00094 vtkGetObjectMacro(GlyphActor, vtkActor); 00096 00098 00100 vtkGetObjectMacro(LabelActor, vtkFollower); 00102 00104 00107 double* GetPoint1WorldPosition(); 00108 double* GetPoint2WorldPosition(); 00109 void GetPoint1WorldPosition(double pos[3]); 00110 void GetPoint2WorldPosition(double pos[3]); 00111 void SetPoint1WorldPosition(double pos[3]); 00112 void SetPoint2WorldPosition(double pos[3]); 00114 00115 void SetPoint1DisplayPosition(double pos[3]); 00116 void SetPoint2DisplayPosition(double pos[3]); 00117 void GetPoint1DisplayPosition(double pos[3]); 00118 void GetPoint2DisplayPosition(double pos[3]); 00119 00121 00122 virtual void BuildRepresentation(); 00123 virtual double *GetBounds(); 00125 00127 00128 virtual void ReleaseGraphicsResources(vtkWindow *w); 00129 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00130 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00132 00134 00136 void SetLabelScale(double x, double y, double z) 00137 { 00138 double scale[3]; 00139 scale[0] = x; 00140 scale[1] = y; 00141 scale[2] = z; 00142 this->SetLabelScale(scale); 00143 } 00144 virtual void SetLabelScale( double scale[3] ); 00145 virtual double * GetLabelScale(); 00147 00149 virtual vtkProperty *GetLabelProperty(); 00150 00151 protected: 00152 vtkDistanceRepresentation3D(); 00153 ~vtkDistanceRepresentation3D(); 00154 00155 // The line 00156 vtkPoints *LinePoints; 00157 vtkPolyData *LinePolyData; 00158 vtkPolyDataMapper *LineMapper; 00159 vtkActor *LineActor; 00160 00161 // The distance label 00162 vtkVectorText *LabelText; 00163 vtkPolyDataMapper *LabelMapper; 00164 vtkFollower *LabelActor; 00165 00166 // Support internal operations 00167 bool LabelScaleSpecified; 00168 00169 // The 3D disk tick marks 00170 vtkPoints *GlyphPoints; 00171 vtkDoubleArray *GlyphVectors; 00172 vtkPolyData *GlyphPolyData; 00173 vtkCylinderSource *GlyphCylinder; 00174 vtkTransformPolyDataFilter *GlyphXForm; 00175 vtkGlyph3D *Glyph3D; 00176 vtkPolyDataMapper *GlyphMapper; 00177 vtkActor *GlyphActor; 00178 00179 // Glyph3D scale 00180 double GlyphScale; 00181 bool GlyphScaleSpecified; 00182 00183 // The distance between the two points 00184 double Distance; 00185 00186 // Support GetBounds() method 00187 vtkBox *BoundingBox; 00188 00189 // Maximum number of ticks on the 3d ruler 00190 int MaximumNumberOfRulerTicks; 00191 00192 // Label title position 00193 double LabelPosition; 00194 00195 private: 00196 vtkDistanceRepresentation3D(const vtkDistanceRepresentation3D&); //Not implemented 00197 void operator=(const vtkDistanceRepresentation3D&); //Not implemented 00198 00199 // Internal method to update the position of the label. 00200 void UpdateLabelPosition(); 00201 }; 00202 00203 #endif