ParaView
|
exporter used by certain views to export data as a CSV file. More...
#include <vtkCSVExporter.h>
Inherits vtkObject.
Public Types | |
enum | ExporterModes { STREAM_ROWS, STREAM_COLUMNS } |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
bool | Open (ExporterModes mode=STREAM_ROWS) |
Open the file and set mode in which the exporter is operating. More... | |
void | Close () |
Closes the file cleanly. More... | |
void | Abort () |
Same as Close except deletes the file, if created. More... | |
void | AddColumn (vtkAbstractArray *yarray, const char *yarrayname=NULL, vtkDataArray *xarray=NULL) |
In STREAM_COLUMNS mode, use this method to add a column (yarray ). More... | |
virtual void | SetFileName (const char *) |
Get/Set the filename for the file. More... | |
virtual char * | GetFileName () |
Get/Set the filename for the file. More... | |
virtual void | SetFieldDelimiter (const char *) |
Get/Set the delimiter use to separate fields ("," by default.) More... | |
virtual char * | GetFieldDelimiter () |
Get/Set the delimiter use to separate fields ("," by default.) More... | |
virtual void | SetFilterColumnsByVisibility (bool) |
Get/Set to filter by column or not. More... | |
virtual bool | GetFilterColumnsByVisibility () |
Get/Set to filter by column or not. More... | |
void | WriteHeader (vtkFieldData *) |
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows. More... | |
void | WriteData (vtkFieldData *) |
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows. More... | |
Static Public Member Functions | |
static vtkCSVExporter * | New () |
static int | IsTypeOf (const char *type) |
static vtkCSVExporter * | SafeDownCast (vtkObject *o) |
Protected Member Functions | |
vtkCSVExporter () | |
~vtkCSVExporter () | |
Protected Attributes | |
char * | FileName |
char * | FieldDelimiter |
bool | FilterColumnsByVisibility |
ofstream * | FileStream |
ExporterModes | Mode |
exporter used by certain views to export data as a CSV file.
This is used by vtkSMCSVExporterProxy to export the data shown in the spreadsheet view or chart views as a CSV. The reason this class simply doesn't use a vtkCSVWriter is that vtkCSVWriter is designed to write out a single vtkTable as CSV. For exporting data from views, generating this single vtkTable that can be exported is often time consuming or memory consuming or both. Having a special exporter helps us with that. It provides two sets of APIs:
STREAM_ROWS:
to use to stream a single large vtkTable as contiguous chunks where each chuck is a subset of the rows (ideal for use by vtkSpreadSheetView) viz. OpenFile, WriteHeader, WriteData (which can be repeated as many times as needed), and CloseFile, STREAM_COLUMNS:
to use to add columns (idea for chart views) viz. OpenFile, AddColumn (which can be repeated), and CloseFile.One has to pick which mode the exporter is operating in during the OpenFile() call.
Definition at line 49 of file vtkCSVExporter.h.
typedef vtkObject vtkCSVExporter::Superclass |
Definition at line 53 of file vtkCSVExporter.h.
Enumerator | |
---|---|
STREAM_ROWS | |
STREAM_COLUMNS |
Definition at line 80 of file vtkCSVExporter.h.
|
protected |
|
protected |
|
static |
|
virtual |
|
static |
|
virtual |
|
static |
void vtkCSVExporter::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) |
|
virtual |
Get/Set the filename for the file.
|
virtual |
Get/Set the filename for the file.
|
virtual |
Get/Set the delimiter use to separate fields ("," by default.)
|
virtual |
Get/Set the delimiter use to separate fields ("," by default.)
|
virtual |
Get/Set to filter by column or not.
|
virtual |
Get/Set to filter by column or not.
bool vtkCSVExporter::Open | ( | ExporterModes | mode = STREAM_ROWS | ) |
Open the file and set mode in which the exporter is operating.
void vtkCSVExporter::Close | ( | ) |
Closes the file cleanly.
Call this at the end to close the file and dump out any cached data.
void vtkCSVExporter::Abort | ( | ) |
Same as Close except deletes the file, if created.
This is useful to interrupt the exporting on failure.
void vtkCSVExporter::WriteHeader | ( | vtkFieldData * | ) |
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows.
void vtkCSVExporter::WriteData | ( | vtkFieldData * | ) |
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows.
void vtkCSVExporter::AddColumn | ( | vtkAbstractArray * | yarray, |
const char * | yarrayname = NULL , |
||
vtkDataArray * | xarray = NULL |
||
) |
In STREAM_COLUMNS mode, use this method to add a column (yarray
).
One can assign it a name different the the name of the array using yarrayname
. If xarray
is not NULL, then is used as the row-id. This makes it possible to add multiple columns with varying number of samples. The final output will have empty cells for missing values.
|
protected |
Definition at line 127 of file vtkCSVExporter.h.
|
protected |
Definition at line 128 of file vtkCSVExporter.h.
|
protected |
Definition at line 129 of file vtkCSVExporter.h.
|
protected |
Definition at line 130 of file vtkCSVExporter.h.
|
protected |
Definition at line 131 of file vtkCSVExporter.h.