VTK
dox/Filters/General/vtkRandomAttributeGenerator.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkRandomAttributeGenerator.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 =========================================================================*/
00052 #ifndef __vtkRandomAttributeGenerator_h
00053 #define __vtkRandomAttributeGenerator_h
00054 
00055 #include "vtkFiltersGeneralModule.h" // For export macro
00056 #include "vtkPassInputTypeAlgorithm.h"
00057 
00058 class vtkDataSet;
00059 class vtkCompositeDataSet;
00060 
00061 class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
00062 {
00063 public:
00065   static vtkRandomAttributeGenerator *New();
00066 
00067   vtkTypeMacro(vtkRandomAttributeGenerator,vtkPassInputTypeAlgorithm);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00069 
00071 
00073   vtkSetMacro(DataType,int);
00074   void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
00075   void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
00076   void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
00077   void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
00078   void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
00079   void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
00080   void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
00081   void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
00082   void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
00083   void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
00084   void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
00085   vtkGetMacro(DataType,int);
00087 
00089 
00094   vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
00095   vtkGetMacro(NumberOfComponents,int);
00097 
00099 
00102   vtkSetMacro(MinimumComponentValue,double);
00103   vtkGetMacro(MinimumComponentValue,double);
00104   void SetComponentRange (double minimumValue, double maximumValue)
00105     {
00106     this->SetMinimumComponentValue (minimumValue);
00107     this->SetMaximumComponentValue (maximumValue);
00108     }
00110 
00112 
00115   vtkSetMacro(MaximumComponentValue,double);
00116   vtkGetMacro(MaximumComponentValue,double);
00118 
00120 
00124   vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
00125   vtkGetMacro(NumberOfTuples,vtkIdType);
00127 
00129 
00131   vtkSetMacro(GeneratePointScalars,int);
00132   vtkGetMacro(GeneratePointScalars,int);
00133   vtkBooleanMacro(GeneratePointScalars,int);
00135 
00137 
00139   vtkSetMacro(GeneratePointVectors,int);
00140   vtkGetMacro(GeneratePointVectors,int);
00141   vtkBooleanMacro(GeneratePointVectors,int);
00143 
00145 
00147   vtkSetMacro(GeneratePointNormals,int);
00148   vtkGetMacro(GeneratePointNormals,int);
00149   vtkBooleanMacro(GeneratePointNormals,int);
00151 
00153 
00155   vtkSetMacro(GeneratePointTensors,int);
00156   vtkGetMacro(GeneratePointTensors,int);
00157   vtkBooleanMacro(GeneratePointTensors,int);
00159 
00161 
00164   vtkSetMacro(GeneratePointTCoords,int);
00165   vtkGetMacro(GeneratePointTCoords,int);
00166   vtkBooleanMacro(GeneratePointTCoords,int);
00168 
00170 
00172   vtkSetMacro(GeneratePointArray,int);
00173   vtkGetMacro(GeneratePointArray,int);
00174   vtkBooleanMacro(GeneratePointArray,int);
00176 
00178 
00180   vtkSetMacro(GenerateCellScalars,int);
00181   vtkGetMacro(GenerateCellScalars,int);
00182   vtkBooleanMacro(GenerateCellScalars,int);
00184 
00186 
00188   vtkSetMacro(GenerateCellVectors,int);
00189   vtkGetMacro(GenerateCellVectors,int);
00190   vtkBooleanMacro(GenerateCellVectors,int);
00192 
00194 
00196   vtkSetMacro(GenerateCellNormals,int);
00197   vtkGetMacro(GenerateCellNormals,int);
00198   vtkBooleanMacro(GenerateCellNormals,int);
00200 
00202 
00204   vtkSetMacro(GenerateCellTensors,int);
00205   vtkGetMacro(GenerateCellTensors,int);
00206   vtkBooleanMacro(GenerateCellTensors,int);
00208 
00210 
00213   vtkSetMacro(GenerateCellTCoords,int);
00214   vtkGetMacro(GenerateCellTCoords,int);
00215   vtkBooleanMacro(GenerateCellTCoords,int);
00217 
00219 
00221   vtkSetMacro(GenerateCellArray,int);
00222   vtkGetMacro(GenerateCellArray,int);
00223   vtkBooleanMacro(GenerateCellArray,int);
00225 
00227 
00229   vtkSetMacro(GenerateFieldArray,int);
00230   vtkGetMacro(GenerateFieldArray,int);
00231   vtkBooleanMacro(GenerateFieldArray,int);
00233 
00235 
00237   vtkSetMacro(AttributesConstantPerBlock,bool);
00238   vtkGetMacro(AttributesConstantPerBlock,bool);
00239   vtkBooleanMacro(AttributesConstantPerBlock,bool);
00241 
00242 
00244 
00249   void GenerateAllPointDataOn()
00250     {
00251     this->GeneratePointScalarsOn();
00252     this->GeneratePointVectorsOn();
00253     this->GeneratePointNormalsOn();
00254     this->GeneratePointTCoordsOn();
00255     this->GeneratePointTensorsOn();
00256     this->GeneratePointArrayOn();
00257     }
00258   void GenerateAllPointDataOff()
00259     {
00260     this->GeneratePointScalarsOff();
00261     this->GeneratePointVectorsOff();
00262     this->GeneratePointNormalsOff();
00263     this->GeneratePointTCoordsOff();
00264     this->GeneratePointTensorsOff();
00265     this->GeneratePointArrayOff();
00266     }
00267   void GenerateAllCellDataOn()
00268     {
00269     this->GenerateCellScalarsOn();
00270     this->GenerateCellVectorsOn();
00271     this->GenerateCellNormalsOn();
00272     this->GenerateCellTCoordsOn();
00273     this->GenerateCellTensorsOn();
00274     this->GenerateCellArrayOn();
00275     }
00276   void GenerateAllCellDataOff()
00277     {
00278     this->GenerateCellScalarsOff();
00279     this->GenerateCellVectorsOff();
00280     this->GenerateCellNormalsOff();
00281     this->GenerateCellTCoordsOff();
00282     this->GenerateCellTensorsOff();
00283     this->GenerateCellArrayOff();
00284     }
00285   void GenerateAllDataOn()
00286     {
00287     this->GenerateAllPointDataOn();
00288     this->GenerateAllCellDataOn();
00289     this->GenerateFieldArrayOn();
00290     }
00291   void GenerateAllDataOff()
00292     {
00293     this->GenerateAllPointDataOff();
00294     this->GenerateAllCellDataOff();
00295     this->GenerateFieldArrayOff();
00296     }
00298 
00299 protected:
00300   vtkRandomAttributeGenerator();
00301   ~vtkRandomAttributeGenerator() {}
00302 
00303   virtual int RequestData(vtkInformation *, vtkInformationVector **,
00304                           vtkInformationVector *);
00305   virtual int FillInputPortInformation(int port, vtkInformation* info);
00306 
00307   int       DataType;
00308   int       NumberOfComponents;
00309   vtkIdType NumberOfTuples;
00310   double    MinimumComponentValue;
00311   double    MaximumComponentValue;
00312 
00313   int GeneratePointScalars;
00314   int GeneratePointVectors;
00315   int GeneratePointNormals;
00316   int GeneratePointTCoords;
00317   int GeneratePointTensors;
00318   int GeneratePointArray;
00319 
00320   int GenerateCellScalars;
00321   int GenerateCellVectors;
00322   int GenerateCellNormals;
00323   int GenerateCellTCoords;
00324   int GenerateCellTensors;
00325   int GenerateCellArray;
00326 
00327   int GenerateFieldArray;
00328   bool AttributesConstantPerBlock;
00329 
00330   // Helper functions
00331   vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp,
00332                              int minComp, int maxComp, double min, double max);
00333   int RequestData(vtkDataSet *input, vtkDataSet *output);
00334   int RequestData(vtkCompositeDataSet *input, vtkCompositeDataSet *output);
00335   template <class T>
00336     void GenerateRandomTuples(T *data,
00337                               vtkIdType numTuples,
00338                               int numComp,
00339                               int minComp,
00340                               int maxComp,
00341                               double min,
00342                               double max);
00343 
00344 
00345 private:
00346   vtkRandomAttributeGenerator(const vtkRandomAttributeGenerator&);  // Not implemented.
00347   void operator=(const vtkRandomAttributeGenerator&);  // Not implemented.
00348 };
00349 
00350 #endif