00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXMLPolyDataReader.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 =========================================================================*/ 00034 #ifndef __vtkXMLPolyDataReader_h 00035 #define __vtkXMLPolyDataReader_h 00036 00037 #include "vtkXMLUnstructuredDataReader.h" 00038 00039 class vtkPolyData; 00040 00041 class VTK_IO_EXPORT vtkXMLPolyDataReader : public vtkXMLUnstructuredDataReader 00042 { 00043 public: 00044 vtkTypeMacro(vtkXMLPolyDataReader,vtkXMLUnstructuredDataReader); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 static vtkXMLPolyDataReader *New(); 00047 00049 00050 vtkPolyData *GetOutput(); 00051 vtkPolyData *GetOutput(int idx); 00053 00055 00056 virtual vtkIdType GetNumberOfVerts(); 00057 virtual vtkIdType GetNumberOfLines(); 00058 virtual vtkIdType GetNumberOfStrips(); 00059 virtual vtkIdType GetNumberOfPolys(); 00061 00062 protected: 00063 vtkXMLPolyDataReader(); 00064 ~vtkXMLPolyDataReader(); 00065 00066 const char* GetDataSetName(); 00067 void GetOutputUpdateExtent(int& piece, int& numberOfPieces, int& ghostLevel); 00068 void SetupOutputTotals(); 00069 void SetupNextPiece(); 00070 void SetupPieces(int numPieces); 00071 void DestroyPieces(); 00072 00073 void SetupOutputData(); 00074 int ReadPiece(vtkXMLDataElement* ePiece); 00075 int ReadPieceData(); 00076 00077 // Read a data array whose tuples coorrespond to cells. 00078 virtual int ReadArrayForCells(vtkXMLDataElement* da, 00079 vtkAbstractArray* outArray); 00080 00081 // Get the number of cells in the given piece. Valid after 00082 // UpdateInformation. 00083 virtual vtkIdType GetNumberOfCellsInPiece(int piece); 00084 00085 virtual int FillOutputPortInformation(int, vtkInformation*); 00086 00087 // The size of the UpdatePiece. 00088 int TotalNumberOfVerts; 00089 int TotalNumberOfLines; 00090 int TotalNumberOfStrips; 00091 int TotalNumberOfPolys; 00092 vtkIdType StartVert; 00093 vtkIdType StartLine; 00094 vtkIdType StartStrip; 00095 vtkIdType StartPoly; 00096 00097 // The cell elements for each piece. 00098 vtkXMLDataElement** VertElements; 00099 vtkXMLDataElement** LineElements; 00100 vtkXMLDataElement** StripElements; 00101 vtkXMLDataElement** PolyElements; 00102 vtkIdType* NumberOfVerts; 00103 vtkIdType* NumberOfLines; 00104 vtkIdType* NumberOfStrips; 00105 vtkIdType* NumberOfPolys; 00106 00107 // For TimeStep support 00108 int VertsTimeStep; 00109 unsigned long VertsOffset; 00110 int LinesTimeStep; 00111 unsigned long LinesOffset; 00112 int StripsTimeStep; 00113 unsigned long StripsOffset; 00114 int PolysTimeStep; 00115 unsigned long PolysOffset; 00116 00117 private: 00118 vtkXMLPolyDataReader(const vtkXMLPolyDataReader&); // Not implemented. 00119 void operator=(const vtkXMLPolyDataReader&); // Not implemented. 00120 }; 00121 00122 #endif