VTK
|
00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkXMLCompositeDataReader.h 00005 00006 Copyright (c) Kitware, Inc. 00007 All rights reserved. 00008 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 vtkXMLCompositeDataReader_h 00029 #define vtkXMLCompositeDataReader_h 00030 00031 #include "vtkIOXMLModule.h" // For export macro 00032 #include "vtkXMLReader.h" 00033 00034 class vtkCompositeDataSet; 00035 class vtkInformationIntegerKey; 00036 class vtkInformationIntegerVectorKey; 00037 //BTX 00038 struct vtkXMLCompositeDataReaderInternals; 00039 //ETX 00040 00041 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader 00042 { 00043 public: 00044 vtkTypeMacro(vtkXMLCompositeDataReader,vtkXMLReader); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 00048 00049 vtkCompositeDataSet* GetOutput(); 00050 vtkCompositeDataSet* GetOutput(int); 00052 00053 protected: 00054 vtkXMLCompositeDataReader(); 00055 ~vtkXMLCompositeDataReader(); 00056 00057 // Get the name of the data set being read. 00058 virtual const char* GetDataSetName(); 00059 00060 // Returns the primary element pass to ReadPrimaryElement(). 00061 vtkXMLDataElement* GetPrimaryElement(); 00062 00063 virtual void ReadXMLData(); 00064 virtual int ReadPrimaryElement(vtkXMLDataElement* ePrimary); 00065 00066 // Setup the output with no data available. Used in error cases. 00067 virtual void SetupEmptyOutput(); 00068 00069 virtual int FillOutputPortInformation(int, vtkInformation* info); 00070 00071 // Create a default executive. 00072 virtual vtkExecutive* CreateDefaultExecutive(); 00073 00074 vtkXMLReader* GetReaderOfType(const char* type); 00075 00076 virtual int RequestInformation(vtkInformation*, 00077 vtkInformationVector**, 00078 vtkInformationVector*); 00079 00080 00081 00082 // Adds a child data object to the composite parent. childXML is the XML for 00083 // the child data object need to obtain certain meta-data about the child. 00084 void AddChild(vtkCompositeDataSet* parent, 00085 vtkDataObject* child, vtkXMLDataElement* childXML); 00086 00087 // Read the XML element for the subtree of a the composite dataset. 00088 // dataSetIndex is used to rank the leaf nodes in an inorder traversal. 00089 virtual void ReadComposite(vtkXMLDataElement* element, 00090 vtkCompositeDataSet* composite, const char* filePath, 00091 unsigned int &dataSetIndex)=0; 00092 00093 // Read the vtkDataSet (a leaf) in the composite dataset. 00094 virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath); 00095 00096 // Counts "DataSet" elements in the subtree. 00097 unsigned int CountLeaves(vtkXMLDataElement* elem); 00098 00101 int ShouldReadDataSet(unsigned int datasetIndex); 00102 00104 00105 virtual int CanReadFileVersion(int major, int vtkNotUsed(minor)) 00106 { 00107 if (major > 1) 00108 { 00109 return 0; 00110 } 00111 return 1; 00112 } 00114 00115 private: 00116 vtkXMLCompositeDataReader(const vtkXMLCompositeDataReader&); // Not implemented. 00117 void operator=(const vtkXMLCompositeDataReader&); // Not implemented. 00118 00119 vtkXMLCompositeDataReaderInternals* Internal; 00120 }; 00121 00122 #endif