VTK  9.0.1
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 =========================================================================*/
27 #ifndef vtkX3DExporter_h
28 #define vtkX3DExporter_h
29 
30 #include "vtkExporter.h"
31 #include "vtkIOExportModule.h" // For export macro
32 
33 class vtkActor;
34 class vtkActor2D;
35 class vtkDataArray;
36 class vtkLight;
37 class vtkPoints;
38 class vtkPolyData;
39 class vtkRenderer;
42 
43 class VTKIOEXPORT_EXPORT vtkX3DExporter : public vtkExporter
44 {
45 public:
46  static vtkX3DExporter* New();
47  vtkTypeMacro(vtkX3DExporter, vtkExporter);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  vtkSetStringMacro(FileName);
55  vtkGetStringMacro(FileName);
57 
59 
62  vtkSetMacro(Speed, double);
63  vtkGetMacro(Speed, double);
65 
67 
70  vtkSetClampMacro(Binary, vtkTypeBool, 0, 1);
71  vtkBooleanMacro(Binary, vtkTypeBool);
72  vtkGetMacro(Binary, vtkTypeBool);
74 
76 
79  vtkSetClampMacro(Fastest, vtkTypeBool, 0, 1);
80  vtkBooleanMacro(Fastest, vtkTypeBool);
81  vtkGetMacro(Fastest, vtkTypeBool);
83 
85 
88  vtkSetMacro(WriteToOutputString, vtkTypeBool);
89  vtkGetMacro(WriteToOutputString, vtkTypeBool);
90  vtkBooleanMacro(WriteToOutputString, vtkTypeBool);
92 
94 
99  vtkGetMacro(OutputStringLength, vtkIdType);
100  vtkGetStringMacro(OutputString);
101  unsigned char* GetBinaryOutputString()
102  {
103  return reinterpret_cast<unsigned char*>(this->OutputString);
104  }
106 
112  char* RegisterAndGetOutputString();
113 
114 protected:
115  vtkX3DExporter();
116  ~vtkX3DExporter() override;
117 
118  // Stream management
122 
126  void WriteData() override;
127 
128  void WriteALight(vtkLight* aLight, vtkX3DExporterWriter* writer);
129  void WriteAnActor(vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
130  void WriteAPiece(vtkPolyData* piece, vtkActor* anActor, vtkX3DExporterWriter* writer, int index);
131  void WritePointData(vtkPoints* points, vtkDataArray* normals, vtkDataArray* tcoords,
132  vtkUnsignedCharArray* colors, vtkX3DExporterWriter* writer, int index);
133  void WriteATextActor2D(vtkActor2D* anTextActor2D, vtkX3DExporterWriter* writer);
134  void WriteATexture(vtkActor* anActor, vtkX3DExporterWriter* writer);
135  void WriteAnAppearance(vtkActor* anActor, bool writeEmissiveColor, vtkX3DExporterWriter* writer);
136 
137  // Called to give subclasses a chance to write additional nodes to the file.
138  // Default implementation does nothing.
139  virtual void WriteAdditionalNodes(vtkX3DExporterWriter* vtkNotUsed(writer)) {}
140 
141  int HasHeadLight(vtkRenderer* ren);
142 
143  char* FileName;
144  double Speed;
147 
148 private:
149  vtkX3DExporter(const vtkX3DExporter&) = delete;
150  void operator=(const vtkX3DExporter&) = delete;
151 };
152 
153 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkX3DExporter::Binary
vtkTypeBool Binary
Definition: vtkX3DExporter.h:145
vtkLight
a virtual light for 3D rendering
Definition: vtkLight.h:56
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkX3DExporter::GetBinaryOutputString
unsigned char * GetBinaryOutputString()
Definition: vtkX3DExporter.h:101
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkExporter::WriteData
virtual void WriteData()=0
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkX3DExporter::Speed
double Speed
Definition: vtkX3DExporter.h:144
vtkX3DExporter::WriteToOutputString
vtkTypeBool WriteToOutputString
Definition: vtkX3DExporter.h:119
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkX3DExporter::OutputString
char * OutputString
Definition: vtkX3DExporter.h:120
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkX3DExporterWriter
X3D Exporter Writer.
Definition: vtkX3DExporterWriter.h:35
vtkX3DExporter::OutputStringLength
vtkIdType OutputStringLength
Definition: vtkX3DExporter.h:121
vtkExporter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3DExporter::WriteAdditionalNodes
virtual void WriteAdditionalNodes(vtkX3DExporterWriter *vtkNotUsed(writer))
Definition: vtkX3DExporter.h:139
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkX3DExporter::Fastest
vtkTypeBool Fastest
Definition: vtkX3DExporter.h:146
vtkExporter
abstract class to write a scene to a file
Definition: vtkExporter.h:47
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkExporter.h
vtkX3DExporter
create an x3d file
Definition: vtkX3DExporter.h:43
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkX3DExporter::FileName
char * FileName
Definition: vtkX3DExporter.h:143