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 
00041   void StartDocument();
00042   void EndDocument();
00043 
00044   // Elements
00045   void StartNode(int elementID);
00046   void EndNode();
00047   
00048   // Attributes
00049   // SFString / MFString
00050   void SetField(int attributeID, const char*, bool mfstring = true);
00051   // SFInt32
00052   void SetField(int attributeID, int);
00053   // SFFloat
00054   void SetField(int attributeID, float);
00055   // SFDouble
00056   void SetField(int attributeID, double);
00057   // SFBool
00058   void SetField(int attributeID, bool);
00059 
00060   // For MFxxx attributes
00061   void SetField(int attributeID, int type, const double* a);
00062   void SetField(int attributeID, int type, vtkDataArray* a);
00063   void SetField(int attributeID, const double* values, size_t size);
00064   // MFInt32, SFIMAGE
00065   void SetField(int attributeID, const int* values, size_t size, bool image = false);
00066 
00067 protected:
00068   vtkX3DExporterXMLWriter();
00069   ~vtkX3DExporterXMLWriter();
00070 
00071 private:
00072  
00073   const char* GetNewline() { return "\n"; };
00074   void AddDepth();
00075   void SubDepth();
00076 
00077   vtkstd::string ActTab;
00078   int Depth;
00079   ofstream OutputStream;
00080   vtkX3DExporterXMLNodeInfoStack* InfoStack;
00081 
00082   vtkX3DExporterXMLWriter(const vtkX3DExporterXMLWriter&); // Not implemented.
00083   void operator=(const vtkX3DExporterXMLWriter&); // Not implemented.
00084 
00085 };
00086 
00087 #endif
00088