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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkX3DExporter::WriteData
void WriteData() override
Write data to output.
vtkX3DExporter::Binary
vtkTypeBool Binary
Definition: vtkX3DExporter.h:164
vtkLight
a virtual light for 3D rendering
Definition: vtkLight.h:166
vtkX3DExporter::WriteATextActor2D
void WriteATextActor2D(vtkActor2D *anTextActor2D, vtkX3DExporterWriter *writer)
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkX3DExporter::GetBinaryOutputString
unsigned char * GetBinaryOutputString()
When WriteToOutputString in on, then a string is allocated, written to, and can be retrieved with the...
Definition: vtkX3DExporter.h:120
vtkX3DExporter::vtkSetFilePathMacro
vtkSetFilePathMacro(FileName)
Set/Get the output file name.
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:145
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
vtkX3DExporter::Speed
double Speed
Definition: vtkX3DExporter.h:163
vtkX3DExporter::WriteAPiece
void WriteAPiece(vtkPolyData *piece, vtkActor *anActor, vtkX3DExporterWriter *writer, int index)
vtkX3DExporter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3DExporter::WriteToOutputString
vtkTypeBool WriteToOutputString
Definition: vtkX3DExporter.h:138
vtkX3DExporter::vtkX3DExporter
vtkX3DExporter()
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkX3DExporter::OutputString
char * OutputString
Definition: vtkX3DExporter.h:139
vtkX3DExporter::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Set/Get the output file name.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkX3DExporterWriter
X3D Exporter Writer.
Definition: vtkX3DExporterWriter.h:36
vtkX3DExporter::OutputStringLength
vtkIdType OutputStringLength
Definition: vtkX3DExporter.h:140
vtkX3DExporter::WriteAnActor
void WriteAnActor(vtkActor *anActor, vtkX3DExporterWriter *writer, int index)
vtkX3DExporter::~vtkX3DExporter
~vtkX3DExporter() override
vtkX3DExporter::RegisterAndGetOutputString
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to nullptr, so that the user is responsible...
vtkX3DExporter::WriteATexture
void WriteATexture(vtkActor *anActor, vtkX3DExporterWriter *writer)
vtkX3DExporter::WriteAdditionalNodes
virtual void WriteAdditionalNodes(vtkX3DExporterWriter *vtkNotUsed(writer))
Definition: vtkX3DExporter.h:158
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkX3DExporter::Fastest
vtkTypeBool Fastest
Definition: vtkX3DExporter.h:165
vtkExporter
abstract class to write a scene to a file
Definition: vtkExporter.h:48
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkX3DExporter::WritePointData
void WritePointData(vtkPoints *points, vtkDataArray *normals, vtkDataArray *tcoords, vtkUnsignedCharArray *colors, vtkX3DExporterWriter *writer, int index)
vtkExporter.h
vtkX3DExporter
create an x3d file
Definition: vtkX3DExporter.h:63
vtkX3DExporter::HasHeadLight
int HasHeadLight(vtkRenderer *ren)
vtkX3DExporter::WriteALight
void WriteALight(vtkLight *aLight, vtkX3DExporterWriter *writer)
vtkX3DExporter::New
static vtkX3DExporter * New()
vtkX3DExporter::WriteAnAppearance
void WriteAnAppearance(vtkActor *anActor, bool writeEmissiveColor, vtkX3DExporterWriter *writer)
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkX3DExporter::FileName
char * FileName
Definition: vtkX3DExporter.h:162