VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGlyph3D.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 =========================================================================*/ 00085 #ifndef __vtkGlyph3D_h 00086 #define __vtkGlyph3D_h 00087 00088 #include "vtkFiltersCoreModule.h" // For export macro 00089 #include "vtkPolyDataAlgorithm.h" 00090 00091 #define VTK_SCALE_BY_SCALAR 0 00092 #define VTK_SCALE_BY_VECTOR 1 00093 #define VTK_SCALE_BY_VECTORCOMPONENTS 2 00094 #define VTK_DATA_SCALING_OFF 3 00095 00096 #define VTK_COLOR_BY_SCALE 0 00097 #define VTK_COLOR_BY_SCALAR 1 00098 #define VTK_COLOR_BY_VECTOR 2 00099 00100 #define VTK_USE_VECTOR 0 00101 #define VTK_USE_NORMAL 1 00102 #define VTK_VECTOR_ROTATION_OFF 2 00103 00104 #define VTK_INDEXING_OFF 0 00105 #define VTK_INDEXING_BY_SCALAR 1 00106 #define VTK_INDEXING_BY_VECTOR 2 00107 00108 class vtkTransform; 00109 00110 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm 00111 { 00112 public: 00113 vtkTypeMacro(vtkGlyph3D,vtkPolyDataAlgorithm); 00114 void PrintSelf(ostream& os, vtkIndent indent); 00115 00120 static vtkGlyph3D *New(); 00121 00124 void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);}; 00125 00128 void SetSourceData(int id, vtkPolyData *pd); 00129 00131 00134 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput); 00135 void SetSourceConnection(vtkAlgorithmOutput* algOutput) 00136 { 00137 this->SetSourceConnection(0, algOutput); 00138 } 00140 00142 vtkPolyData *GetSource(int id=0); 00143 00145 00146 vtkSetMacro(Scaling,int); 00147 vtkBooleanMacro(Scaling,int); 00148 vtkGetMacro(Scaling,int); 00150 00152 00153 vtkSetMacro(ScaleMode,int); 00154 vtkGetMacro(ScaleMode,int); 00155 void SetScaleModeToScaleByScalar() 00156 {this->SetScaleMode(VTK_SCALE_BY_SCALAR);}; 00157 void SetScaleModeToScaleByVector() 00158 {this->SetScaleMode(VTK_SCALE_BY_VECTOR);}; 00159 void SetScaleModeToScaleByVectorComponents() 00160 {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);}; 00161 void SetScaleModeToDataScalingOff() 00162 {this->SetScaleMode(VTK_DATA_SCALING_OFF);}; 00163 const char *GetScaleModeAsString(); 00165 00167 00168 vtkSetMacro(ColorMode,int); 00169 vtkGetMacro(ColorMode,int); 00170 void SetColorModeToColorByScale() 00171 {this->SetColorMode(VTK_COLOR_BY_SCALE);}; 00172 void SetColorModeToColorByScalar() 00173 {this->SetColorMode(VTK_COLOR_BY_SCALAR);}; 00174 void SetColorModeToColorByVector() 00175 {this->SetColorMode(VTK_COLOR_BY_VECTOR);}; 00176 const char *GetColorModeAsString(); 00178 00180 00181 vtkSetMacro(ScaleFactor,double); 00182 vtkGetMacro(ScaleFactor,double); 00184 00186 00187 vtkSetVector2Macro(Range,double); 00188 vtkGetVectorMacro(Range,double,2); 00190 00192 00193 vtkSetMacro(Orient,int); 00194 vtkBooleanMacro(Orient,int); 00195 vtkGetMacro(Orient,int); 00197 00199 00201 vtkSetMacro(Clamping,int); 00202 vtkBooleanMacro(Clamping,int); 00203 vtkGetMacro(Clamping,int); 00205 00207 00208 vtkSetMacro(VectorMode,int); 00209 vtkGetMacro(VectorMode,int); 00210 void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);}; 00211 void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);}; 00212 void SetVectorModeToVectorRotationOff() 00213 {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);}; 00214 const char *GetVectorModeAsString(); 00216 00218 00224 vtkSetMacro(IndexMode,int); 00225 vtkGetMacro(IndexMode,int); 00226 void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);}; 00227 void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);}; 00228 void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);}; 00229 const char *GetIndexModeAsString(); 00231 00233 00237 vtkSetMacro(GeneratePointIds,int); 00238 vtkGetMacro(GeneratePointIds,int); 00239 vtkBooleanMacro(GeneratePointIds,int); 00241 00243 00246 vtkSetStringMacro(PointIdsName); 00247 vtkGetStringMacro(PointIdsName); 00249 00251 00254 vtkSetMacro(FillCellData,int); 00255 vtkGetMacro(FillCellData,int); 00256 vtkBooleanMacro(FillCellData,int); 00258 00261 virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;}; 00262 00264 00267 void SetSourceTransform(vtkTransform*); 00268 vtkGetObjectMacro(SourceTransform, vtkTransform); 00270 00272 virtual unsigned long GetMTime(); 00273 00274 protected: 00275 vtkGlyph3D(); 00276 ~vtkGlyph3D(); 00277 00278 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00279 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00280 virtual int FillInputPortInformation(int, vtkInformation *); 00281 00282 vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo); 00283 00284 vtkPolyData **Source; // Geometry to copy to each point 00285 int Scaling; // Determine whether scaling of geometry is performed 00286 int ScaleMode; // Scale by scalar value or vector magnitude 00287 int ColorMode; // new scalars based on scale, scalar or vector 00288 double ScaleFactor; // Scale factor to use to scale geometry 00289 double Range[2]; // Range to use to perform scalar scaling 00290 int Orient; // boolean controls whether to "orient" data 00291 int VectorMode; // Orient/scale via normal or via vector data 00292 int Clamping; // whether to clamp scale factor 00293 int IndexMode; // what to use to index into glyph table 00294 int GeneratePointIds; // produce input points ids for each output point 00295 int FillCellData; // whether to fill output cell data 00296 char *PointIdsName; 00297 vtkTransform* SourceTransform; 00298 00299 private: 00300 vtkGlyph3D(const vtkGlyph3D&); // Not implemented. 00301 void operator=(const vtkGlyph3D&); // Not implemented. 00302 }; 00303 00305 00306 inline const char *vtkGlyph3D::GetScaleModeAsString(void) 00307 { 00308 if ( this->ScaleMode == VTK_SCALE_BY_SCALAR ) 00309 { 00310 return "ScaleByScalar"; 00311 } 00312 else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 00313 { 00314 return "ScaleByVector"; 00315 } 00316 else 00317 { 00318 return "DataScalingOff"; 00319 } 00320 } 00322 00324 00325 inline const char *vtkGlyph3D::GetColorModeAsString(void) 00326 { 00327 if ( this->ColorMode == VTK_COLOR_BY_SCALAR ) 00328 { 00329 return "ColorByScalar"; 00330 } 00331 else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 00332 { 00333 return "ColorByVector"; 00334 } 00335 else 00336 { 00337 return "ColorByScale"; 00338 } 00339 } 00341 00343 00344 inline const char *vtkGlyph3D::GetVectorModeAsString(void) 00345 { 00346 if ( this->VectorMode == VTK_USE_VECTOR) 00347 { 00348 return "UseVector"; 00349 } 00350 else if ( this->VectorMode == VTK_USE_NORMAL) 00351 { 00352 return "UseNormal"; 00353 } 00354 else 00355 { 00356 return "VectorRotationOff"; 00357 } 00358 } 00360 00362 00363 inline const char *vtkGlyph3D::GetIndexModeAsString(void) 00364 { 00365 if ( this->IndexMode == VTK_INDEXING_OFF) 00366 { 00367 return "IndexingOff"; 00368 } 00369 else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 00370 { 00371 return "IndexingByScalar"; 00372 } 00373 else 00374 { 00375 return "IndexingByVector"; 00376 } 00377 } 00379 00380 #endif