VTK  9.3.20240418
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
37 #ifndef vtkX3DExporter_h
38 #define vtkX3DExporter_h
39 
40 #include "vtkExporter.h"
41 #include "vtkIOExportModule.h" // For export macro
42 
43 VTK_ABI_NAMESPACE_BEGIN
44 class vtkActor;
45 class vtkActor2D;
46 class vtkDataArray;
47 class vtkLight;
48 class vtkPoints;
49 class vtkPolyData;
50 class vtkRenderer;
53 
54 class VTKIOEXPORT_EXPORT vtkX3DExporter : public vtkExporter
55 {
56 public:
57  static vtkX3DExporter* New();
58  vtkTypeMacro(vtkX3DExporter, vtkExporter);
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
62 
68 
70 
73  vtkSetMacro(Speed, double);
74  vtkGetMacro(Speed, double);
76 
78 
81  vtkSetClampMacro(Binary, vtkTypeBool, 0, 1);
82  vtkBooleanMacro(Binary, vtkTypeBool);
83  vtkGetMacro(Binary, vtkTypeBool);
85 
87 
90  vtkSetClampMacro(Fastest, vtkTypeBool, 0, 1);
91  vtkBooleanMacro(Fastest, vtkTypeBool);
92  vtkGetMacro(Fastest, vtkTypeBool);
94 
96 
99  vtkSetMacro(WriteToOutputString, vtkTypeBool);
100  vtkGetMacro(WriteToOutputString, vtkTypeBool);
101  vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
103 
105 
110  vtkGetMacro(OutputStringLength, vtkIdType);
111  vtkGetStringMacro(OutputString);
112  unsigned char* GetBinaryOutputString()
113  {
114  return reinterpret_cast<unsigned char*>(this->OutputString);
115  }
117 
124 
125 protected:
127  ~vtkX3DExporter() override;
128 
129  // Stream management
133 
137  void WriteData() override;
138 
139  void WriteALight(vtkLight* aLight, vtkX3DExporterWriter* writer);
140  void WriteAnActor(vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
141  void WriteAPiece(vtkPolyData* piece, vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
143  vtkUnsignedCharArray* colors, vtkX3DExporterWriter* writer, int index);
144  void WriteATextActor2D(vtkActor2D* anTextActor2D, vtkX3DExporterWriter* writer);
145  void WriteATexture(vtkActor* anActor, vtkX3DExporterWriter* writer);
146  void WriteAnAppearance(vtkActor* anActor, bool writeEmissiveColor, vtkX3DExporterWriter* writer);
147 
148  // Called to give subclasses a chance to write additional nodes to the file.
149  // Default implementation does nothing.
150  virtual void WriteAdditionalNodes(vtkX3DExporterWriter* vtkNotUsed(writer)) {}
151 
153 
154  char* FileName;
155  double Speed;
158 
159 private:
160  vtkX3DExporter(const vtkX3DExporter&) = delete;
161  void operator=(const vtkX3DExporter&) = delete;
162 };
163 
164 VTK_ABI_NAMESPACE_END
165 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:145
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
abstract class to write a scene to a file
Definition: vtkExporter.h:37
a simple class to control print indentation
Definition: vtkIndent.h:108
a virtual light for 3D rendering
Definition: vtkLight.h:159
represent and manipulate 3D points
Definition: vtkPoints.h:139
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
abstract specification for renderers
Definition: vtkRenderer.h:172
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