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