00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkXMLPolyDataReader.h,v $ 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 =========================================================================*/ 00028 #ifndef __vtkXMLPolyDataReader_h 00029 #define __vtkXMLPolyDataReader_h 00030 00031 #include "vtkXMLUnstructuredDataReader.h" 00032 00033 class vtkPolyData; 00034 00035 class VTK_IO_EXPORT vtkXMLPolyDataReader : public vtkXMLUnstructuredDataReader 00036 { 00037 public: 00038 vtkTypeRevisionMacro(vtkXMLPolyDataReader,vtkXMLUnstructuredDataReader); 00039 void PrintSelf(ostream& os, vtkIndent indent); 00040 static vtkXMLPolyDataReader *New(); 00041 00043 00044 void SetOutput(vtkPolyData *output); 00045 vtkPolyData *GetOutput(); 00046 vtkPolyData *GetOutput(int idx); 00048 00050 00051 virtual vtkIdType GetNumberOfVerts(); 00052 virtual vtkIdType GetNumberOfLines(); 00053 virtual vtkIdType GetNumberOfStrips(); 00054 virtual vtkIdType GetNumberOfPolys(); 00056 00057 protected: 00058 vtkXMLPolyDataReader(); 00059 ~vtkXMLPolyDataReader(); 00060 00061 const char* GetDataSetName(); 00062 void GetOutputUpdateExtent(int& piece, int& numberOfPieces, int& ghostLevel); 00063 void SetupOutputTotals(); 00064 void SetupNextPiece(); 00065 void SetupPieces(int numPieces); 00066 void DestroyPieces(); 00067 00068 void SetupOutputData(); 00069 int ReadPiece(vtkXMLDataElement* ePiece); 00070 int ReadPieceData(); 00071 00072 // Read a data array whose tuples coorrespond to cells. 00073 int ReadArrayForCells(vtkXMLDataElement* da, vtkDataArray* outArray); 00074 00075 // Get the number of cells in the given piece. Valid after 00076 // UpdateInformation. 00077 virtual vtkIdType GetNumberOfCellsInPiece(int piece); 00078 00079 // The size of the UpdatePiece. 00080 int TotalNumberOfVerts; 00081 int TotalNumberOfLines; 00082 int TotalNumberOfStrips; 00083 int TotalNumberOfPolys; 00084 vtkIdType StartVert; 00085 vtkIdType StartLine; 00086 vtkIdType StartStrip; 00087 vtkIdType StartPoly; 00088 00089 // The cell elements for each piece. 00090 vtkXMLDataElement** VertElements; 00091 vtkXMLDataElement** LineElements; 00092 vtkXMLDataElement** StripElements; 00093 vtkXMLDataElement** PolyElements; 00094 vtkIdType* NumberOfVerts; 00095 vtkIdType* NumberOfLines; 00096 vtkIdType* NumberOfStrips; 00097 vtkIdType* NumberOfPolys; 00098 00099 private: 00100 vtkXMLPolyDataReader(const vtkXMLPolyDataReader&); // Not implemented. 00101 void operator=(const vtkXMLPolyDataReader&); // Not implemented. 00102 }; 00103 00104 #endif