VTK  9.3.0
vtkX3DExporter.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
18 #ifndef vtkX3DExporter_h
19 #define vtkX3DExporter_h
20 
21 #include "vtkExporter.h"
22 #include "vtkIOExportModule.h" // For export macro
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkActor;
26 class vtkActor2D;
27 class vtkDataArray;
28 class vtkLight;
29 class vtkPoints;
30 class vtkPolyData;
31 class vtkRenderer;
34 
35 class VTKIOEXPORT_EXPORT vtkX3DExporter : public vtkExporter
36 {
37 public:
38  static vtkX3DExporter* New();
39  vtkTypeMacro(vtkX3DExporter, vtkExporter);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
49 
51 
54  vtkSetMacro(Speed, double);
55  vtkGetMacro(Speed, double);
57 
59 
62  vtkSetClampMacro(Binary, vtkTypeBool, 0, 1);
63  vtkBooleanMacro(Binary, vtkTypeBool);
64  vtkGetMacro(Binary, vtkTypeBool);
66 
68 
71  vtkSetClampMacro(Fastest, vtkTypeBool, 0, 1);
72  vtkBooleanMacro(Fastest, vtkTypeBool);
73  vtkGetMacro(Fastest, vtkTypeBool);
75 
77 
80  vtkSetMacro(WriteToOutputString, vtkTypeBool);
81  vtkGetMacro(WriteToOutputString, vtkTypeBool);
82  vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
84 
86 
91  vtkGetMacro(OutputStringLength, vtkIdType);
92  vtkGetStringMacro(OutputString);
93  unsigned char* GetBinaryOutputString()
94  {
95  return reinterpret_cast<unsigned char*>(this->OutputString);
96  }
98 
105 
106 protected:
108  ~vtkX3DExporter() override;
109 
110  // Stream management
114 
118  void WriteData() override;
119 
120  void WriteALight(vtkLight* aLight, vtkX3DExporterWriter* writer);
121  void WriteAnActor(vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
122  void WriteAPiece(vtkPolyData* piece, vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
124  vtkUnsignedCharArray* colors, vtkX3DExporterWriter* writer, int index);
125  void WriteATextActor2D(vtkActor2D* anTextActor2D, vtkX3DExporterWriter* writer);
126  void WriteATexture(vtkActor* anActor, vtkX3DExporterWriter* writer);
127  void WriteAnAppearance(vtkActor* anActor, bool writeEmissiveColor, vtkX3DExporterWriter* writer);
128 
129  // Called to give subclasses a chance to write additional nodes to the file.
130  // Default implementation does nothing.
131  virtual void WriteAdditionalNodes(vtkX3DExporterWriter* vtkNotUsed(writer)) {}
132 
134 
135  char* FileName;
136  double Speed;
139 
140 private:
141  vtkX3DExporter(const vtkX3DExporter&) = delete;
142  void operator=(const vtkX3DExporter&) = delete;
143 };
144 
145 VTK_ABI_NAMESPACE_END
146 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:35
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
abstract class to write a scene to a file
Definition: vtkExporter.h:37
a simple class to control print indentation
Definition: vtkIndent.h:29
a virtual light for 3D rendering
Definition: vtkLight.h:49
represent and manipulate 3D points
Definition: vtkPoints.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
abstract specification for renderers
Definition: vtkRenderer.h:62
dynamic, self-adjusting array of unsigned char
X3D Exporter Writer.
create an x3d file
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
vtkTypeBool WriteToOutputString
vtkTypeBool Fastest
vtkSetFilePathMacro(FileName)
Set/Get the output file name.
vtkGetFilePathMacro(FileName)
Set/Get the output file name.
void WriteALight(vtkLight *aLight, vtkX3DExporterWriter *writer)
vtkIdType OutputStringLength
void WriteATexture(vtkActor *anActor, vtkX3DExporterWriter *writer)
void WriteAnAppearance(vtkActor *anActor, bool writeEmissiveColor, vtkX3DExporterWriter *writer)
virtual void WriteAdditionalNodes(vtkX3DExporterWriter *vtkNotUsed(writer))
void WriteAPiece(vtkPolyData *piece, vtkActor *anActor, vtkX3DExporterWriter *writer, int index)
void WriteAnActor(vtkActor *anActor, vtkX3DExporterWriter *writer, int index)
void WriteData() override
Write data to output.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool HasHeadLight(vtkRenderer *ren)
~vtkX3DExporter() override
vtkTypeBool Binary
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
void WriteATextActor2D(vtkActor2D *anTextActor2D, vtkX3DExporterWriter *writer)
static vtkX3DExporter * New()
void WritePointData(vtkPoints *points, vtkDataArray *normals, vtkDataArray *tcoords, vtkUnsignedCharArray *colors, vtkX3DExporterWriter *writer, int index)
@ points
Definition: vtkX3D.h:446
@ index
Definition: vtkX3D.h:246
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315