VTK  9.3.1
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 
46  vtkSetFilePathMacro(FileName);
47  vtkGetFilePathMacro(FileName);
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 
104  char* RegisterAndGetOutputString();
105 
106 protected:
107  vtkX3DExporter();
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);
123  void WritePointData(vtkPoints* points, vtkDataArray* normals, vtkDataArray* tcoords,
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 
133  vtkTypeBool HasHeadLight(vtkRenderer* ren);
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
vtkTypeBool Binary
vtkTypeBool WriteToOutputString
abstract class to write a scene to a file
Definition: vtkExporter.h:36
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
X3D Exporter Writer.
virtual void WriteData()=0
a actor that draws 2D data
Definition: vtkActor2D.h:34
vtkIdType OutputStringLength
abstract specification for renderers
Definition: vtkRenderer.h:61
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
create an x3d file
int vtkTypeBool
Definition: vtkABI.h:64
virtual void WriteAdditionalNodes(vtkX3DExporterWriter *vtkNotUsed(writer))
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkTypeBool Fastest
a virtual light for 3D rendering
Definition: vtkLight.h:48
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
dynamic, self-adjusting array of unsigned char
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:28