VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkGlyph3D.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 =========================================================================*/ 00082 #ifndef __vtkGlyph3D_h 00083 #define __vtkGlyph3D_h 00084 00085 #include "vtkPolyDataAlgorithm.h" 00086 00087 #define VTK_SCALE_BY_SCALAR 0 00088 #define VTK_SCALE_BY_VECTOR 1 00089 #define VTK_SCALE_BY_VECTORCOMPONENTS 2 00090 #define VTK_DATA_SCALING_OFF 3 00091 00092 #define VTK_COLOR_BY_SCALE 0 00093 #define VTK_COLOR_BY_SCALAR 1 00094 #define VTK_COLOR_BY_VECTOR 2 00095 00096 #define VTK_USE_VECTOR 0 00097 #define VTK_USE_NORMAL 1 00098 #define VTK_VECTOR_ROTATION_OFF 2 00099 00100 #define VTK_INDEXING_OFF 0 00101 #define VTK_INDEXING_BY_SCALAR 1 00102 #define VTK_INDEXING_BY_VECTOR 2 00103 00104 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm 00105 { 00106 public: 00107 vtkTypeRevisionMacro(vtkGlyph3D,vtkPolyDataAlgorithm); 00108 void PrintSelf(ostream& os, vtkIndent indent); 00109 00114 static vtkGlyph3D *New(); 00115 00118 void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);}; 00119 00122 void SetSource(int id, vtkPolyData *pd); 00123 00125 00128 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput); 00129 void SetSourceConnection(vtkAlgorithmOutput* algOutput) 00130 { 00131 this->SetSourceConnection(0, algOutput); 00132 } 00134 00136 vtkPolyData *GetSource(int id=0); 00137 00139 00140 vtkSetMacro(Scaling,int); 00141 vtkBooleanMacro(Scaling,int); 00142 vtkGetMacro(Scaling,int); 00144 00146 00147 vtkSetMacro(ScaleMode,int); 00148 vtkGetMacro(ScaleMode,int); 00149 void SetScaleModeToScaleByScalar() 00150 {this->SetScaleMode(VTK_SCALE_BY_SCALAR);}; 00151 void SetScaleModeToScaleByVector() 00152 {this->SetScaleMode(VTK_SCALE_BY_VECTOR);}; 00153 void SetScaleModeToScaleByVectorComponents() 00154 {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);}; 00155 void SetScaleModeToDataScalingOff() 00156 {this->SetScaleMode(VTK_DATA_SCALING_OFF);}; 00157 const char *GetScaleModeAsString(); 00159 00161 00162 vtkSetMacro(ColorMode,int); 00163 vtkGetMacro(ColorMode,int); 00164 void SetColorModeToColorByScale() 00165 {this->SetColorMode(VTK_COLOR_BY_SCALE);}; 00166 void SetColorModeToColorByScalar() 00167 {this->SetColorMode(VTK_COLOR_BY_SCALAR);}; 00168 void SetColorModeToColorByVector() 00169 {this->SetColorMode(VTK_COLOR_BY_VECTOR);}; 00170 const char *GetColorModeAsString(); 00172 00174 00175 vtkSetMacro(ScaleFactor,double); 00176 vtkGetMacro(ScaleFactor,double); 00178 00180 00181 vtkSetVector2Macro(Range,double); 00182 vtkGetVectorMacro(Range,double,2); 00184 00186 00187 vtkSetMacro(Orient,int); 00188 vtkBooleanMacro(Orient,int); 00189 vtkGetMacro(Orient,int); 00191 00193 00195 vtkSetMacro(Clamping,int); 00196 vtkBooleanMacro(Clamping,int); 00197 vtkGetMacro(Clamping,int); 00199 00201 00202 vtkSetMacro(VectorMode,int); 00203 vtkGetMacro(VectorMode,int); 00204 void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);}; 00205 void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);}; 00206 void SetVectorModeToVectorRotationOff() 00207 {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);}; 00208 const char *GetVectorModeAsString(); 00210 00212 00218 vtkSetMacro(IndexMode,int); 00219 vtkGetMacro(IndexMode,int); 00220 void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);}; 00221 void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);}; 00222 void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);}; 00223 const char *GetIndexModeAsString(); 00225 00227 00231 vtkSetMacro(GeneratePointIds,int); 00232 vtkGetMacro(GeneratePointIds,int); 00233 vtkBooleanMacro(GeneratePointIds,int); 00235 00237 00240 vtkSetStringMacro(PointIdsName); 00241 vtkGetStringMacro(PointIdsName); 00243 00246 virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;}; 00247 00248 protected: 00249 vtkGlyph3D(); 00250 ~vtkGlyph3D(); 00251 00252 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00253 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00254 virtual int FillInputPortInformation(int, vtkInformation *); 00255 00256 vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo); 00257 00258 vtkPolyData **Source; // Geometry to copy to each point 00259 int Scaling; // Determine whether scaling of geometry is performed 00260 int ScaleMode; // Scale by scalar value or vector magnitude 00261 int ColorMode; // new scalars based on scale, scalar or vector 00262 double ScaleFactor; // Scale factor to use to scale geometry 00263 double Range[2]; // Range to use to perform scalar scaling 00264 int Orient; // boolean controls whether to "orient" data 00265 int VectorMode; // Orient/scale via normal or via vector data 00266 int Clamping; // whether to clamp scale factor 00267 int IndexMode; // what to use to index into glyph table 00268 int GeneratePointIds; // produce input points ids for each output point 00269 char *PointIdsName; 00270 00271 private: 00272 vtkGlyph3D(const vtkGlyph3D&); // Not implemented. 00273 void operator=(const vtkGlyph3D&); // Not implemented. 00274 }; 00275 00277 inline const char *vtkGlyph3D::GetScaleModeAsString(void) 00278 { 00279 if ( this->ScaleMode == VTK_SCALE_BY_SCALAR ) 00280 { 00281 return "ScaleByScalar"; 00282 } 00283 else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 00284 { 00285 return "ScaleByVector"; 00286 } 00287 else 00288 { 00289 return "DataScalingOff"; 00290 } 00291 } 00292 00294 inline const char *vtkGlyph3D::GetColorModeAsString(void) 00295 { 00296 if ( this->ColorMode == VTK_COLOR_BY_SCALAR ) 00297 { 00298 return "ColorByScalar"; 00299 } 00300 else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 00301 { 00302 return "ColorByVector"; 00303 } 00304 else 00305 { 00306 return "ColorByScale"; 00307 } 00308 } 00309 00311 inline const char *vtkGlyph3D::GetVectorModeAsString(void) 00312 { 00313 if ( this->VectorMode == VTK_USE_VECTOR) 00314 { 00315 return "UseVector"; 00316 } 00317 else if ( this->VectorMode == VTK_USE_NORMAL) 00318 { 00319 return "UseNormal"; 00320 } 00321 else 00322 { 00323 return "VectorRotationOff"; 00324 } 00325 } 00326 00328 inline const char *vtkGlyph3D::GetIndexModeAsString(void) 00329 { 00330 if ( this->IndexMode == VTK_INDEXING_OFF) 00331 { 00332 return "IndexingOff"; 00333 } 00334 else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 00335 { 00336 return "IndexingByScalar"; 00337 } 00338 else 00339 { 00340 return "IndexingByVector"; 00341 } 00342 } 00343 00344 #endif