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   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 =========================================================================*/
00097 #ifndef __vtkGlyph3D_h
00098 #define __vtkGlyph3D_h
00099 
00100 #include "vtkDataSetToPolyDataFilter.h"
00101 
00102 #define VTK_SCALE_BY_SCALAR 0
00103 #define VTK_SCALE_BY_VECTOR 1
00104 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
00105 #define VTK_DATA_SCALING_OFF 3
00106 
00107 #define VTK_COLOR_BY_SCALE  0
00108 #define VTK_COLOR_BY_SCALAR 1
00109 #define VTK_COLOR_BY_VECTOR 2
00110 
00111 #define VTK_USE_VECTOR 0
00112 #define VTK_USE_NORMAL 1
00113 #define VTK_VECTOR_ROTATION_OFF 2
00114 
00115 #define VTK_INDEXING_OFF 0
00116 #define VTK_INDEXING_BY_SCALAR 1
00117 #define VTK_INDEXING_BY_VECTOR 2
00118 
00119 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkDataSetToPolyDataFilter
00120 {
00121 public:
00122   vtkTypeRevisionMacro(vtkGlyph3D,vtkDataSetToPolyDataFilter);
00123   void PrintSelf(ostream& os, vtkIndent indent);
00124 
00129   static vtkGlyph3D *New();
00130 
00132 
00134   void SetNumberOfSources(int num);
00135   int GetNumberOfSources();
00137 
00139   void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
00140 
00142   void SetSource(int id, vtkPolyData *pd);
00143 
00145   vtkPolyData *GetSource(int id=0);
00146 
00148 
00149   vtkSetMacro(Scaling,int);
00150   vtkBooleanMacro(Scaling,int);
00151   vtkGetMacro(Scaling,int);
00153 
00155 
00156   vtkSetMacro(ScaleMode,int);
00157   vtkGetMacro(ScaleMode,int);
00158   void SetScaleModeToScaleByScalar() 
00159     {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
00160   void SetScaleModeToScaleByVector() 
00161     {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
00162   void SetScaleModeToScaleByVectorComponents()
00163     {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
00164   void SetScaleModeToDataScalingOff()
00165     {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
00166   const char *GetScaleModeAsString();
00168 
00170 
00171   vtkSetMacro(ColorMode,int);
00172   vtkGetMacro(ColorMode,int);
00173   void SetColorModeToColorByScale() 
00174     {this->SetColorMode(VTK_COLOR_BY_SCALE);};
00175   void SetColorModeToColorByScalar() 
00176     {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
00177   void SetColorModeToColorByVector() 
00178     {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
00179   const char *GetColorModeAsString();
00181 
00183 
00184   vtkSetMacro(ScaleFactor,float);
00185   vtkGetMacro(ScaleFactor,float);
00187 
00189 
00190   vtkSetVector2Macro(Range,float);
00191   vtkGetVectorMacro(Range,float,2);
00193 
00195 
00196   vtkSetMacro(Orient,int);
00197   vtkBooleanMacro(Orient,int);
00198   vtkGetMacro(Orient,int);
00200 
00202 
00204   vtkSetMacro(Clamping,int);
00205   vtkBooleanMacro(Clamping,int);
00206   vtkGetMacro(Clamping,int);
00208 
00210 
00211   vtkSetMacro(VectorMode,int);
00212   vtkGetMacro(VectorMode,int);
00213   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
00214   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
00215   void SetVectorModeToVectorRotationOff() 
00216     {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
00217   const char *GetVectorModeAsString();
00219 
00221 
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 
00250 protected:
00251   vtkGlyph3D();
00252   ~vtkGlyph3D();
00253 
00254   void Execute();
00255   void ExecuteInformation();
00256   void ComputeInputUpdateExtents(vtkDataObject *output);
00257 
00258   int NumberOfSources; // Number of source objects
00259   vtkPolyData **Source; // Geometry to copy to each point
00260   int Scaling; // Determine whether scaling of geometry is performed
00261   int ScaleMode; // Scale by scalar value or vector magnitude
00262   int ColorMode; // new scalars based on scale, scalar or vector
00263   float ScaleFactor; // Scale factor to use to scale geometry
00264   float Range[2]; // Range to use to perform scalar scaling
00265   int Orient; // boolean controls whether to "orient" data
00266   int VectorMode; // Orient/scale via normal or via vector data
00267   int Clamping; // whether to clamp scale factor
00268   int IndexMode; // what to use to index into glyph table
00269   int GeneratePointIds; // produce input points ids for each output point
00270   char *PointIdsName;
00271 
00272   char *InputScalarsSelection;
00273   char *InputVectorsSelection;
00274   char *InputNormalsSelection;
00275   vtkSetStringMacro(InputScalarsSelection);
00276   vtkSetStringMacro(InputVectorsSelection);
00277   vtkSetStringMacro(InputNormalsSelection);
00278 
00279 private:
00280   vtkGlyph3D(const vtkGlyph3D&);  // Not implemented.
00281   void operator=(const vtkGlyph3D&);  // Not implemented.
00282 };
00283 
00285 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
00286 {
00287   if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
00288     {
00289     return "ScaleByScalar";
00290     }
00291   else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 
00292     {
00293     return "ScaleByVector";
00294     }
00295   else 
00296     {
00297     return "DataScalingOff";
00298     }
00299 }
00300 
00302 inline const char *vtkGlyph3D::GetColorModeAsString(void)
00303 {
00304   if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
00305     {
00306     return "ColorByScalar";
00307     }
00308   else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 
00309     {
00310     return "ColorByVector";
00311     }
00312   else 
00313     {
00314     return "ColorByScale";
00315     }
00316 }
00317 
00319 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
00320 {
00321   if ( this->VectorMode == VTK_USE_VECTOR) 
00322     {
00323     return "UseVector";
00324     }
00325   else if ( this->VectorMode == VTK_USE_NORMAL) 
00326     {
00327     return "UseNormal";
00328     }
00329   else 
00330     {
00331     return "VectorRotationOff";
00332     }
00333 }
00334 
00336 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
00337 {
00338   if ( this->IndexMode == VTK_INDEXING_OFF) 
00339     {
00340     return "IndexingOff";
00341     }
00342   else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 
00343     {
00344     return "IndexingByScalar";
00345     }
00346   else 
00347     {
00348     return "IndexingByVector";
00349     }
00350 }
00351 
00352 #endif