VTK  9.1.0
vtkX3DExporter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkX3DExporter.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 =========================================================================*/
46 #ifndef vtkX3DExporter_h
47 #define vtkX3DExporter_h
48 
49 #include "vtkExporter.h"
50 #include "vtkIOExportModule.h" // For export macro
51 
52 class vtkActor;
53 class vtkActor2D;
54 class vtkDataArray;
55 class vtkLight;
56 class vtkPoints;
57 class vtkPolyData;
58 class vtkRenderer;
61 
62 class VTKIOEXPORT_EXPORT vtkX3DExporter : public vtkExporter
63 {
64 public:
65  static vtkX3DExporter* New();
66  vtkTypeMacro(vtkX3DExporter, vtkExporter);
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
76 
78 
81  vtkSetMacro(Speed, double);
82  vtkGetMacro(Speed, double);
84 
86 
89  vtkSetClampMacro(Binary, vtkTypeBool, 0, 1);
90  vtkBooleanMacro(Binary, vtkTypeBool);
91  vtkGetMacro(Binary, vtkTypeBool);
93 
95 
98  vtkSetClampMacro(Fastest, vtkTypeBool, 0, 1);
99  vtkBooleanMacro(Fastest, vtkTypeBool);
100  vtkGetMacro(Fastest, vtkTypeBool);
102 
104 
107  vtkSetMacro(WriteToOutputString, vtkTypeBool);
108  vtkGetMacro(WriteToOutputString, vtkTypeBool);
109  vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
111 
113 
118  vtkGetMacro(OutputStringLength, vtkIdType);
119  vtkGetStringMacro(OutputString);
120  unsigned char* GetBinaryOutputString()
121  {
122  return reinterpret_cast<unsigned char*>(this->OutputString);
123  }
125 
132 
133 protected:
135  ~vtkX3DExporter() override;
136 
137  // Stream management
141 
145  void WriteData() override;
146 
147  void WriteALight(vtkLight* aLight, vtkX3DExporterWriter* writer);
148  void WriteAnActor(vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
149  void WriteAPiece(vtkPolyData* piece, vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
151  vtkUnsignedCharArray* colors, vtkX3DExporterWriter* writer, int index);
152  void WriteATextActor2D(vtkActor2D* anTextActor2D, vtkX3DExporterWriter* writer);
153  void WriteATexture(vtkActor* anActor, vtkX3DExporterWriter* writer);
154  void WriteAnAppearance(vtkActor* anActor, bool writeEmissiveColor, vtkX3DExporterWriter* writer);
155 
156  // Called to give subclasses a chance to write additional nodes to the file.
157  // Default implementation does nothing.
158  virtual void WriteAdditionalNodes(vtkX3DExporterWriter* vtkNotUsed(writer)) {}
159 
161 
162  char* FileName;
163  double Speed;
166 
167 private:
168  vtkX3DExporter(const vtkX3DExporter&) = delete;
169  void operator=(const vtkX3DExporter&) = delete;
170 };
171 
172 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
abstract class to write a scene to a file
Definition: vtkExporter.h:48
a simple class to control print indentation
Definition: vtkIndent.h:113
a virtual light for 3D rendering
Definition: vtkLight.h:166
represent and manipulate 3D points
Definition: vtkPoints.h:143
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract specification for renderers
Definition: vtkRenderer.h:173
dynamic, self-adjusting array of unsigned char
X3D Exporter Writer.
create an x3d file
int HasHeadLight(vtkRenderer *ren)
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.
~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:452
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332