VTK
vtkX3DExporterXMLWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkX3DExporterXMLWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef vtkX3DExporterXMLWriter_h
23 #define vtkX3DExporterXMLWriter_h
24 
25 #include "vtkIOExportModule.h" // For export macro
26 #include "vtkX3DExporterWriter.h"
27 
28 class vtkX3DExporterXMLNodeInfoStack;
29 
30 class VTKIOEXPORT_EXPORT vtkX3DExporterXMLWriter : public vtkX3DExporterWriter
31 {
32 
33 public:
34  static vtkX3DExporterXMLWriter *New();
36  void PrintSelf(ostream& os, vtkIndent indent);
37 
38  virtual void CloseFile();
39  virtual int OpenFile(const char* file);
40  virtual void Flush();
41 
42  virtual int OpenStream();
43 
44  void StartDocument();
45  void EndDocument();
46 
47  // Elements
48  void StartNode(int elementID);
49  void EndNode();
50 
51  // Attributes
52  // SFString / MFString
53  void SetField(int attributeID, const char*, bool mfstring = true);
54  // SFInt32
55  void SetField(int attributeID, int);
56  // SFFloat
57  void SetField(int attributeID, float);
58  // SFDouble
59  void SetField(int attributeID, double);
60  // SFBool
61  void SetField(int attributeID, bool);
62 
63  // For MFxxx attributes
64  void SetField(int attributeID, int type, const double* a);
65  void SetField(int attributeID, int type, vtkDataArray* a);
66  void SetField(int attributeID, const double* values, size_t size);
67  // MFInt32, SFIMAGE
68  void SetField(int attributeID, const int* values, size_t size, bool image = false);
69 
70 protected:
73 
74 private:
75 
76  const char* GetNewline() { return "\n"; };
77  void AddDepth();
78  void SubDepth();
79 
80  std::string ActTab;
81  int Depth;
82  ostream *OutputStream;
83  vtkX3DExporterXMLNodeInfoStack* InfoStack;
84 
85  vtkX3DExporterXMLWriter(const vtkX3DExporterXMLWriter&) VTK_DELETE_FUNCTION;
86  void operator=(const vtkX3DExporterXMLWriter&) VTK_DELETE_FUNCTION;
87 
88 };
89 
90 #endif
91 
X3D Exporter Writer.
virtual void StartNode(int nodeID)=0
Starts/ends a new X3D node specified via nodeID.
virtual void EndNode()=0
Starts/ends a new X3D node specified via nodeID.
virtual void CloseFile()=0
virtual int OpenStream()=0
Init data support to be a stream instead of a file.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void SetField(int attributeID, const char *value, bool mfstring=false)=0
Sets the field specified with attributeID of the active node to the given value.
X3D Exporter XML Writer.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual void StartDocument()=0
Starts a document and sets all necessary informations, i.e.
virtual void EndDocument()=0
Ends a document and sets all necessary informations or necessary bytes to finish the encoding correct...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual int OpenFile(const char *file)=0
Opens the file specified with file returns 1 if successful otherwise 0.