VTK
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 =========================================================================*/
30 #ifndef vtkX3DExporter_h
31 #define vtkX3DExporter_h
32 
33 #include "vtkIOExportModule.h" // For export macro
34 #include "vtkExporter.h"
35 
36 class vtkActor;
37 class vtkActor2D;
38 class vtkDataArray;
39 class vtkLight;
40 class vtkPoints;
41 class vtkPolyData;
42 class vtkRenderer;
45 
46 class VTKIOEXPORT_EXPORT vtkX3DExporter : public vtkExporter
47 {
48 public:
49  static vtkX3DExporter *New();
50  vtkTypeMacro(vtkX3DExporter,vtkExporter);
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
57  vtkSetStringMacro(FileName);
58  vtkGetStringMacro(FileName);
60 
62 
65  vtkSetMacro(Speed,double);
66  vtkGetMacro(Speed,double);
68 
70 
73  vtkSetClampMacro(Binary, vtkTypeBool, 0, 1);
74  vtkBooleanMacro(Binary, vtkTypeBool);
75  vtkGetMacro(Binary, vtkTypeBool);
77 
79 
82  vtkSetClampMacro(Fastest, vtkTypeBool, 0, 1);
83  vtkBooleanMacro(Fastest, vtkTypeBool);
84  vtkGetMacro(Fastest, vtkTypeBool);
86 
88 
91  vtkSetMacro(WriteToOutputString,vtkTypeBool);
92  vtkGetMacro(WriteToOutputString,vtkTypeBool);
93  vtkBooleanMacro(WriteToOutputString,vtkTypeBool);
95 
97 
102  vtkGetMacro(OutputStringLength, int);
103  vtkGetStringMacro(OutputString);
104  unsigned char *GetBinaryOutputString()
105  {
106  return reinterpret_cast<unsigned char *>(this->OutputString);
107  }
109 
115  char *RegisterAndGetOutputString();
116 
117 protected:
118  vtkX3DExporter();
119  ~vtkX3DExporter() override;
120 
121  // Stream management
125 
129  void WriteData() override;
130 
131  void WriteALight(vtkLight *aLight, vtkX3DExporterWriter* writer);
132  void WriteAnActor(vtkActor *anActor, vtkX3DExporterWriter* writer,
133  int index);
134  void WriteAPiece(vtkPolyData* piece, vtkActor *anActor, vtkX3DExporterWriter* writer, int index);
135  void WritePointData(vtkPoints *points, vtkDataArray *normals,
136  vtkDataArray *tcoords, vtkUnsignedCharArray *colors,
137  vtkX3DExporterWriter* writer, int index);
138  void WriteATextActor2D(vtkActor2D *anTextActor2D,
139  vtkX3DExporterWriter* writer);
140  void WriteATexture(vtkActor *anActor, vtkX3DExporterWriter* writer);
141  void WriteAnAppearance(vtkActor *anActor, bool writeEmissiveColor, vtkX3DExporterWriter* writer);
142 
143  // Called to give subclasses a chance to write additional nodes to the file.
144  // Default implementation does nothing.
145  virtual void WriteAdditionalNodes(vtkX3DExporterWriter* vtkNotUsed(writer)) {}
146 
147  int HasHeadLight(vtkRenderer* ren);
148 
149  char *FileName;
150  double Speed;
153 
154 private:
155 
156  vtkX3DExporter(const vtkX3DExporter&) = delete;
157  void operator=(const vtkX3DExporter&) = delete;
158 };
159 
160 
161 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkX3DExporter::Binary
vtkTypeBool Binary
Definition: vtkX3DExporter.h:151
vtkLight
a virtual light for 3D rendering
Definition: vtkLight.h:62
vtkX3DExporter::OutputStringLength
int OutputStringLength
Definition: vtkX3DExporter.h:124
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:104
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkExporter::WriteData
virtual void WriteData()=0
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkX3DExporter::Speed
double Speed
Definition: vtkX3DExporter.h:150
vtkX3DExporter::WriteToOutputString
vtkTypeBool WriteToOutputString
Definition: vtkX3DExporter.h:122
vtkX3D::points
Definition: vtkX3D.h:446
vtkX3DExporter::OutputString
char * OutputString
Definition: vtkX3DExporter.h:123
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkX3DExporterWriter
X3D Exporter Writer.
Definition: vtkX3DExporterWriter.h:35
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:145
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkX3DExporter::Fastest
vtkTypeBool Fastest
Definition: vtkX3DExporter.h:152
vtkExporter
abstract class to write a scene to a file
Definition: vtkExporter.h:47
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkExporter.h
vtkX3DExporter
create an x3d file
Definition: vtkX3DExporter.h:46
vtkX3D::index
Definition: vtkX3D.h:246
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkX3DExporter::FileName
char * FileName
Definition: vtkX3DExporter.h:149