VTK  9.3.20240328
vtkX3DExporterXMLWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
10 #ifndef vtkX3DExporterXMLWriter_h
11 #define vtkX3DExporterXMLWriter_h
12 
13 #include "vtkIOExportModule.h" // For export macro
14 #include "vtkX3DExporterWriter.h"
15 #include <string> // for std::string
16 
17 VTK_ABI_NAMESPACE_BEGIN
18 class vtkX3DExporterXMLNodeInfoStack;
19 
20 class VTKIOEXPORT_EXPORT vtkX3DExporterXMLWriter : public vtkX3DExporterWriter
21 {
22 
23 public:
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
28  void CloseFile() override;
29  int OpenFile(const char* file) override;
30  void Flush() override;
31 
32  int OpenStream() override;
33 
34  void StartDocument() override;
35  void EndDocument() override;
36 
37  // Elements
38  void StartNode(int elementID) override;
39  void EndNode() override;
40 
41  // Attributes
42  // SFString / MFString
43  void SetField(int attributeID, const char*, bool mfstring = true) override;
44  // SFInt32
45  void SetField(int attributeID, int) override;
46  // SFFloat
47  void SetField(int attributeID, float) override;
48  // SFDouble
49  void SetField(int attributeID, double) override;
50  // SFBool
51  void SetField(int attributeID, bool) override;
52 
53  // For MFxxx attributes
54  void SetField(int attributeID, int type, const double* a) override;
55  void SetField(int attributeID, int type, vtkDataArray* a) override;
56  void SetField(int attributeID, const double* values, size_t size) override;
57  // MFInt32, SFIMAGE
58  void SetField(int attributeID, const int* values, size_t size, bool image = false) override;
59 
60 protected:
63 
64 private:
65  const char* GetNewline() { return "\n"; }
66  void AddDepth();
67  void SubDepth();
68 
69  std::string ActTab;
70  int Depth;
71  ostream* OutputStream;
72  vtkX3DExporterXMLNodeInfoStack* InfoStack;
73 
75  void operator=(const vtkX3DExporterXMLWriter&) = delete;
76 };
77 
78 VTK_ABI_NAMESPACE_END
79 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
a simple class to control print indentation
Definition: vtkIndent.h:108
X3D Exporter Writer.
X3D Exporter XML Writer.
void SetField(int attributeID, int type, vtkDataArray *a) override
Sets the field specified with attributeID of the active node to the given value.
void SetField(int attributeID, double) override
Sets the field specified with attributeID of the active node to the given value.
void SetField(int attributeID, float) override
Sets the field specified with attributeID of the active node to the given value.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetField(int attributeID, const char *, bool mfstring=true) override
Sets the field specified with attributeID of the active node to the given value.
static vtkX3DExporterXMLWriter * New()
void SetField(int attributeID, const int *values, size_t size, bool image=false) override
Sets the field specified with attributeID of the active node to the given value.
void EndNode() override
Starts/ends a new X3D node specified via nodeID.
void SetField(int attributeID, const double *values, size_t size) override
Sets the field specified with attributeID of the active node to the given value.
void Flush() override
int OpenFile(const char *file) override
Opens the file specified with file returns 1 if successful otherwise 0.
void SetField(int attributeID, int type, const double *a) override
Sets the field specified with attributeID of the active node to the given value.
void EndDocument() override
Ends a document and sets all necessary information or necessary bytes to finish the encoding correctl...
int OpenStream() override
Init data support to be a stream instead of a file.
void StartDocument() override
Starts a document and sets all necessary information, i.e.
void StartNode(int elementID) override
Starts/ends a new X3D node specified via nodeID.
~vtkX3DExporterXMLWriter() override
void SetField(int attributeID, bool) override
Sets the field specified with attributeID of the active node to the given value.
void CloseFile() override
void SetField(int attributeID, int) override
Sets the field specified with attributeID of the active node to the given value.
@ type
Definition: vtkX3D.h:516
@ image
Definition: vtkX3D.h:374
@ size
Definition: vtkX3D.h:253
@ string
Definition: vtkX3D.h:490