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 00126 void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);}; 00127 00132 void SetSourceData(int id, vtkPolyData *pd); 00133 00135 00138 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput); 00139 void SetSourceConnection(vtkAlgorithmOutput* algOutput) 00140 { 00141 this->SetSourceConnection(0, algOutput); 00142 } 00144 00146 vtkPolyData *GetSource(int id=0); 00147 00149 00150 vtkSetMacro(Scaling,int); 00151 vtkBooleanMacro(Scaling,int); 00152 vtkGetMacro(Scaling,int); 00154 00156 00157 vtkSetMacro(ScaleMode,int); 00158 vtkGetMacro(ScaleMode,int); 00159 void SetScaleModeToScaleByScalar() 00160 {this->SetScaleMode(VTK_SCALE_BY_SCALAR);}; 00161 void SetScaleModeToScaleByVector() 00162 {this->SetScaleMode(VTK_SCALE_BY_VECTOR);}; 00163 void SetScaleModeToScaleByVectorComponents() 00164 {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);}; 00165 void SetScaleModeToDataScalingOff() 00166 {this->SetScaleMode(VTK_DATA_SCALING_OFF);}; 00167 const char *GetScaleModeAsString(); 00169 00171 00172 vtkSetMacro(ColorMode,int); 00173 vtkGetMacro(ColorMode,int); 00174 void SetColorModeToColorByScale() 00175 {this->SetColorMode(VTK_COLOR_BY_SCALE);}; 00176 void SetColorModeToColorByScalar() 00177 {this->SetColorMode(VTK_COLOR_BY_SCALAR);}; 00178 void SetColorModeToColorByVector() 00179 {this->SetColorMode(VTK_COLOR_BY_VECTOR);}; 00180 const char *GetColorModeAsString(); 00182 00184 00185 vtkSetMacro(ScaleFactor,double); 00186 vtkGetMacro(ScaleFactor,double); 00188 00190 00191 vtkSetVector2Macro(Range,double); 00192 vtkGetVectorMacro(Range,double,2); 00194 00196 00197 vtkSetMacro(Orient,int); 00198 vtkBooleanMacro(Orient,int); 00199 vtkGetMacro(Orient,int); 00201 00203 00205 vtkSetMacro(Clamping,int); 00206 vtkBooleanMacro(Clamping,int); 00207 vtkGetMacro(Clamping,int); 00209 00211 00212 vtkSetMacro(VectorMode,int); 00213 vtkGetMacro(VectorMode,int); 00214 void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);}; 00215 void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);}; 00216 void SetVectorModeToVectorRotationOff() 00217 {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);}; 00218 const char *GetVectorModeAsString(); 00220 00222 00228 vtkSetMacro(IndexMode,int); 00229 vtkGetMacro(IndexMode,int); 00230 void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);}; 00231 void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);}; 00232 void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);}; 00233 const char *GetIndexModeAsString(); 00235 00237 00241 vtkSetMacro(GeneratePointIds,int); 00242 vtkGetMacro(GeneratePointIds,int); 00243 vtkBooleanMacro(GeneratePointIds,int); 00245 00247 00250 vtkSetStringMacro(PointIdsName); 00251 vtkGetStringMacro(PointIdsName); 00253 00255 00258 vtkSetMacro(FillCellData,int); 00259 vtkGetMacro(FillCellData,int); 00260 vtkBooleanMacro(FillCellData,int); 00262 00265 virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;}; 00266 00268 00271 void SetSourceTransform(vtkTransform*); 00272 vtkGetObjectMacro(SourceTransform, vtkTransform); 00274 00276 virtual unsigned long GetMTime(); 00277 00278 protected: 00279 vtkGlyph3D(); 00280 ~vtkGlyph3D(); 00281 00282 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00283 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00284 virtual int FillInputPortInformation(int, vtkInformation *); 00285 00286 vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo); 00287 00289 00292 virtual bool Execute(vtkDataSet* input, 00293 vtkInformationVector* sourceVector, 00294 vtkPolyData* output, int requestedGhostLevel); 00296 00297 vtkPolyData **Source; // Geometry to copy to each point 00298 int Scaling; // Determine whether scaling of geometry is performed 00299 int ScaleMode; // Scale by scalar value or vector magnitude 00300 int ColorMode; // new scalars based on scale, scalar or vector 00301 double ScaleFactor; // Scale factor to use to scale geometry 00302 double Range[2]; // Range to use to perform scalar scaling 00303 int Orient; // boolean controls whether to "orient" data 00304 int VectorMode; // Orient/scale via normal or via vector data 00305 int Clamping; // whether to clamp scale factor 00306 int IndexMode; // what to use to index into glyph table 00307 int GeneratePointIds; // produce input points ids for each output point 00308 int FillCellData; // whether to fill output cell data 00309 char *PointIdsName; 00310 vtkTransform* SourceTransform; 00311 00312 private: 00313 vtkGlyph3D(const vtkGlyph3D&); // Not implemented. 00314 void operator=(const vtkGlyph3D&); // Not implemented. 00315 }; 00316 00318 00319 inline const char *vtkGlyph3D::GetScaleModeAsString(void) 00320 { 00321 if ( this->ScaleMode == VTK_SCALE_BY_SCALAR ) 00322 { 00323 return "ScaleByScalar"; 00324 } 00325 else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 00326 { 00327 return "ScaleByVector"; 00328 } 00329 else 00330 { 00331 return "DataScalingOff"; 00332 } 00333 } 00335 00337 00338 inline const char *vtkGlyph3D::GetColorModeAsString(void) 00339 { 00340 if ( this->ColorMode == VTK_COLOR_BY_SCALAR ) 00341 { 00342 return "ColorByScalar"; 00343 } 00344 else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 00345 { 00346 return "ColorByVector"; 00347 } 00348 else 00349 { 00350 return "ColorByScale"; 00351 } 00352 } 00354 00356 00357 inline const char *vtkGlyph3D::GetVectorModeAsString(void) 00358 { 00359 if ( this->VectorMode == VTK_USE_VECTOR) 00360 { 00361 return "UseVector"; 00362 } 00363 else if ( this->VectorMode == VTK_USE_NORMAL) 00364 { 00365 return "UseNormal"; 00366 } 00367 else 00368 { 00369 return "VectorRotationOff"; 00370 } 00371 } 00373 00375 00376 inline const char *vtkGlyph3D::GetIndexModeAsString(void) 00377 { 00378 if ( this->IndexMode == VTK_INDEXING_OFF) 00379 { 00380 return "IndexingOff"; 00381 } 00382 else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 00383 { 00384 return "IndexingByScalar"; 00385 } 00386 else 00387 { 00388 return "IndexingByVector"; 00389 } 00390 } 00392 00393 #endif