VTK
vtkDataWriter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkDataWriter.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=========================================================================*/
29#ifndef vtkDataWriter_h
30#define vtkDataWriter_h
31
32#include "vtkIOLegacyModule.h" // For export macro
33#include "vtkWriter.h"
34
35class vtkCellArray;
36class vtkDataArray;
37class vtkDataSet;
38class vtkFieldData;
39class vtkGraph;
40class vtkInformation;
42class vtkPoints;
43class vtkTable;
44
45class VTKIOLEGACY_EXPORT vtkDataWriter : public vtkWriter
46{
47public:
48 vtkTypeMacro(vtkDataWriter,vtkWriter);
49 void PrintSelf(ostream& os, vtkIndent indent);
50
55 static vtkDataWriter *New();
56
58
61 vtkSetStringMacro(FileName);
64
66
69 vtkSetMacro(WriteToOutputString,int);
70 vtkGetMacro(WriteToOutputString,int);
71 vtkBooleanMacro(WriteToOutputString,int);
73
75
80 vtkGetMacro(OutputStringLength, int);
81 vtkGetStringMacro(OutputString);
82 unsigned char *GetBinaryOutputString()
83 {
84 return reinterpret_cast<unsigned char *>(this->OutputString);
85 }
87
93
100
102
105 vtkSetStringMacro(Header);
108
110
114 vtkSetMacro(WriteArrayMetaData, bool)
115 vtkGetMacro(WriteArrayMetaData, bool)
116 vtkBooleanMacro(WriteArrayMetaData, bool)
118
120
123 vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
124 vtkGetMacro(FileType,int);
125 void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
126 void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
128
130
134 vtkSetStringMacro(ScalarsName);
135 vtkGetStringMacro(ScalarsName);
137
139
143 vtkSetStringMacro(VectorsName);
144 vtkGetStringMacro(VectorsName);
146
148
152 vtkSetStringMacro(TensorsName);
153 vtkGetStringMacro(TensorsName);
155
157
161 vtkSetStringMacro(NormalsName);
162 vtkGetStringMacro(NormalsName);
164
166
170 vtkSetStringMacro(TCoordsName);
171 vtkGetStringMacro(TCoordsName);
173
175
179 vtkSetStringMacro(GlobalIdsName);
180 vtkGetStringMacro(GlobalIdsName);
182
184
188 vtkSetStringMacro(PedigreeIdsName);
189 vtkGetStringMacro(PedigreeIdsName);
191
193
197 vtkSetStringMacro(EdgeFlagsName);
198 vtkGetStringMacro(EdgeFlagsName);
200
202
206 vtkSetStringMacro(LookupTableName);
207 vtkGetStringMacro(LookupTableName);
209
211
215 vtkSetStringMacro(FieldDataName);
216 vtkGetStringMacro(FieldDataName);
218
222 virtual ostream *OpenVTKFile();
223
227 int WriteHeader(ostream *fp);
228
232 int WritePoints(ostream *fp, vtkPoints *p);
233
237 int WriteCoordinates(ostream *fp, vtkDataArray *coords, int axes);
238
242 int WriteCells(ostream *fp, vtkCellArray *cells, const char *label);
243
248 int WriteCellData(ostream *fp, vtkDataSet *ds);
249
254 int WritePointData(ostream *fp, vtkDataSet *ds);
255
260 int WriteEdgeData(ostream *fp, vtkGraph *g);
261
266 int WriteVertexData(ostream *fp, vtkGraph *g);
267
272 int WriteRowData(ostream *fp, vtkTable *g);
273
277 int WriteFieldData(ostream *fp, vtkFieldData *f);
278
283 int WriteDataSetData(ostream *fp, vtkDataSet *ds);
284
288 void CloseVTKFile(ostream *fp);
289
290
291protected:
294
298
299 void WriteData(); //dummy method to allow this class to be instantiated and delegated to
300
301 char *FileName;
302 char *Header;
304
306
317
318 int WriteArray(ostream *fp, int dataType, vtkAbstractArray *data, const char *format,
319 int num, int numComp);
320 int WriteScalarData(ostream *fp, vtkDataArray *s, int num);
321 int WriteVectorData(ostream *fp, vtkDataArray *v, int num);
322 int WriteNormalData(ostream *fp, vtkDataArray *n, int num);
323 int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num);
324 int WriteTensorData(ostream *fp, vtkDataArray *t, int num);
325 int WriteGlobalIdData(ostream *fp, vtkDataArray *g, int num);
326 int WritePedigreeIdData(ostream *fp, vtkAbstractArray *p, int num);
327 int WriteEdgeFlagsData(ostream *fp, vtkDataArray *edgeFlags, int num);
328
330
335
336private:
337 vtkDataWriter(const vtkDataWriter&) VTK_DELETE_FUNCTION;
338 void operator=(const vtkDataWriter&) VTK_DELETE_FUNCTION;
339};
340
341#endif
Abstract superclass for all arrays.
object to represent cell connectivity
Definition: vtkCellArray.h:51
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
helper class for objects that write vtk data files
Definition: vtkDataWriter.h:46
int WriteEdgeData(ostream *fp, vtkGraph *g)
Write the edge data (e.g., scalars, vectors, ...) of a vtk graph.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int WritePointData(ostream *fp, vtkDataSet *ds)
Write the point data (e.g., scalars, vectors, ...) of a vtk dataset.
int WriteEdgeFlagsData(ostream *fp, vtkDataArray *edgeFlags, int num)
int WriteDataSetData(ostream *fp, vtkDataSet *ds)
Write out the data associated with the dataset (i.e.
int WriteVectorData(ostream *fp, vtkDataArray *v, int num)
char * LookupTableName
void WriteData()
char * EdgeFlagsName
vtkStdString GetOutputStdString()
When WriteToOutputString is on, this method returns a copy of the output string in a vtkStdString.
char * VectorsName
int WritePedigreeIdData(ostream *fp, vtkAbstractArray *p, int num)
void SetFileTypeToBinary()
char * TCoordsName
char * NormalsName
int WriteInformation(ostream *fp, vtkInformation *info)
Format is detailed here.
char * ScalarsName
int WriteVertexData(ostream *fp, vtkGraph *g)
Write the vertex data (e.g., scalars, vectors, ...) of a vtk graph.
int WriteHeader(ostream *fp)
Write the header of a vtk data file.
int WriteCells(ostream *fp, vtkCellArray *cells, const char *label)
Write out the cells of the data set.
virtual ostream * OpenVTKFile()
Open a vtk data file.
static vtkDataWriter * New()
Created object with default header, ASCII format, and default names for scalars, vectors,...
int WriteCoordinates(ostream *fp, vtkDataArray *coords, int axes)
Write out coordinates for rectilinear grids.
char * FieldDataName
char * PedigreeIdsName
void CloseVTKFile(ostream *fp)
Close a vtk file.
char * OutputString
char * RegisterAndGetOutputString()
This convenience method returns the string, sets the IVAR to NULL, so that the user is responsible fo...
char * GlobalIdsName
int WriteGlobalIdData(ostream *fp, vtkDataArray *g, int num)
int WriteScalarData(ostream *fp, vtkDataArray *s, int num)
int WriteTensorData(ostream *fp, vtkDataArray *t, int num)
int WriteNormalData(ostream *fp, vtkDataArray *n, int num)
int WritePoints(ostream *fp, vtkPoints *p)
Write out the points of the data set.
int WriteFieldData(ostream *fp, vtkFieldData *f)
Write out the field data.
char * TensorsName
unsigned char * GetBinaryOutputString()
Definition: vtkDataWriter.h:82
int WriteTCoordData(ostream *fp, vtkDataArray *tc, int num)
bool WriteArrayMetaData
int WriteCellData(ostream *fp, vtkDataSet *ds)
Write the cell data (e.g., scalars, vectors, ...) of a vtk dataset.
int WriteRowData(ostream *fp, vtkTable *g)
Write the row data (e.g., scalars, vectors, ...) of a vtk table.
bool CanWriteInformationKey(vtkInformation *info, vtkInformationKey *key)
int WriteArray(ostream *fp, int dataType, vtkAbstractArray *data, const char *format, int num, int numComp)
represent and manipulate fields of data
Definition: vtkFieldData.h:57
Base class for graph data types.
Definition: vtkGraph.h:288
a simple class to control print indentation
Definition: vtkIndent.h:40
Superclass for vtkInformation keys.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:40
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
abstract class to write data to file(s)
Definition: vtkWriter.h:43
@ key
Definition: vtkX3D.h:257
@ info
Definition: vtkX3D.h:376
@ data
Definition: vtkX3D.h:315
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_BINARY
Definition: vtkWriter.h:40
#define VTK_ASCII
Definition: vtkWriter.h:39