Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Graphics/vtkGlyph3D.h

Go to the documentation of this file.
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 =========================================================================*/
00079 #ifndef __vtkGlyph3D_h
00080 #define __vtkGlyph3D_h
00081 
00082 #include "vtkDataSetToPolyDataFilter.h"
00083 
00084 #define VTK_SCALE_BY_SCALAR 0
00085 #define VTK_SCALE_BY_VECTOR 1
00086 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
00087 #define VTK_DATA_SCALING_OFF 3
00088 
00089 #define VTK_COLOR_BY_SCALE  0
00090 #define VTK_COLOR_BY_SCALAR 1
00091 #define VTK_COLOR_BY_VECTOR 2
00092 
00093 #define VTK_USE_VECTOR 0
00094 #define VTK_USE_NORMAL 1
00095 #define VTK_VECTOR_ROTATION_OFF 2
00096 
00097 #define VTK_INDEXING_OFF 0
00098 #define VTK_INDEXING_BY_SCALAR 1
00099 #define VTK_INDEXING_BY_VECTOR 2
00100 
00101 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkDataSetToPolyDataFilter
00102 {
00103 public:
00104   vtkTypeRevisionMacro(vtkGlyph3D,vtkDataSetToPolyDataFilter);
00105   void PrintSelf(ostream& os, vtkIndent indent);
00106 
00111   static vtkGlyph3D *New();
00112 
00114 
00116   void SetNumberOfSources(int num);
00117   int GetNumberOfSources();
00119 
00121   void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
00122 
00124   void SetSource(int id, vtkPolyData *pd);
00125 
00127   vtkPolyData *GetSource(int id=0);
00128 
00130 
00131   vtkSetMacro(Scaling,int);
00132   vtkBooleanMacro(Scaling,int);
00133   vtkGetMacro(Scaling,int);
00135 
00137 
00138   vtkSetMacro(ScaleMode,int);
00139   vtkGetMacro(ScaleMode,int);
00140   void SetScaleModeToScaleByScalar() 
00141     {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
00142   void SetScaleModeToScaleByVector() 
00143     {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
00144   void SetScaleModeToScaleByVectorComponents()
00145     {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
00146   void SetScaleModeToDataScalingOff()
00147     {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
00148   const char *GetScaleModeAsString();
00150 
00152 
00153   vtkSetMacro(ColorMode,int);
00154   vtkGetMacro(ColorMode,int);
00155   void SetColorModeToColorByScale() 
00156     {this->SetColorMode(VTK_COLOR_BY_SCALE);};
00157   void SetColorModeToColorByScalar() 
00158     {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
00159   void SetColorModeToColorByVector() 
00160     {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
00161   const char *GetColorModeAsString();
00163 
00165 
00166   vtkSetMacro(ScaleFactor,double);
00167   vtkGetMacro(ScaleFactor,double);
00169 
00171 
00172   vtkSetVector2Macro(Range,double);
00173   vtkGetVectorMacro(Range,double,2);
00175 
00177 
00178   vtkSetMacro(Orient,int);
00179   vtkBooleanMacro(Orient,int);
00180   vtkGetMacro(Orient,int);
00182 
00184 
00186   vtkSetMacro(Clamping,int);
00187   vtkBooleanMacro(Clamping,int);
00188   vtkGetMacro(Clamping,int);
00190 
00192 
00193   vtkSetMacro(VectorMode,int);
00194   vtkGetMacro(VectorMode,int);
00195   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
00196   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
00197   void SetVectorModeToVectorRotationOff() 
00198     {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
00199   const char *GetVectorModeAsString();
00201 
00203 
00206   vtkSetMacro(IndexMode,int);
00207   vtkGetMacro(IndexMode,int);
00208   void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
00209   void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
00210   void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
00211   const char *GetIndexModeAsString();
00213 
00215 
00219   vtkSetMacro(GeneratePointIds,int);
00220   vtkGetMacro(GeneratePointIds,int);
00221   vtkBooleanMacro(GeneratePointIds,int);
00223 
00225 
00228   vtkSetStringMacro(PointIdsName);
00229   vtkGetStringMacro(PointIdsName);
00231 
00233 
00236   vtkGetStringMacro(InputScalarsSelection);
00237   void SelectInputScalars(const char *fieldName) 
00238     {this->SetInputScalarsSelection(fieldName);}
00240 
00242 
00245   vtkGetStringMacro(InputVectorsSelection);
00246   void SelectInputVectors(const char *fieldName) 
00247     {this->SetInputVectorsSelection(fieldName);}
00249 
00251 
00254   vtkGetStringMacro(InputNormalsSelection);
00255   void SelectInputNormals(const char *fieldName) 
00256     {this->SetInputNormalsSelection(fieldName);}
00258 
00259 protected:
00260   vtkGlyph3D();
00261   ~vtkGlyph3D();
00262 
00263   void Execute();
00264   void ExecuteInformation();
00265   void ComputeInputUpdateExtents(vtkDataObject *output);
00266 
00267   int NumberOfSources; // Number of source objects
00268   vtkPolyData **Source; // Geometry to copy to each point
00269   int Scaling; // Determine whether scaling of geometry is performed
00270   int ScaleMode; // Scale by scalar value or vector magnitude
00271   int ColorMode; // new scalars based on scale, scalar or vector
00272   double ScaleFactor; // Scale factor to use to scale geometry
00273   double Range[2]; // Range to use to perform scalar scaling
00274   int Orient; // boolean controls whether to "orient" data
00275   int VectorMode; // Orient/scale via normal or via vector data
00276   int Clamping; // whether to clamp scale factor
00277   int IndexMode; // what to use to index into glyph table
00278   int GeneratePointIds; // produce input points ids for each output point
00279   char *PointIdsName;
00280 
00281   char *InputScalarsSelection;
00282   char *InputVectorsSelection;
00283   char *InputNormalsSelection;
00284   vtkSetStringMacro(InputScalarsSelection);
00285   vtkSetStringMacro(InputVectorsSelection);
00286   vtkSetStringMacro(InputNormalsSelection);
00287 
00288 private:
00289   vtkGlyph3D(const vtkGlyph3D&);  // Not implemented.
00290   void operator=(const vtkGlyph3D&);  // Not implemented.
00291 };
00292 
00294 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
00295 {
00296   if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
00297     {
00298     return "ScaleByScalar";
00299     }
00300   else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 
00301     {
00302     return "ScaleByVector";
00303     }
00304   else 
00305     {
00306     return "DataScalingOff";
00307     }
00308 }
00309 
00311 inline const char *vtkGlyph3D::GetColorModeAsString(void)
00312 {
00313   if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
00314     {
00315     return "ColorByScalar";
00316     }
00317   else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 
00318     {
00319     return "ColorByVector";
00320     }
00321   else 
00322     {
00323     return "ColorByScale";
00324     }
00325 }
00326 
00328 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
00329 {
00330   if ( this->VectorMode == VTK_USE_VECTOR) 
00331     {
00332     return "UseVector";
00333     }
00334   else if ( this->VectorMode == VTK_USE_NORMAL) 
00335     {
00336     return "UseNormal";
00337     }
00338   else 
00339     {
00340     return "VectorRotationOff";
00341     }
00342 }
00343 
00345 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
00346 {
00347   if ( this->IndexMode == VTK_INDEXING_OFF) 
00348     {
00349     return "IndexingOff";
00350     }
00351   else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 
00352     {
00353     return "IndexingByScalar";
00354     }
00355   else 
00356     {
00357     return "IndexingByVector";
00358     }
00359 }
00360 
00361 #endif