forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkX3DExporterWriter.h
202 lines (172 loc) · 5.98 KB
/
vtkX3DExporterWriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*=========================================================================
Program: Visualization Toolkit
Module: vtkX3DExporterWriter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkX3DExporterWriter
* @brief X3D Exporter Writer
*
* vtkX3DExporterWriter is the definition for
* classes that implement a encoding for the
* X3D exporter
*/
#ifndef vtkX3DExporterWriter_h
#define vtkX3DExporterWriter_h
#include "vtkIOExportModule.h" // For export macro
#include "vtkObject.h"
// Forward declarations
class vtkDataArray;
class vtkUnsignedCharArray;
class vtkCellArray;
class VTKIOEXPORT_EXPORT vtkX3DExporterWriter : public vtkObject
{
public:
vtkTypeMacro(vtkX3DExporterWriter, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Opens the file specified with file
* returns 1 if successful otherwise 0
*/
virtual int OpenFile(const char* file) = 0;
/**
* Init data support to be a stream instead of a file
*/
virtual int OpenStream() = 0;
///@{
/**
* Enable writing to an OutputString instead of the default, a file.
*/
vtkSetMacro(WriteToOutputString, vtkTypeBool);
vtkGetMacro(WriteToOutputString, vtkTypeBool);
vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
///@}
///@{
/**
* When WriteToOutputString in on, then a string is allocated, written to,
* and can be retrieved with these methods. The string is deleted during
* the next call to write ...
*/
vtkGetMacro(OutputStringLength, vtkIdType);
vtkGetStringMacro(OutputString);
unsigned char* GetBinaryOutputString()
{
return reinterpret_cast<unsigned char*>(this->OutputString);
}
///@}
/**
* This convenience method returns the string, sets the IVAR to nullptr,
* so that the user is responsible for deleting the string.
* I am not sure what the name should be, so it may change in the future.
*/
char* RegisterAndGetOutputString();
// Closes the file if open
virtual void CloseFile() = 0;
// Flush can be called optionally after some operations to
// flush the buffer to the filestream. A writer not necessarily
// implements this function
virtual void Flush() {}
/**
* Starts a document and sets all necessary information,
* i.e. the header of the implemented encoding
*/
virtual void StartDocument() = 0;
/**
* Ends a document and sets all necessary information
* or necessary bytes to finish the encoding correctly
*/
virtual void EndDocument() = 0;
///@{
/**
* Starts/ends a new X3D node specified via nodeID. The list of
* nodeIds can be found in vtkX3DExportWriterSymbols.h. The EndNode
* function closes the last open node. So there must be
* corresponding Start/EndNode() calls for every node
*/
virtual void StartNode(int nodeID) = 0;
virtual void EndNode() = 0;
///@}
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is SFString and MFString
* virtual void SetField(int attributeID, const std::string &value) = 0;
*/
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.
* The type of the field is SFInt32
*/
virtual void SetField(int attributeID, int) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is SFFloat
*/
virtual void SetField(int attributeID, float) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is SFDouble
*/
virtual void SetField(int attributeID, double) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is SFBool
*/
virtual void SetField(int attributeID, bool) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is specified with type
* Supported types: SFVEC3F, SFCOLOR, SFROTATION
*/
virtual void SetField(int attributeID, int type, const double* a) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is specified with type
* Supported types: MFVEC3F, MFVEC2F
*/
virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is specified with type
* Supported types: MFCOLOR
*/
virtual void SetField(int attributeID, const double* values, size_t size) = 0;
/**
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is specified with type
* It is possible to specify that the field is an
* image for optimized formatting or compression
* Supported types: MFINT32, SFIMAGE
*/
virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0;
/*
* Sets the field specified with attributeID
* of the active node to the given value.
* The type of the field is specified with type
* Supported types: MFString
*/
// virtual void SetField(int attributeID, int type, std::string) = 0;
protected:
vtkX3DExporterWriter();
~vtkX3DExporterWriter() override;
char* OutputString;
vtkIdType OutputStringLength;
vtkTypeBool WriteToOutputString;
private:
vtkX3DExporterWriter(const vtkX3DExporterWriter&) = delete;
void operator=(const vtkX3DExporterWriter&) = delete;
};
#endif