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 "vtkFiltersGenericModule.h" // For export macro 00085 #include "vtkPolyDataAlgorithm.h" 00086 00087 #define VTK_SCALE_BY_SCALAR 0 00088 #define VTK_SCALE_BY_VECTOR 1 00089 #define VTK_SCALE_BY_VECTORCOMPONENTS 2 00090 #define VTK_DATA_SCALING_OFF 3 00091 00092 #define VTK_COLOR_BY_SCALE 0 00093 #define VTK_COLOR_BY_SCALAR 1 00094 #define VTK_COLOR_BY_VECTOR 2 00095 00096 #define VTK_USE_VECTOR 0 00097 #define VTK_USE_NORMAL 1 00098 #define VTK_VECTOR_ROTATION_OFF 2 00099 00100 #define VTK_INDEXING_OFF 0 00101 #define VTK_INDEXING_BY_SCALAR 1 00102 #define VTK_INDEXING_BY_VECTOR 2 00103 00104 class VTKFILTERSGENERIC_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm 00105 { 00106 public: 00107 vtkTypeMacro(vtkGenericGlyph3DFilter,vtkPolyDataAlgorithm); 00108 void PrintSelf(ostream& os, vtkIndent indent); 00109 00114 static vtkGenericGlyph3DFilter *New(); 00115 00117 void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);}; 00118 00120 void SetSourceData(int id, vtkPolyData *pd); 00121 00123 vtkPolyData *GetSource(int id=0); 00124 00126 00127 vtkSetMacro(Scaling,int); 00128 vtkBooleanMacro(Scaling,int); 00129 vtkGetMacro(Scaling,int); 00131 00133 00134 vtkSetMacro(ScaleMode,int); 00135 vtkGetMacro(ScaleMode,int); 00136 void SetScaleModeToScaleByScalar() 00137 {this->SetScaleMode(VTK_SCALE_BY_SCALAR);}; 00138 void SetScaleModeToScaleByVector() 00139 {this->SetScaleMode(VTK_SCALE_BY_VECTOR);}; 00140 void SetScaleModeToScaleByVectorComponents() 00141 {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);}; 00142 void SetScaleModeToDataScalingOff() 00143 {this->SetScaleMode(VTK_DATA_SCALING_OFF);}; 00144 const char *GetScaleModeAsString(); 00146 00148 00149 vtkSetMacro(ColorMode,int); 00150 vtkGetMacro(ColorMode,int); 00151 void SetColorModeToColorByScale() 00152 {this->SetColorMode(VTK_COLOR_BY_SCALE);}; 00153 void SetColorModeToColorByScalar() 00154 {this->SetColorMode(VTK_COLOR_BY_SCALAR);}; 00155 void SetColorModeToColorByVector() 00156 {this->SetColorMode(VTK_COLOR_BY_VECTOR);}; 00157 const char *GetColorModeAsString(); 00159 00161 00162 vtkSetMacro(ScaleFactor,double); 00163 vtkGetMacro(ScaleFactor,double); 00165 00167 00168 vtkSetVector2Macro(Range,double); 00169 vtkGetVectorMacro(Range,double,2); 00171 00173 00174 vtkSetMacro(Orient,int); 00175 vtkBooleanMacro(Orient,int); 00176 vtkGetMacro(Orient,int); 00178 00180 00182 vtkSetMacro(Clamping,int); 00183 vtkBooleanMacro(Clamping,int); 00184 vtkGetMacro(Clamping,int); 00186 00188 00189 vtkSetMacro(VectorMode,int); 00190 vtkGetMacro(VectorMode,int); 00191 void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);}; 00192 void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);}; 00193 void SetVectorModeToVectorRotationOff() 00194 {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);}; 00195 const char *GetVectorModeAsString(); 00197 00199 00202 vtkSetMacro(IndexMode,int); 00203 vtkGetMacro(IndexMode,int); 00204 void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);}; 00205 void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);}; 00206 void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);}; 00207 const char *GetIndexModeAsString(); 00209 00211 00215 vtkSetMacro(GeneratePointIds,int); 00216 vtkGetMacro(GeneratePointIds,int); 00217 vtkBooleanMacro(GeneratePointIds,int); 00219 00221 00224 vtkSetStringMacro(PointIdsName); 00225 vtkGetStringMacro(PointIdsName); 00227 00229 00232 vtkGetStringMacro(InputScalarsSelection); 00233 void SelectInputScalars(const char *fieldName) 00234 {this->SetInputScalarsSelection(fieldName);} 00236 00238 00241 vtkGetStringMacro(InputVectorsSelection); 00242 void SelectInputVectors(const char *fieldName) 00243 {this->SetInputVectorsSelection(fieldName);} 00245 00247 00250 vtkGetStringMacro(InputNormalsSelection); 00251 void SelectInputNormals(const char *fieldName) 00252 {this->SetInputNormalsSelection(fieldName);} 00254 00255 protected: 00256 vtkGenericGlyph3DFilter(); 00257 ~vtkGenericGlyph3DFilter(); 00258 00259 int FillInputPortInformation(int, vtkInformation*); 00260 00261 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00262 int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00263 int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00264 vtkPolyData **Source; // Geometry to copy to each point 00265 int Scaling; // Determine whether scaling of geometry is performed 00266 int ScaleMode; // Scale by scalar value or vector magnitude 00267 int ColorMode; // new scalars based on scale, scalar or vector 00268 double ScaleFactor; // Scale factor to use to scale geometry 00269 double Range[2]; // Range to use to perform scalar scaling 00270 int Orient; // boolean controls whether to "orient" data 00271 int VectorMode; // Orient/scale via normal or via vector data 00272 int Clamping; // whether to clamp scale factor 00273 int IndexMode; // what to use to index into glyph table 00274 int GeneratePointIds; // produce input points ids for each output point 00275 char *PointIdsName; 00276 00277 char *InputScalarsSelection; 00278 char *InputVectorsSelection; 00279 char *InputNormalsSelection; 00280 vtkSetStringMacro(InputScalarsSelection); 00281 vtkSetStringMacro(InputVectorsSelection); 00282 vtkSetStringMacro(InputNormalsSelection); 00283 00284 private: 00285 vtkGenericGlyph3DFilter(const vtkGenericGlyph3DFilter&); // Not implemented. 00286 void operator=(const vtkGenericGlyph3DFilter&); // Not implemented. 00287 }; 00288 00290 00291 inline const char *vtkGenericGlyph3DFilter::GetScaleModeAsString() 00292 { 00293 if ( this->ScaleMode == VTK_SCALE_BY_SCALAR ) 00294 { 00295 return "ScaleByScalar"; 00296 } 00297 else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR ) 00298 { 00299 return "ScaleByVector"; 00300 } 00301 else 00302 { 00303 return "DataScalingOff"; 00304 } 00305 } 00307 00309 00310 inline const char *vtkGenericGlyph3DFilter::GetColorModeAsString() 00311 { 00312 if ( this->ColorMode == VTK_COLOR_BY_SCALAR ) 00313 { 00314 return "ColorByScalar"; 00315 } 00316 else if ( this->ColorMode == VTK_COLOR_BY_VECTOR ) 00317 { 00318 return "ColorByVector"; 00319 } 00320 else 00321 { 00322 return "ColorByScale"; 00323 } 00324 } 00326 00328 00329 inline const char *vtkGenericGlyph3DFilter::GetVectorModeAsString() 00330 { 00331 if ( this->VectorMode == VTK_USE_VECTOR) 00332 { 00333 return "UseVector"; 00334 } 00335 else if ( this->VectorMode == VTK_USE_NORMAL) 00336 { 00337 return "UseNormal"; 00338 } 00339 else 00340 { 00341 return "VectorRotationOff"; 00342 } 00343 } 00345 00347 00348 inline const char *vtkGenericGlyph3DFilter::GetIndexModeAsString() 00349 { 00350 if ( this->IndexMode == VTK_INDEXING_OFF) 00351 { 00352 return "IndexingOff"; 00353 } 00354 else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR) 00355 { 00356 return "IndexingByScalar"; 00357 } 00358 else 00359 { 00360 return "IndexingByVector"; 00361 } 00362 } 00364 00365 #endif