VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkX3DExporterXMLWriter.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 =========================================================================*/ 00021 #ifndef vtkX3DExporterXMLWriter_h 00022 #define vtkX3DExporterXMLWriter_h 00023 00024 #include "vtkIOExportModule.h" // For export macro 00025 #include "vtkX3DExporterWriter.h" 00026 00027 class vtkX3DExporterXMLNodeInfoStack; 00028 00029 class VTKIOEXPORT_EXPORT vtkX3DExporterXMLWriter : public vtkX3DExporterWriter 00030 { 00031 00032 public: 00033 static vtkX3DExporterXMLWriter *New(); 00034 vtkTypeMacro(vtkX3DExporterXMLWriter, vtkX3DExporterWriter); 00035 void PrintSelf(ostream& os, vtkIndent indent); 00036 00037 virtual void CloseFile(); 00038 virtual int OpenFile(const char* file); 00039 virtual void Flush(); 00040 00041 virtual int OpenStream(); 00042 00043 void StartDocument(); 00044 void EndDocument(); 00045 00046 // Elements 00047 void StartNode(int elementID); 00048 void EndNode(); 00049 00050 // Attributes 00051 // SFString / MFString 00052 void SetField(int attributeID, const char*, bool mfstring = true); 00053 // SFInt32 00054 void SetField(int attributeID, int); 00055 // SFFloat 00056 void SetField(int attributeID, float); 00057 // SFDouble 00058 void SetField(int attributeID, double); 00059 // SFBool 00060 void SetField(int attributeID, bool); 00061 00062 // For MFxxx attributes 00063 void SetField(int attributeID, int type, const double* a); 00064 void SetField(int attributeID, int type, vtkDataArray* a); 00065 void SetField(int attributeID, const double* values, size_t size); 00066 // MFInt32, SFIMAGE 00067 void SetField(int attributeID, const int* values, size_t size, bool image = false); 00068 00069 protected: 00070 vtkX3DExporterXMLWriter(); 00071 ~vtkX3DExporterXMLWriter(); 00072 00073 private: 00074 00075 const char* GetNewline() { return "\n"; }; 00076 void AddDepth(); 00077 void SubDepth(); 00078 00079 std::string ActTab; 00080 int Depth; 00081 ostream *OutputStream; 00082 vtkX3DExporterXMLNodeInfoStack* InfoStack; 00083 00084 vtkX3DExporterXMLWriter(const vtkX3DExporterXMLWriter&); // Not implemented. 00085 void operator=(const vtkX3DExporterXMLWriter&); // Not implemented. 00086 00087 }; 00088 00089 #endif 00090