VTK
dox/Graphics/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 =========================================================================*/
00049 #ifndef __vtkRandomAttributeGenerator_h
00050 #define __vtkRandomAttributeGenerator_h
00051 
00052 #include "vtkDataSetAlgorithm.h"
00053 
00054 class VTK_GRAPHICS_EXPORT vtkRandomAttributeGenerator : public vtkDataSetAlgorithm
00055 {
00056 public:
00058   static vtkRandomAttributeGenerator *New();
00059 
00060   vtkTypeMacro(vtkRandomAttributeGenerator,vtkDataSetAlgorithm);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00066   vtkSetMacro(DataType,int);
00067   void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
00068   void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
00069   void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
00070   void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
00071   void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
00072   void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
00073   void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
00074   void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
00075   void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
00076   void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
00077   void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
00078   vtkGetMacro(DataType,int);
00080 
00082 
00087   vtkSetClampMacro(NumberOfComponents,int,1,VTK_LARGE_INTEGER);
00088   vtkGetMacro(NumberOfComponents,int);
00090 
00092 
00095   vtkSetMacro(MinimumComponentValue,double);
00096   vtkGetMacro(MinimumComponentValue,double);
00098 
00100 
00103   vtkSetMacro(MaximumComponentValue,double);
00104   vtkGetMacro(MaximumComponentValue,double);
00106 
00108 
00112   vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_LARGE_INTEGER);
00113   vtkGetMacro(NumberOfTuples,vtkIdType);
00115 
00117 
00119   vtkSetMacro(GeneratePointScalars,int);
00120   vtkGetMacro(GeneratePointScalars,int);
00121   vtkBooleanMacro(GeneratePointScalars,int);
00123   
00125 
00127   vtkSetMacro(GeneratePointVectors,int);
00128   vtkGetMacro(GeneratePointVectors,int);
00129   vtkBooleanMacro(GeneratePointVectors,int);
00131   
00133 
00135   vtkSetMacro(GeneratePointNormals,int);
00136   vtkGetMacro(GeneratePointNormals,int);
00137   vtkBooleanMacro(GeneratePointNormals,int);
00139   
00141 
00143   vtkSetMacro(GeneratePointTensors,int);
00144   vtkGetMacro(GeneratePointTensors,int);
00145   vtkBooleanMacro(GeneratePointTensors,int);
00147   
00149 
00152   vtkSetMacro(GeneratePointTCoords,int);
00153   vtkGetMacro(GeneratePointTCoords,int);
00154   vtkBooleanMacro(GeneratePointTCoords,int);
00156   
00158 
00160   vtkSetMacro(GeneratePointArray,int);
00161   vtkGetMacro(GeneratePointArray,int);
00162   vtkBooleanMacro(GeneratePointArray,int);
00164   
00166 
00168   vtkSetMacro(GenerateCellScalars,int);
00169   vtkGetMacro(GenerateCellScalars,int);
00170   vtkBooleanMacro(GenerateCellScalars,int);
00172   
00174 
00176   vtkSetMacro(GenerateCellVectors,int);
00177   vtkGetMacro(GenerateCellVectors,int);
00178   vtkBooleanMacro(GenerateCellVectors,int);
00180   
00182 
00184   vtkSetMacro(GenerateCellNormals,int);
00185   vtkGetMacro(GenerateCellNormals,int);
00186   vtkBooleanMacro(GenerateCellNormals,int);
00188   
00190 
00192   vtkSetMacro(GenerateCellTensors,int);
00193   vtkGetMacro(GenerateCellTensors,int);
00194   vtkBooleanMacro(GenerateCellTensors,int);
00196   
00198 
00201   vtkSetMacro(GenerateCellTCoords,int);
00202   vtkGetMacro(GenerateCellTCoords,int);
00203   vtkBooleanMacro(GenerateCellTCoords,int);
00205   
00207 
00209   vtkSetMacro(GenerateCellArray,int);
00210   vtkGetMacro(GenerateCellArray,int);
00211   vtkBooleanMacro(GenerateCellArray,int);
00213 
00215 
00217   vtkSetMacro(GenerateFieldArray,int);
00218   vtkGetMacro(GenerateFieldArray,int);
00219   vtkBooleanMacro(GenerateFieldArray,int);
00221 
00223 
00228   void GenerateAllPointDataOn()
00229     {
00230     this->GeneratePointScalarsOn();
00231     this->GeneratePointVectorsOn();
00232     this->GeneratePointNormalsOn();
00233     this->GeneratePointTCoordsOn();
00234     this->GeneratePointTensorsOn();
00235     this->GeneratePointArrayOn();
00236     }
00237   void GenerateAllPointDataOff()
00238     {
00239     this->GeneratePointScalarsOff();
00240     this->GeneratePointVectorsOff();
00241     this->GeneratePointNormalsOff();
00242     this->GeneratePointTCoordsOff();
00243     this->GeneratePointTensorsOff();
00244     this->GeneratePointArrayOff();
00245     }
00246   void GenerateAllCellDataOn()
00247     {
00248     this->GenerateCellScalarsOn();
00249     this->GenerateCellVectorsOn();
00250     this->GenerateCellNormalsOn();
00251     this->GenerateCellTCoordsOn();
00252     this->GenerateCellTensorsOn();
00253     this->GenerateCellArrayOn();
00254     }
00255   void GenerateAllCellDataOff()
00256     {
00257     this->GenerateCellScalarsOff();
00258     this->GenerateCellVectorsOff();
00259     this->GenerateCellNormalsOff();
00260     this->GenerateCellTCoordsOff();
00261     this->GenerateCellTensorsOff();
00262     this->GenerateCellArrayOff();
00263     }
00264   void GenerateAllDataOn()
00265     {
00266     this->GenerateAllPointDataOn();
00267     this->GenerateAllCellDataOn();
00268     this->GenerateFieldArrayOn();
00269     }
00270   void GenerateAllDataOff()
00271     {
00272     this->GenerateAllPointDataOff();
00273     this->GenerateAllCellDataOff();
00274     this->GenerateFieldArrayOff();
00275     }
00277 
00278 protected:
00279   vtkRandomAttributeGenerator();
00280   ~vtkRandomAttributeGenerator() {}
00281 
00282   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00283 
00284   int       DataType;
00285   int       NumberOfComponents;
00286   vtkIdType NumberOfTuples;
00287   double    MinimumComponentValue;
00288   double    MaximumComponentValue;
00289   
00290   int GeneratePointScalars;
00291   int GeneratePointVectors;
00292   int GeneratePointNormals;
00293   int GeneratePointTCoords;
00294   int GeneratePointTensors;
00295   int GeneratePointArray;
00296   
00297   int GenerateCellScalars;
00298   int GenerateCellVectors;
00299   int GenerateCellNormals;
00300   int GenerateCellTCoords;
00301   int GenerateCellTensors;
00302   int GenerateCellArray;
00303   
00304   int GenerateFieldArray;
00305   
00306   // Helper functions
00307   vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp, 
00308                              int minComp, int maxComp, double min, double max);
00309 
00310 private:
00311   vtkRandomAttributeGenerator(const vtkRandomAttributeGenerator&);  // Not implemented.
00312   void operator=(const vtkRandomAttributeGenerator&);  // Not implemented.
00313 };
00314 
00315 #endif