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