VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGenericGlyph3DFilter.h 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 =========================================================================*/ 00081 #ifndef __vtkGenericGlyph3DFilter_h 00082 #define __vtkGenericGlyph3DFilter_h 00083 00084 #include "vtkPolyDataAlgorithm.h" 00085 00086 #define VTK_SCALE_BY_SCALAR 0 00087 #define VTK_SCALE_BY_VECTOR 1 00088 #define VTK_SCALE_BY_VECTORCOMPONENTS 2 00089 #define VTK_DATA_SCALING_OFF 3 00090 00091 #define VTK_COLOR_BY_SCALE 0 00092 #define VTK_COLOR_BY_SCALAR 1 00093 #define VTK_COLOR_BY_VECTOR 2 00094 00095 #define VTK_USE_VECTOR 0 00096 #define VTK_USE_NORMAL 1 00097 #define VTK_VECTOR_ROTATION_OFF 2 00098 00099 #define VTK_INDEXING_OFF 0 00100 #define VTK_INDEXING_BY_SCALAR 1 00101 #define VTK_INDEXING_BY_VECTOR 2 00102 00103 class VTK_GENERIC_FILTERING_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm 00104 { 00105 public: 00106 vtkTypeMacro(vtkGenericGlyph3DFilter,vtkPolyDataAlgorithm); 00107 void PrintSelf(ostream& os, vtkIndent indent); 00108 00113 static vtkGenericGlyph3DFilter *New(); 00114 00116 void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);}; 00117 00119 void SetSource(int id, vtkPolyData *pd); 00120 00122 vtkPolyData *GetSource(int id=0); 00123 00125 00126 vtkSetMacro(Scaling,int); 00127 vtkBooleanMacro(Scaling,int); 00128 vtkGetMacro(Scaling,int); 00130 00132 00133 vtkSetMacro(ScaleMode,int); 00134 vtkGetMacro(ScaleMode,int); 00135 void SetScaleModeToScaleByScalar() 00136 {this->SetScaleMode(VTK_SCALE_BY_SCALAR);}; 00137 void SetScaleModeToScaleByVector() 00138 {this->SetScaleMode(VTK_SCALE_BY_VECTOR);}; 00139 void SetScaleModeToScaleByVectorComponents() 00140 {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);}; 00141 void SetScaleModeToDataScalingOff() 00142 {this->SetScaleMode(VTK_DATA_SCALING_OFF);}; 00143 const char *GetScaleModeAsString(); 00145 00147 00148 vtkSetMacro(ColorMode,int); 00149 vtkGetMacro(ColorMode,int); 00150 void SetColorModeToColorByScale() 00151 {this->SetColorMode(VTK_COLOR_BY_SCALE);}; 00152 void SetColorModeToColorByScalar() 00153 {this->SetColorMode(VTK_COLOR_BY_SCALAR);}; 00154 void SetColorModeToColorByVector() 00155 {this->SetColorMode(VTK_COLOR_BY_VECTOR);}; 00156 const char *GetColorModeAsString(); 00158 00160 00161 vtkSetMacro(ScaleFactor,double); 00162 vtkGetMacro(ScaleFactor,double); 00164 00166 00167 vtkSetVector2Macro(Range,double); 00168 vtkGetVectorMacro(Range,double,2); 00170 00172 00173 vtkSetMacro(Orient,int); 00174 vtkBooleanMacro(Orient,int); 00175 vtkGetMacro(Orient,int); 00177 00179 00181 vtkSetMacro(Clamping,int); 00182 vtkBooleanMacro(Clamping,int); 00183 vtkGetMacro(Clamping,int); 00185 00187 00188 vtkSetMacro(VectorMode,int); 00189 vtkGetMacro(VectorMode,int); 00190 void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);}; 00191 void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);}; 00192 void SetVectorModeToVectorRotationOff() 00193 {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);}; 00194 const char *GetVectorModeAsString(); 00196 00198 00201 vtkSetMacro(IndexMode,int); 00202 vtkGetMacro(IndexMode,int); 00203 void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);}; 00204 void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);}; 00205 void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);}; 00206 const char *GetIndexModeAsString(); 00208 00210 00214 vtkSetMacro(GeneratePointIds,int); 00215 vtkGetMacro(GeneratePointIds,int); 00216 vtkBooleanMacro(GeneratePointIds,int); 00218 00220 00223 vtkSetStringMacro(PointIdsName); 00224 vtkGetStringMacro(PointIdsName); 00226 00228 00231 vtkGetStringMacro(InputScalarsSelection); 00232 void SelectInputScalars(const char *fieldName) 00233 {this->SetInputScalarsSelection(fieldName);} 00235 00237 00240 vtkGetStringMacro(InputVectorsSelection); 00241 void SelectInputVectors(const char *fieldName) 00242 {this->SetInputVectorsSelection(fieldName);} 00244 00246 00249 vtkGetStringMacro(InputNormalsSelection); 00250 void SelectInputNormals(const char *fieldName) 00251 {this->SetInputNormalsSelection(fieldName);} 00253 00254 protected: 00255 vtkGenericGlyph3DFilter(); 00256 ~vtkGenericGlyph3DFilter(); 00257 00258 int FillInputPortInformation(int, vtkInformation*); 00259 00260 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00261 int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00262 int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00263 vtkPolyData **Source; // Geometry to copy to each point 00264 int Scaling; // Determine whether scaling of geometry is performed 00265 int ScaleMode; // Scale by scalar value or vector magnitude 00266 int ColorMode; // new scalars based on scale, scalar or vector 00267 double ScaleFactor; // Scale factor to use to scale geometry 00268 double Range[2]; // Range to use to perform scalar scaling 00269 int Orient; // boolean controls whether to "orient" data 00270 int VectorMode; // Orient/scale via normal or via vector data 00271 int Clamping; // whether to clamp scale factor 00272 int IndexMode; // what to use to index into glyph table 00273 int GeneratePointIds; // produce input points ids for each output point 00274 char *PointIdsName; 00275 00276 char *InputScalarsSelection; 00277 char *InputVectorsSelection; 00278 char *InputNormalsSelection; 00279 vtkSetStringMacro(InputScalarsSelection); 00280 vtkSetStringMacro(InputVectorsSelection); 00281 vtkSetStringMacro(InputNormalsSelection); 00282 00283 private: 00284 vtkGenericGlyph3DFilter(const vtkGenericGlyph3DFilter&); // Not implemented. 00285 void operator=(const vtkGenericGlyph3DFilter&); // Not implemented. 00286 }; 00287 00289 00290 inline const char *vtkGenericGlyph3DFilter::GetScaleModeAsString() 00291 { 00292 if ( this->ScaleMode == VTK_SCALE_BY_SCALAR ) 00293 { 00294 return "ScaleByScalar"; 00295 } 00296 else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 00297 { 00298 return "ScaleByVector"; 00299 } 00300 else 00301 { 00302 return "DataScalingOff"; 00303 } 00304 } 00306 00308 00309 inline const char *vtkGenericGlyph3DFilter::GetColorModeAsString() 00310 { 00311 if ( this->ColorMode == VTK_COLOR_BY_SCALAR ) 00312 { 00313 return "ColorByScalar"; 00314 } 00315 else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 00316 { 00317 return "ColorByVector"; 00318 } 00319 else 00320 { 00321 return "ColorByScale"; 00322 } 00323 } 00325 00327 00328 inline const char *vtkGenericGlyph3DFilter::GetVectorModeAsString() 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 } 00344 00346 00347 inline const char *vtkGenericGlyph3DFilter::GetIndexModeAsString() 00348 { 00349 if ( this->IndexMode == VTK_INDEXING_OFF) 00350 { 00351 return "IndexingOff"; 00352 } 00353 else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 00354 { 00355 return "IndexingByScalar"; 00356 } 00357 else 00358 { 00359 return "IndexingByVector"; 00360 } 00361 } 00363 00364 #endif