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

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 =========================================================================*/
00083 #ifndef __vtkGlyph3D_h
00084 #define __vtkGlyph3D_h
00085 
00086 #include "vtkDataSetToPolyDataFilter.h"
00087 
00088 #define VTK_SCALE_BY_SCALAR 0
00089 #define VTK_SCALE_BY_VECTOR 1
00090 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
00091 #define VTK_DATA_SCALING_OFF 3
00092 
00093 #define VTK_COLOR_BY_SCALE  0
00094 #define VTK_COLOR_BY_SCALAR 1
00095 #define VTK_COLOR_BY_VECTOR 2
00096 
00097 #define VTK_USE_VECTOR 0
00098 #define VTK_USE_NORMAL 1
00099 #define VTK_VECTOR_ROTATION_OFF 2
00100 
00101 #define VTK_INDEXING_OFF 0
00102 #define VTK_INDEXING_BY_SCALAR 1
00103 #define VTK_INDEXING_BY_VECTOR 2
00104 
00105 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkDataSetToPolyDataFilter
00106 {
00107 public:
00108   vtkTypeRevisionMacro(vtkGlyph3D,vtkDataSetToPolyDataFilter);
00109   void PrintSelf(ostream& os, vtkIndent indent);
00110 
00115   static vtkGlyph3D *New();
00116 
00118 
00120   void SetNumberOfSources(int num);
00121   int GetNumberOfSources();
00123 
00125   void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
00126 
00128   void SetSource(int id, vtkPolyData *pd);
00129 
00131   vtkPolyData *GetSource(int id=0);
00132 
00134 
00135   vtkSetMacro(Scaling,int);
00136   vtkBooleanMacro(Scaling,int);
00137   vtkGetMacro(Scaling,int);
00139 
00141 
00142   vtkSetMacro(ScaleMode,int);
00143   vtkGetMacro(ScaleMode,int);
00144   void SetScaleModeToScaleByScalar() 
00145     {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
00146   void SetScaleModeToScaleByVector() 
00147     {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
00148   void SetScaleModeToScaleByVectorComponents()
00149     {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
00150   void SetScaleModeToDataScalingOff()
00151     {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
00152   const char *GetScaleModeAsString();
00154 
00156 
00157   vtkSetMacro(ColorMode,int);
00158   vtkGetMacro(ColorMode,int);
00159   void SetColorModeToColorByScale() 
00160     {this->SetColorMode(VTK_COLOR_BY_SCALE);};
00161   void SetColorModeToColorByScalar() 
00162     {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
00163   void SetColorModeToColorByVector() 
00164     {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
00165   const char *GetColorModeAsString();
00167 
00169 
00170   vtkSetMacro(ScaleFactor,float);
00171   vtkGetMacro(ScaleFactor,float);
00173 
00175 
00176   vtkSetVector2Macro(Range,float);
00177   vtkGetVectorMacro(Range,float,2);
00179 
00181 
00182   vtkSetMacro(Orient,int);
00183   vtkBooleanMacro(Orient,int);
00184   vtkGetMacro(Orient,int);
00186 
00188 
00190   vtkSetMacro(Clamping,int);
00191   vtkBooleanMacro(Clamping,int);
00192   vtkGetMacro(Clamping,int);
00194 
00196 
00197   vtkSetMacro(VectorMode,int);
00198   vtkGetMacro(VectorMode,int);
00199   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
00200   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
00201   void SetVectorModeToVectorRotationOff() 
00202     {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
00203   const char *GetVectorModeAsString();
00205 
00207 
00210   vtkSetMacro(IndexMode,int);
00211   vtkGetMacro(IndexMode,int);
00212   void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
00213   void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
00214   void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
00215   const char *GetIndexModeAsString();
00217 
00219 
00223   vtkSetMacro(GeneratePointIds,int);
00224   vtkGetMacro(GeneratePointIds,int);
00225   vtkBooleanMacro(GeneratePointIds,int);
00227 
00229 
00232   vtkSetStringMacro(PointIdsName);
00233   vtkGetStringMacro(PointIdsName);
00235 
00236 protected:
00237   vtkGlyph3D();
00238   ~vtkGlyph3D();
00239 
00240   void Execute();
00241   void ExecuteInformation();
00242   void ComputeInputUpdateExtents(vtkDataObject *output);
00243 
00244   int NumberOfSources; // Number of source objects
00245   vtkPolyData **Source; // Geometry to copy to each point
00246   int Scaling; // Determine whether scaling of geometry is performed
00247   int ScaleMode; // Scale by scalar value or vector magnitude
00248   int ColorMode; // new scalars based on scale, scalar or vector
00249   float ScaleFactor; // Scale factor to use to scale geometry
00250   float Range[2]; // Range to use to perform scalar scaling
00251   int Orient; // boolean controls whether to "orient" data
00252   int VectorMode; // Orient/scale via normal or via vector data
00253   int Clamping; // whether to clamp scale factor
00254   int IndexMode; // what to use to index into glyph table
00255   int GeneratePointIds; // produce input points ids for each output point
00256   char *PointIdsName;
00257 
00258   char *InputScalarsSelection;
00259   char *InputVectorsSelection;
00260   char *InputNormalsSelection;
00261   vtkSetStringMacro(InputScalarsSelection);
00262   vtkSetStringMacro(InputVectorsSelection);
00263   vtkSetStringMacro(InputNormalsSelection);
00264 
00265 private:
00266   vtkGlyph3D(const vtkGlyph3D&);  // Not implemented.
00267   void operator=(const vtkGlyph3D&);  // Not implemented.
00268 };
00269 
00271 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
00272 {
00273   if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
00274     {
00275     return "ScaleByScalar";
00276     }
00277   else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 
00278     {
00279     return "ScaleByVector";
00280     }
00281   else 
00282     {
00283     return "DataScalingOff";
00284     }
00285 }
00286 
00288 inline const char *vtkGlyph3D::GetColorModeAsString(void)
00289 {
00290   if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
00291     {
00292     return "ColorByScalar";
00293     }
00294   else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 
00295     {
00296     return "ColorByVector";
00297     }
00298   else 
00299     {
00300     return "ColorByScale";
00301     }
00302 }
00303 
00305 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
00306 {
00307   if ( this->VectorMode == VTK_USE_VECTOR) 
00308     {
00309     return "UseVector";
00310     }
00311   else if ( this->VectorMode == VTK_USE_NORMAL) 
00312     {
00313     return "UseNormal";
00314     }
00315   else 
00316     {
00317     return "VectorRotationOff";
00318     }
00319 }
00320 
00322 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
00323 {
00324   if ( this->IndexMode == VTK_INDEXING_OFF) 
00325     {
00326     return "IndexingOff";
00327     }
00328   else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 
00329     {
00330     return "IndexingByScalar";
00331     }
00332   else 
00333     {
00334     return "IndexingByVector";
00335     }
00336 }
00337 
00338 #endif