VTK  9.3.1
vtkX3DExporterWriter.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
12 #ifndef vtkX3DExporterWriter_h
13 #define vtkX3DExporterWriter_h
14 
15 #include "vtkIOExportModule.h" // For export macro
16 #include "vtkObject.h"
17 
18 // Forward declarations
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkDataArray;
22 class vtkCellArray;
23 
24 class VTKIOEXPORT_EXPORT vtkX3DExporterWriter : public vtkObject
25 {
26 public:
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
34  virtual int OpenFile(const char* file) = 0;
35 
39  virtual int OpenStream() = 0;
40 
42 
45  vtkSetMacro(WriteToOutputString, vtkTypeBool);
46  vtkGetMacro(WriteToOutputString, vtkTypeBool);
47  vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
49 
51 
56  vtkGetMacro(OutputStringLength, vtkIdType);
57  vtkGetStringMacro(OutputString);
58  unsigned char* GetBinaryOutputString()
59  {
60  return reinterpret_cast<unsigned char*>(this->OutputString);
61  }
63 
69  char* RegisterAndGetOutputString();
70 
71  // Closes the file if open
72  virtual void CloseFile() = 0;
73  // Flush can be called optionally after some operations to
74  // flush the buffer to the filestream. A writer not necessarily
75  // implements this function
76  virtual void Flush() {}
77 
82  virtual void StartDocument() = 0;
83 
88  virtual void EndDocument() = 0;
89 
91 
97  virtual void StartNode(int nodeID) = 0;
98  virtual void EndNode() = 0;
100 
107  virtual void SetField(int attributeID, const char* value, bool mfstring = false) = 0;
108 
114  virtual void SetField(int attributeID, int) = 0;
115 
121  virtual void SetField(int attributeID, float) = 0;
122 
128  virtual void SetField(int attributeID, double) = 0;
129 
135  virtual void SetField(int attributeID, bool) = 0;
136 
143  virtual void SetField(int attributeID, int type, const double* a) = 0;
144 
151  virtual void SetField(int attributeID, int type, vtkDataArray* a) = 0;
152 
159  virtual void SetField(int attributeID, const double* values, size_t size) = 0;
160 
169  virtual void SetField(int attributeID, const int* values, size_t size, bool image = false) = 0;
170 
171  /*
172  * Sets the field specified with attributeID
173  * of the active node to the given value.
174  * The type of the field is specified with type
175  * Supported types: MFString
176  */
177  // virtual void SetField(int attributeID, int type, std::string) = 0;
178 
179 protected:
181  ~vtkX3DExporterWriter() override;
182 
186 
187 private:
189  void operator=(const vtkX3DExporterWriter&) = delete;
190 };
191 VTK_ABI_NAMESPACE_END
192 #endif
X3D Exporter Writer.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:315
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
dynamic, self-adjusting array of unsigned char
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
object to represent cell connectivity
Definition: vtkCellArray.h:175