00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00083 #ifndef __vtkDataObjectToDataSetFilter_h
00084 #define __vtkDataObjectToDataSetFilter_h
00085
00086 #include "vtkSource.h"
00087
00088 class vtkCellArray;
00089 class vtkDataArray;
00090 class vtkDataSet;
00091 class vtkPointSet;
00092 class vtkPolyData;
00093 class vtkRectilinearGrid;
00094 class vtkStructuredGrid;
00095 class vtkStructuredPoints;
00096 class vtkUnstructuredGrid;
00097
00098 class VTK_GRAPHICS_EXPORT vtkDataObjectToDataSetFilter : public vtkSource
00099 {
00100 public:
00101 static vtkDataObjectToDataSetFilter *New();
00102 vtkTypeRevisionMacro(vtkDataObjectToDataSetFilter,vtkSource);
00103 void PrintSelf(ostream& os, vtkIndent indent);
00104
00106
00107 void SetInput(vtkDataObject *input);
00108 vtkDataObject *GetInput();
00110
00112
00113 void SetDataSetType(int);
00114 vtkGetMacro(DataSetType,int);
00115 void SetDataSetTypeToPolyData() {
00116 this->SetDataSetType(VTK_POLY_DATA);};
00117 void SetDataSetTypeToStructuredPoints() {
00118 this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00119 void SetDataSetTypeToStructuredGrid() {
00120 this->SetDataSetType(VTK_STRUCTURED_GRID);};
00121 void SetDataSetTypeToRectilinearGrid() {
00122 this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00123 void SetDataSetTypeToUnstructuredGrid() {
00124 this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00126
00128
00133 vtkDataSet *GetOutput();
00134 vtkDataSet *GetOutput(int idx);
00135 vtkPolyData *GetPolyDataOutput();
00136 vtkStructuredPoints *GetStructuredPointsOutput();
00137 vtkStructuredGrid *GetStructuredGridOutput();
00138 vtkUnstructuredGrid *GetUnstructuredGridOutput();
00139 vtkRectilinearGrid *GetRectilinearGridOutput();
00141
00143
00154 void SetPointComponent(int comp, char *arrayName, int arrayComp,
00155 int min, int max, int normalize);
00156 void SetPointComponent(int comp, char *arrayName, int arrayComp)
00157 {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00158 const char *GetPointComponentArrayName(int comp);
00159 int GetPointComponentArrayComponent(int comp);
00160 int GetPointComponentMinRange(int comp);
00161 int GetPointComponentMaxRange(int comp);
00162 int GetPointComponentNormailzeFlag(int comp);
00164
00166
00173 void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00174 void SetVertsComponent(char *arrayName, int arrayComp)
00175 {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00176 const char *GetVertsComponentArrayName();
00177 int GetVertsComponentArrayComponent();
00178 int GetVertsComponentMinRange();
00179 int GetVertsComponentMaxRange();
00180 void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00181 void SetLinesComponent(char *arrayName, int arrayComp)
00182 {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00183 const char *GetLinesComponentArrayName();
00184 int GetLinesComponentArrayComponent();
00185 int GetLinesComponentMinRange();
00186 int GetLinesComponentMaxRange();
00187 void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00188 void SetPolysComponent(char *arrayName, int arrayComp)
00189 {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00190 const char *GetPolysComponentArrayName();
00191 int GetPolysComponentArrayComponent();
00192 int GetPolysComponentMinRange();
00193 int GetPolysComponentMaxRange();
00194 void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00195 void SetStripsComponent(char *arrayName, int arrayComp)
00196 {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00197 const char *GetStripsComponentArrayName();
00198 int GetStripsComponentArrayComponent();
00199 int GetStripsComponentMinRange();
00200 int GetStripsComponentMaxRange();
00202
00204
00211 void SetCellTypeComponent(char *arrayName, int arrayComp,
00212 int min, int max);
00213 void SetCellTypeComponent(char *arrayName, int arrayComp)
00214 {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00215 const char *GetCellTypeComponentArrayName();
00216 int GetCellTypeComponentArrayComponent();
00217 int GetCellTypeComponentMinRange();
00218 int GetCellTypeComponentMaxRange();
00219 void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00220 int min, int max);
00221 void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00222 {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00223 const char *GetCellConnectivityComponentArrayName();
00224 int GetCellConnectivityComponentArrayComponent();
00225 int GetCellConnectivityComponentMinRange();
00226 int GetCellConnectivityComponentMaxRange();
00228
00230
00232 vtkSetMacro(DefaultNormalize,int);
00233 vtkGetMacro(DefaultNormalize,int);
00234 vtkBooleanMacro(DefaultNormalize,int);
00236
00238
00241 vtkSetVector3Macro(Dimensions,int);
00242 vtkGetVectorMacro(Dimensions,int,3);
00244
00246
00248 vtkSetVector3Macro(Origin,double);
00249 vtkGetVectorMacro(Origin,double,3);
00251
00253
00255 vtkSetVector3Macro(Spacing,double);
00256 vtkGetVectorMacro(Spacing,double,3);
00258
00260
00265 void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
00266 void SetDimensionsComponent(char *arrayName, int arrayComp)
00267 {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
00268 void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
00269 void SetSpacingComponent(char *arrayName, int arrayComp)
00270 {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
00271 void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
00272 void SetOriginComponent(char *arrayName, int arrayComp)
00273 {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
00275
00276 protected:
00277 vtkDataObjectToDataSetFilter();
00278 ~vtkDataObjectToDataSetFilter();
00279
00280 void Execute();
00281 void ExecuteInformation();
00282 void ComputeInputUpdateExtents(vtkDataObject *output);
00283
00284 char Updating;
00285
00286
00287 int DataSetType;
00288
00289
00290 char *PointArrays[3];
00291 int PointArrayComponents[3];
00292 vtkIdType PointComponentRange[3][2];
00293 int PointNormalize[3];
00294
00295
00296 char *VertsArray;
00297 int VertsArrayComponent;
00298 vtkIdType VertsComponentRange[2];
00299
00300 char *LinesArray;
00301 int LinesArrayComponent;
00302 vtkIdType LinesComponentRange[2];
00303
00304 char *PolysArray;
00305 int PolysArrayComponent;
00306 vtkIdType PolysComponentRange[2];
00307
00308 char *StripsArray;
00309 int StripsArrayComponent;
00310 vtkIdType StripsComponentRange[2];
00311
00312
00313 char *CellTypeArray;
00314 int CellTypeArrayComponent;
00315 vtkIdType CellTypeComponentRange[2];
00316
00317 char *CellConnectivityArray;
00318 int CellConnectivityArrayComponent;
00319 vtkIdType CellConnectivityComponentRange[2];
00320
00321
00322 void SetArrayName(char* &name, char *newName);
00323 vtkIdType ConstructPoints(vtkPointSet *ps);
00324 vtkIdType ConstructPoints(vtkRectilinearGrid *rg);
00325 int ConstructCells(vtkPolyData *pd);
00326 int ConstructCells(vtkUnstructuredGrid *ug);
00327 vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
00328 vtkIdType compRange[2]);
00329
00330
00331 int DefaultNormalize;
00332
00333
00334 int Dimensions[3];
00335 double Origin[3];
00336 double Spacing[3];
00337
00338 char *DimensionsArray;
00339 int DimensionsArrayComponent;
00340 vtkIdType DimensionsComponentRange[2];
00341
00342 char *OriginArray;
00343 int OriginArrayComponent;
00344 vtkIdType OriginComponentRange[2];
00345
00346 char *SpacingArray;
00347 int SpacingArrayComponent;
00348 vtkIdType SpacingComponentRange[2];
00349
00350 void ConstructDimensions();
00351 void ConstructSpacing();
00352 void ConstructOrigin();
00353
00354 private:
00355 vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&);
00356 void operator=(const vtkDataObjectToDataSetFilter&);
00357 };
00358
00359 #endif