VTK: IO/Export/vtkX3DExporterXMLWriter.h Source File

| VTK 9.3.1

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:
24 static vtkX3DExporterXMLWriter* New();
25 vtkTypeMacro(vtkX3DExporterXMLWriter, vtkX3DExporterWriter);
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:
61 vtkX3DExporterXMLWriter();
62 ~vtkX3DExporterXMLWriter() override;
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
74 vtkX3DExporterXMLWriter(const vtkX3DExporterXMLWriter&) = delete;
75 void operator=(const vtkX3DExporterXMLWriter&) = delete;
76 };
77
78 VTK_ABI_NAMESPACE_END
79 #endif
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkX3DExporterWriter
X3D Exporter Writer.
Definition: vtkX3DExporterWriter.h:25
vtkX3DExporterXMLWriter
X3D Exporter XML Writer.
Definition: vtkX3DExporterXMLWriter.h:21
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, int type, vtkDataArray *a) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, double) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::vtkX3DExporterXMLWriter
vtkX3DExporterXMLWriter()
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, float) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, const char *, bool mfstring=true) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::New
static vtkX3DExporterXMLWriter * New()
vtkX3DExporterXMLWriter::SetField
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.
vtkX3DExporterXMLWriter::EndNode
void EndNode() override
Starts/ends a new X3D node specified via nodeID.
vtkX3DExporterXMLWriter::SetField
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.
vtkX3DExporterXMLWriter::Flush
void Flush() override
vtkX3DExporterXMLWriter::OpenFile
int OpenFile(const char *file) override
Opens the file specified with file returns 1 if successful otherwise 0.
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, int type, const double *a) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::EndDocument
void EndDocument() override
Ends a document and sets all necessary information or necessary bytes to finish the encoding correctl...
vtkX3DExporterXMLWriter::OpenStream
int OpenStream() override
Init data support to be a stream instead of a file.
vtkX3DExporterXMLWriter::StartDocument
void StartDocument() override
Starts a document and sets all necessary information, i.e.
vtkX3DExporterXMLWriter::StartNode
void StartNode(int elementID) override
Starts/ends a new X3D node specified via nodeID.
vtkX3DExporterXMLWriter::~vtkX3DExporterXMLWriter
~vtkX3DExporterXMLWriter() override
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, bool) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3DExporterXMLWriter::CloseFile
void CloseFile() override
vtkX3DExporterXMLWriter::SetField
void SetField(int attributeID, int) override
Sets the field specified with attributeID of the active node to the given value.
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::image
@ image
Definition: vtkX3D.h:374
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkX3DExporterWriter.h