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 #include <string> // for std::string
28 
29 class vtkX3DExporterXMLNodeInfoStack;
30 
31 class VTKIOEXPORT_EXPORT vtkX3DExporterXMLWriter : public vtkX3DExporterWriter
32 {
33 
34 public:
35  static vtkX3DExporterXMLWriter *New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
39  void CloseFile() override;
40  int OpenFile(const char* file) override;
41  void Flush() override;
42 
43  int OpenStream() override;
44 
45  void StartDocument() override;
46  void EndDocument() override;
47 
48  // Elements
49  void StartNode(int elementID) override;
50  void EndNode() override;
51 
52  // Attributes
53  // SFString / MFString
54  void SetField(int attributeID, const char*, bool mfstring = true) override;
55  // SFInt32
56  void SetField(int attributeID, int) override;
57  // SFFloat
58  void SetField(int attributeID, float) override;
59  // SFDouble
60  void SetField(int attributeID, double) override;
61  // SFBool
62  void SetField(int attributeID, bool) override;
63 
64  // For MFxxx attributes
65  void SetField(int attributeID, int type, const double* a) override;
66  void SetField(int attributeID, int type, vtkDataArray* a) override;
67  void SetField(int attributeID, const double* values, size_t size) override;
68  // MFInt32, SFIMAGE
69  void SetField(int attributeID, const int* values, size_t size, bool image = false) override;
70 
71 protected:
73  ~vtkX3DExporterXMLWriter() override;
74 
75 private:
76 
77  const char* GetNewline() { return "\n"; };
78  void AddDepth();
79  void SubDepth();
80 
81  std::string ActTab;
82  int Depth;
83  ostream *OutputStream;
84  vtkX3DExporterXMLNodeInfoStack* InfoStack;
85 
87  void operator=(const vtkX3DExporterXMLWriter&) = delete;
88 
89 };
90 
91 #endif
92 
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.