exporter used by certain views to export data as CSV. More...
#include <vtkCSVExporter.h>
Public Types | |
typedef vtkAbstractChartExporter | Superclass |
![]() | |
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) override |
bool | Open (ExporterModes mode=STREAM_ROWS) override |
Open the file and set mode in which the exporter is operating. More... | |
void | Close () override |
Closes the file cleanly. More... | |
void | Abort () override |
Same as Close except deletes the file, if created. More... | |
void | AddColumn (vtkAbstractArray *yarray, const char *yarrayname=nullptr, vtkDataArray *xarray=nullptr) override |
In STREAM_COLUMNS mode, use this method to add a column (yarray ). More... | |
void | AddStyle (vtkPlot *vtkNotUsed(plot), const char *vtkNotUsed(plotName)) override |
void | SetGlobalStyle (vtkChart *vtkNotUsed(chart)) override |
std::string | GetOutputString () |
Get the exported data as string. 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 | SetFormatting (int) |
Set a formatting to use when writing real numbers (aka floating-point numbers) to csv. More... | |
virtual int | GetFormatting () |
Set a formatting to use when writing real numbers (aka floating-point numbers) to csv. More... | |
virtual void | SetPrecision (int) |
Set a precision to use when writing real numbers (aka floating-point numbers) to csv. More... | |
virtual int | GetPrecision () |
Set a precision to use when writing real numbers (aka floating-point numbers) to csv. More... | |
void | SetColumnLabel (const char *name, const char *label) |
In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More... | |
void | ClearColumnLabels () |
In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More... | |
const char * | GetColumnLabel (const char *name) |
In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More... | |
void | WriteHeader (vtkFieldData *) override |
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 *) override |
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... | |
virtual void | SetWriteToOutputString (bool) |
Whether to output to a string instead of to a file, which is the default. More... | |
virtual bool | GetWriteToOutputString () |
Whether to output to a string instead of to a file, which is the default. More... | |
virtual void | WriteToOutputStringOn () |
Whether to output to a string instead of to a file, which is the default. More... | |
virtual void | WriteToOutputStringOff () |
Whether to output to a string instead of to a file, which is the default. More... | |
![]() | |
virtual void | AddStyle (vtkPlot *plot, const char *plotName)=0 |
Attach information about the style of the plot (color,line type, marker type etc. More... | |
virtual void | SetGlobalStyle (vtkChart *chart)=0 |
Set Global style elements like graph and axis titles. More... | |
![]() | |
vtkBaseTypeMacro (vtkObject, vtkObjectBase) | |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual void | Modified () |
virtual vtkMTimeType | GetMTime () |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
![]() | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
void | PrintRevisions (ostream &) |
Static Public Member Functions | |
static vtkCSVExporter * | New () |
static int | IsTypeOf (const char *type) |
static vtkCSVExporter * | SafeDownCast (vtkObject *o) |
![]() | |
static vtkAbstractChartExporter * | New () |
static int | IsTypeOf (const char *type) |
static vtkAbstractChartExporter * | SafeDownCast (vtkObject *o) |
![]() | |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
![]() | |
static vtkTypeBool | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
static vtkObjectBase * | New () |
Protected Member Functions | |
vtkCSVExporter () | |
~vtkCSVExporter () override | |
![]() | |
vtkAbstractChartExporter () | |
~vtkAbstractChartExporter () override | |
![]() | |
vtkObject () | |
virtual | ~vtkObject () |
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE |
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
![]() | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
char * | FileName = nullptr |
char * | FieldDelimiter = nullptr |
std::ostream * | OutputStream = nullptr |
ExporterModes | Mode = STREAM_ROWS |
bool | WriteToOutputString = false |
std::string | OutputString |
int | Formatting |
int | Precision = 6 |
![]() | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
![]() | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
exporter used by certain views to export data as CSV.
vtkCSVExporter can be used to generate comma-separated files. Unlike vtkCSVWriter
, this class can generate a single CSV from multiple array collections. This avoids the need to generate of single large appended table. The multiple arrays together represent the complete tabular data that gets exported. The table can be split column-wise or row-wise between multiple arrays. The vtkCSVExporter
provides two sets of APIs to handle the two cases. They cannot be mixed.
When exporting array instances split by columns, i.e. each array will have exactly same number of rows but different columns that are to be concatenated together, use the STREAM_COLUMNS
mode. To use this mode, start writing by using vtkCSVExporter::Open(vtkCSVExporter::STREAM_COLUMNS)
and then add each column using vtkCSVExporter::AddColumn
. Finally, complete the export can generate the output using vtkCSVExporter::Close
.
When exporting arrays that are split by rows, use the STREAM_ROWS mode. The arrays are provided as a part of vtkFieldData (or subclass). To begin exporting in this mode, use vtkCSVExporter::Open(vtkCSVExporter::STREAM_ROWS)
. Write the header using vtkCSVExporter::WriteHeader(vtkFieldData*)
and the pass rows in order by using vtkCSVExporter::WriteData(vtkFieldData*) multiple times. Finally, close using
vtkCSVExporter::Close`.
In STREAM_ROWS mode, the exporter supports invalid / empty cells. When writing each column in WriteData
call, for each column-name an vtkUnsignedCharArray with the name __vtkValidMask__{COLUMN_NAME}
is looked up. If found, it's value is used to determine if that cell is to written out or not.
Definition at line 49 of file vtkCSVExporter.h.
Definition at line 53 of file vtkCSVExporter.h.
|
protected |
|
overrideprotected |
|
static |
|
virtual |
Reimplemented from vtkAbstractChartExporter.
Reimplemented from vtkAbstractChartExporter.
|
static |
|
overridevirtual |
Reimplemented from vtkAbstractChartExporter.
|
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 |
Set a formatting to use when writing real numbers (aka floating-point numbers) to csv.
See the std::fixed doc for more info. Default is vtkVariant::DEFAULT_FORMATTING
|
virtual |
Set a formatting to use when writing real numbers (aka floating-point numbers) to csv.
See the std::fixed doc for more info. Default is vtkVariant::DEFAULT_FORMATTING
|
virtual |
Set a precision to use when writing real numbers (aka floating-point numbers) to csv.
See the std::setprecision doc for more info. Default is 6
|
virtual |
Set a precision to use when writing real numbers (aka floating-point numbers) to csv.
See the std::setprecision doc for more info. Default is 6
In STREAM_ROWS mode, this API can be used to change columns labels when exporting.
void vtkCSVExporter::ClearColumnLabels | ( | ) |
In STREAM_ROWS mode, this API can be used to change columns labels when exporting.
In STREAM_ROWS mode, this API can be used to change columns labels when exporting.
|
overridevirtual |
Open the file and set mode in which the exporter is operating.
Implements vtkAbstractChartExporter.
|
overridevirtual |
Closes the file cleanly.
Call this at the end to close the file and dump out any cached data.
Implements vtkAbstractChartExporter.
|
overridevirtual |
Same as Close except deletes the file, if created.
This is useful to interrupt the exporting on failure.
Implements vtkAbstractChartExporter.
|
overridevirtual |
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.
Implements vtkAbstractChartExporter.
|
overridevirtual |
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.
Implements vtkAbstractChartExporter.
|
overridevirtual |
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 nullptr, 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.
Implements vtkAbstractChartExporter.
|
inlineoverride |
Definition at line 142 of file vtkCSVExporter.h.
|
inlineoverride |
Definition at line 144 of file vtkCSVExporter.h.
|
virtual |
Whether to output to a string instead of to a file, which is the default.
|
virtual |
Whether to output to a string instead of to a file, which is the default.
|
virtual |
Whether to output to a string instead of to a file, which is the default.
|
virtual |
Whether to output to a string instead of to a file, which is the default.
std::string vtkCSVExporter::GetOutputString | ( | ) |
Get the exported data as string.
If WriteToOutputString is OFF, returned string is empty. If Close() was not called, returned string is empty.
|
protected |
Definition at line 167 of file vtkCSVExporter.h.
|
protected |
Definition at line 168 of file vtkCSVExporter.h.
|
protected |
Definition at line 169 of file vtkCSVExporter.h.
|
protected |
Definition at line 170 of file vtkCSVExporter.h.
|
protected |
Definition at line 172 of file vtkCSVExporter.h.
|
protected |
Definition at line 173 of file vtkCSVExporter.h.
|
protected |
Definition at line 175 of file vtkCSVExporter.h.
|
protected |
Definition at line 176 of file vtkCSVExporter.h.