VTK  9.1.0
vtkX3DExporterWriter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkX3DExporterWriter.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=========================================================================*/
24#ifndef vtkX3DExporterWriter_h
25#define vtkX3DExporterWriter_h
26
27#include "vtkIOExportModule.h" // For export macro
28#include "vtkObject.h"
29
30// Forward declarations
31class vtkDataArray;
33class vtkCellArray;
34
35class VTKIOEXPORT_EXPORT vtkX3DExporterWriter : public vtkObject
36{
37public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
45 virtual int OpenFile(const char* file) = 0;
46
50 virtual int OpenStream() = 0;
51
53
56 vtkSetMacro(WriteToOutputString, vtkTypeBool);
57 vtkGetMacro(WriteToOutputString, vtkTypeBool);
58 vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
60
62
67 vtkGetMacro(OutputStringLength, vtkIdType);
68 vtkGetStringMacro(OutputString);
69 unsigned char* GetBinaryOutputString()
70 {
71 return reinterpret_cast<unsigned char*>(this->OutputString);
72 }
74
81
82 // Closes the file if open
83 virtual void CloseFile() = 0;
84 // Flush can be called optionally after some operations to
85 // flush the buffer to the filestream. A writer not necessarily
86 // implements this function
87 virtual void Flush() {}
88
93 virtual void StartDocument() = 0;
94
99 virtual void EndDocument() = 0;
100
102
108 virtual void StartNode(int nodeID) = 0;
109 virtual void EndNode() = 0;
111
118 virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0;
119
125 virtual void SetField(int attributeID, int) = 0;
126
132 virtual void SetField(int attributeID, float) = 0;
133
139 virtual void SetField(int attributeID, double) = 0;
140
146 virtual void SetField(int attributeID, bool) = 0;
147
154 virtual void SetField(int attributeID, int type, const double* a) = 0;
155
162 virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0;
163
170 virtual void SetField(int attributeID, const double* values, size_t size) = 0;
171
180 virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0;
181
182 /*
183 * Sets the field specified with attributeID
184 * of the active node to the given value.
185 * The type of the field is specified with type
186 * Supported types: MFString
187 */
188 // virtual void SetField(int attributeID, int type, std::string) = 0;
189
190protected:
193
197
198private:
200 void operator=(const vtkX3DExporterWriter&) = delete;
201};
202#endif
object to represent cell connectivity
Definition: vtkCellArray.h:290
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
dynamic, self-adjusting array of unsigned char
X3D Exporter Writer.
virtual void SetField(int attributeID, float)=0
Sets the field specified with attributeID of the active node to the given value.
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
virtual void EndNode()=0
Starts/ends a new X3D node specified via nodeID.
virtual void SetField(int attributeID, int)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void StartDocument()=0
Starts a document and sets all necessary information, i.e.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int OpenStream()=0
Init data support to be a stream instead of a file.
virtual void SetField(int attributeID, int type, vtkDataArray *a)=0
Sets the field specified with attributeID of the active node to the given value.
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.
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.
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
virtual int OpenFile(const char *file)=0
Opens the file specified with file returns 1 if successful otherwise 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.
virtual void CloseFile()=0
~vtkX3DExporterWriter() override
virtual void SetField(int attributeID, double)=0
Sets the field specified with attributeID of the active node to the given value.
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.
virtual void SetField(int attributeID, bool)=0
Sets the field specified with attributeID of the active node to the given value.
virtual void StartNode(int nodeID)=0
Starts/ends a new X3D node specified via nodeID.
virtual void EndDocument()=0
Ends a document and sets all necessary information or necessary bytes to finish the encoding correctl...
@ value
Definition: vtkX3D.h:226
@ type
Definition: vtkX3D.h:522
@ image
Definition: vtkX3D.h:380
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332