Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | 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 
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 =========================================================================*/
00094 #ifndef __vtkGlyph3D_h
00095 #define __vtkGlyph3D_h
00096 
00097 #include "vtkDataSetToPolyDataFilter.h"
00098 
00099 #define VTK_SCALE_BY_SCALAR 0
00100 #define VTK_SCALE_BY_VECTOR 1
00101 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
00102 #define VTK_DATA_SCALING_OFF 3
00103 
00104 #define VTK_COLOR_BY_SCALE  0
00105 #define VTK_COLOR_BY_SCALAR 1
00106 #define VTK_COLOR_BY_VECTOR 2
00107 
00108 #define VTK_USE_VECTOR 0
00109 #define VTK_USE_NORMAL 1
00110 #define VTK_VECTOR_ROTATION_OFF 2
00111 
00112 #define VTK_INDEXING_OFF 0
00113 #define VTK_INDEXING_BY_SCALAR 1
00114 #define VTK_INDEXING_BY_VECTOR 2
00115 
00116 class VTK_GRAPHICS_EXPORT vtkGlyph3D : public vtkDataSetToPolyDataFilter
00117 {
00118 public:
00119   vtkTypeRevisionMacro(vtkGlyph3D,vtkDataSetToPolyDataFilter);
00120   void PrintSelf(ostream& os, vtkIndent indent);
00121 
00126   static vtkGlyph3D *New();
00127 
00129 
00131   void SetNumberOfSources(int num);
00132   int GetNumberOfSources();
00134 
00136   void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
00137 
00139   void SetSource(int id, vtkPolyData *pd);
00140 
00142   vtkPolyData *GetSource(int id=0);
00143 
00145 
00146   vtkSetMacro(Scaling,int);
00147   vtkBooleanMacro(Scaling,int);
00148   vtkGetMacro(Scaling,int);
00150 
00152 
00153   vtkSetMacro(ScaleMode,int);
00154   vtkGetMacro(ScaleMode,int);
00155   void SetScaleModeToScaleByScalar() 
00156     {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
00157   void SetScaleModeToScaleByVector() 
00158     {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
00159   void SetScaleModeToScaleByVectorComponents()
00160     {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
00161   void SetScaleModeToDataScalingOff()
00162     {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
00163   const char *GetScaleModeAsString();
00165 
00167 
00168   vtkSetMacro(ColorMode,int);
00169   vtkGetMacro(ColorMode,int);
00170   void SetColorModeToColorByScale() 
00171     {this->SetColorMode(VTK_COLOR_BY_SCALE);};
00172   void SetColorModeToColorByScalar() 
00173     {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
00174   void SetColorModeToColorByVector() 
00175     {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
00176   const char *GetColorModeAsString();
00178 
00180 
00181   vtkSetMacro(ScaleFactor,double);
00182   vtkGetMacro(ScaleFactor,double);
00184 
00186 
00187   vtkSetVector2Macro(Range,double);
00188   vtkGetVectorMacro(Range,double,2);
00190 
00192 
00193   vtkSetMacro(Orient,int);
00194   vtkBooleanMacro(Orient,int);
00195   vtkGetMacro(Orient,int);
00197 
00199 
00201   vtkSetMacro(Clamping,int);
00202   vtkBooleanMacro(Clamping,int);
00203   vtkGetMacro(Clamping,int);
00205 
00207 
00208   vtkSetMacro(VectorMode,int);
00209   vtkGetMacro(VectorMode,int);
00210   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
00211   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
00212   void SetVectorModeToVectorRotationOff() 
00213     {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
00214   const char *GetVectorModeAsString();
00216 
00218 
00221   vtkSetMacro(IndexMode,int);
00222   vtkGetMacro(IndexMode,int);
00223   void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
00224   void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
00225   void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
00226   const char *GetIndexModeAsString();
00228 
00230 
00234   vtkSetMacro(GeneratePointIds,int);
00235   vtkGetMacro(GeneratePointIds,int);
00236   vtkBooleanMacro(GeneratePointIds,int);
00238 
00240 
00243   vtkSetStringMacro(PointIdsName);
00244   vtkGetStringMacro(PointIdsName);
00246 
00248 
00251   vtkGetStringMacro(InputScalarsSelection);
00252   void SelectInputScalars(const char *fieldName) 
00253     {this->SetInputScalarsSelection(fieldName);}
00255 
00257 
00260   vtkGetStringMacro(InputVectorsSelection);
00261   void SelectInputVectors(const char *fieldName) 
00262     {this->SetInputVectorsSelection(fieldName);}
00264 
00266 
00269   vtkGetStringMacro(InputNormalsSelection);
00270   void SelectInputNormals(const char *fieldName) 
00271     {this->SetInputNormalsSelection(fieldName);}
00273 
00274 protected:
00275   vtkGlyph3D();
00276   ~vtkGlyph3D();
00277 
00278   void Execute();
00279   void ExecuteInformation();
00280   void ComputeInputUpdateExtents(vtkDataObject *output);
00281 
00282   int NumberOfSources; // Number of source objects
00283   vtkPolyData **Source; // Geometry to copy to each point
00284   int Scaling; // Determine whether scaling of geometry is performed
00285   int ScaleMode; // Scale by scalar value or vector magnitude
00286   int ColorMode; // new scalars based on scale, scalar or vector
00287   double ScaleFactor; // Scale factor to use to scale geometry
00288   double Range[2]; // Range to use to perform scalar scaling
00289   int Orient; // boolean controls whether to "orient" data
00290   int VectorMode; // Orient/scale via normal or via vector data
00291   int Clamping; // whether to clamp scale factor
00292   int IndexMode; // what to use to index into glyph table
00293   int GeneratePointIds; // produce input points ids for each output point
00294   char *PointIdsName;
00295 
00296   char *InputScalarsSelection;
00297   char *InputVectorsSelection;
00298   char *InputNormalsSelection;
00299   vtkSetStringMacro(InputScalarsSelection);
00300   vtkSetStringMacro(InputVectorsSelection);
00301   vtkSetStringMacro(InputNormalsSelection);
00302 
00303 private:
00304   vtkGlyph3D(const vtkGlyph3D&);  // Not implemented.
00305   void operator=(const vtkGlyph3D&);  // Not implemented.
00306 };
00307 
00309 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
00310 {
00311   if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
00312     {
00313     return "ScaleByScalar";
00314     }
00315   else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 
00316     {
00317     return "ScaleByVector";
00318     }
00319   else 
00320     {
00321     return "DataScalingOff";
00322     }
00323 }
00324 
00326 inline const char *vtkGlyph3D::GetColorModeAsString(void)
00327 {
00328   if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
00329     {
00330     return "ColorByScalar";
00331     }
00332   else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 
00333     {
00334     return "ColorByVector";
00335     }
00336   else 
00337     {
00338     return "ColorByScale";
00339     }
00340 }
00341 
00343 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
00344 {
00345   if ( this->VectorMode == VTK_USE_VECTOR) 
00346     {
00347     return "UseVector";
00348     }
00349   else if ( this->VectorMode == VTK_USE_NORMAL) 
00350     {
00351     return "UseNormal";
00352     }
00353   else 
00354     {
00355     return "VectorRotationOff";
00356     }
00357 }
00358 
00360 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
00361 {
00362   if ( this->IndexMode == VTK_INDEXING_OFF) 
00363     {
00364     return "IndexingOff";
00365     }
00366   else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 
00367     {
00368     return "IndexingByScalar";
00369     }
00370   else 
00371     {
00372     return "IndexingByVector";
00373     }
00374 }
00375 
00376 #endif