Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00096 #ifndef __vtkGlyph3D_h
00097 #define __vtkGlyph3D_h
00098 
00099 #include "vtkDataSetToPolyDataFilter.h"
00100 
00101 #define VTK_SCALE_BY_SCALAR 0
00102 #define VTK_SCALE_BY_VECTOR 1
00103 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
00104 #define VTK_DATA_SCALING_OFF 3
00105 
00106 #define VTK_COLOR_BY_SCALE  0
00107 #define VTK_COLOR_BY_SCALAR 1
00108 #define VTK_COLOR_BY_VECTOR 2
00109 
00110 #define VTK_USE_VECTOR 0
00111 #define VTK_USE_NORMAL 1
00112 #define VTK_VECTOR_ROTATION_OFF 2
00113 
00114 #define VTK_INDEXING_OFF 0
00115 #define VTK_INDEXING_BY_SCALAR 1
00116 #define VTK_INDEXING_BY_VECTOR 2
00117 
00118 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkDataSetToPolyDataFilter
00119 {
00120 public:
00121   vtkTypeRevisionMacro(vtkGlyph3D,vtkDataSetToPolyDataFilter);
00122   void PrintSelf(ostream& os, vtkIndent indent);
00123 
00128   static vtkGlyph3D *New();
00129 
00131 
00133   void SetNumberOfSources(int num);
00134   int GetNumberOfSources();
00136 
00138   void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
00139 
00141   void SetSource(int id, vtkPolyData *pd);
00142 
00144   vtkPolyData *GetSource(int id=0);
00145 
00147 
00148   vtkSetMacro(Scaling,int);
00149   vtkBooleanMacro(Scaling,int);
00150   vtkGetMacro(Scaling,int);
00152 
00154 
00155   vtkSetMacro(ScaleMode,int);
00156   vtkGetMacro(ScaleMode,int);
00157   void SetScaleModeToScaleByScalar() 
00158     {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
00159   void SetScaleModeToScaleByVector() 
00160     {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
00161   void SetScaleModeToScaleByVectorComponents()
00162     {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
00163   void SetScaleModeToDataScalingOff()
00164     {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
00165   const char *GetScaleModeAsString();
00167 
00169 
00170   vtkSetMacro(ColorMode,int);
00171   vtkGetMacro(ColorMode,int);
00172   void SetColorModeToColorByScale() 
00173     {this->SetColorMode(VTK_COLOR_BY_SCALE);};
00174   void SetColorModeToColorByScalar() 
00175     {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
00176   void SetColorModeToColorByVector() 
00177     {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
00178   const char *GetColorModeAsString();
00180 
00182 
00183   vtkSetMacro(ScaleFactor,float);
00184   vtkGetMacro(ScaleFactor,float);
00186 
00188 
00189   vtkSetVector2Macro(Range,float);
00190   vtkGetVectorMacro(Range,float,2);
00192 
00194 
00195   vtkSetMacro(Orient,int);
00196   vtkBooleanMacro(Orient,int);
00197   vtkGetMacro(Orient,int);
00199 
00201 
00203   vtkSetMacro(Clamping,int);
00204   vtkBooleanMacro(Clamping,int);
00205   vtkGetMacro(Clamping,int);
00207 
00209 
00210   vtkSetMacro(VectorMode,int);
00211   vtkGetMacro(VectorMode,int);
00212   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
00213   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
00214   void SetVectorModeToVectorRotationOff() 
00215     {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
00216   const char *GetVectorModeAsString();
00218 
00220 
00223   vtkSetMacro(IndexMode,int);
00224   vtkGetMacro(IndexMode,int);
00225   void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
00226   void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
00227   void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
00228   const char *GetIndexModeAsString();
00230 
00232 
00236   vtkSetMacro(GeneratePointIds,int);
00237   vtkGetMacro(GeneratePointIds,int);
00238   vtkBooleanMacro(GeneratePointIds,int);
00240 
00242 
00245   vtkSetStringMacro(PointIdsName);
00246   vtkGetStringMacro(PointIdsName);
00248 
00249 protected:
00250   vtkGlyph3D();
00251   ~vtkGlyph3D();
00252 
00253   void Execute();
00254   void ExecuteInformation();
00255   void ComputeInputUpdateExtents(vtkDataObject *output);
00256 
00257   int NumberOfSources; // Number of source objects
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   float ScaleFactor; // Scale factor to use to scale geometry
00263   float 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   char *InputScalarsSelection;
00272   char *InputVectorsSelection;
00273   char *InputNormalsSelection;
00274   vtkSetStringMacro(InputScalarsSelection);
00275   vtkSetStringMacro(InputVectorsSelection);
00276   vtkSetStringMacro(InputNormalsSelection);
00277 
00278 private:
00279   vtkGlyph3D(const vtkGlyph3D&);  // Not implemented.
00280   void operator=(const vtkGlyph3D&);  // Not implemented.
00281 };
00282 
00284 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
00285 {
00286   if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
00287     {
00288     return "ScaleByScalar";
00289     }
00290   else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 
00291     {
00292     return "ScaleByVector";
00293     }
00294   else 
00295     {
00296     return "DataScalingOff";
00297     }
00298 }
00299 
00301 inline const char *vtkGlyph3D::GetColorModeAsString(void)
00302 {
00303   if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
00304     {
00305     return "ColorByScalar";
00306     }
00307   else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 
00308     {
00309     return "ColorByVector";
00310     }
00311   else 
00312     {
00313     return "ColorByScale";
00314     }
00315 }
00316 
00318 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
00319 {
00320   if ( this->VectorMode == VTK_USE_VECTOR) 
00321     {
00322     return "UseVector";
00323     }
00324   else if ( this->VectorMode == VTK_USE_NORMAL) 
00325     {
00326     return "UseNormal";
00327     }
00328   else 
00329     {
00330     return "VectorRotationOff";
00331     }
00332 }
00333 
00335 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
00336 {
00337   if ( this->IndexMode == VTK_INDEXING_OFF) 
00338     {
00339     return "IndexingOff";
00340     }
00341   else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 
00342     {
00343     return "IndexingByScalar";
00344     }
00345   else 
00346     {
00347     return "IndexingByVector";
00348     }
00349 }
00350 
00351 #endif