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) override;
37 
38  void CloseFile() override;
39  int OpenFile(const char* file) override;
40  void Flush() override;
41 
42  int OpenStream() override;
43 
44  void StartDocument() override;
45  void EndDocument() override;
46 
47  // Elements
48  void StartNode(int elementID) override;
49  void EndNode() override;
50 
51  // Attributes
52  // SFString / MFString
53  void SetField(int attributeID, const char*, bool mfstring = true) override;
54  // SFInt32
55  void SetField(int attributeID, int) override;
56  // SFFloat
57  void SetField(int attributeID, float) override;
58  // SFDouble
59  void SetField(int attributeID, double) override;
60  // SFBool
61  void SetField(int attributeID, bool) override;
62 
63  // For MFxxx attributes
64  void SetField(int attributeID, int type, const double* a) override;
65  void SetField(int attributeID, int type, vtkDataArray* a) override;
66  void SetField(int attributeID, const double* values, size_t size) override;
67  // MFInt32, SFIMAGE
68  void SetField(int attributeID, const int* values, size_t size, bool image = false) override;
69 
70 protected:
72  ~vtkX3DExporterXMLWriter() override;
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 
86  void operator=(const vtkX3DExporterXMLWriter&) = delete;
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) override
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 information, i.e.
virtual void EndDocument()=0
Ends a document and sets all necessary information or necessary bytes to finish the encoding correctl...
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.