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