VTK  9.0.1
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:
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:
74 
75 private:
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 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
a simple class to control print indentation
Definition: vtkIndent.h:34
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
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:522
@ image
Definition: vtkX3D.h:380
@ size
Definition: vtkX3D.h:259
@ string
Definition: vtkX3D.h:496