vtkPlotlyJsonExporter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
9 #ifndef vtkPlotlyJsonExporter_h
10 #define vtkPlotlyJsonExporter_h
11 
13 #include "vtkPVVTKExtensionsFiltersRenderingModule.h" // needed for export macro
14 
15 #include <string> // needed for std::string
16 
19 {
20 public:
21  static vtkPlotlyJsonExporter* New();
23  void PrintSelf(ostream& os, vtkIndent indent) override;
24 
26 
29  vtkSetStringMacro(FileName);
30  vtkGetStringMacro(FileName);
32 
37  bool Open(ExporterModes mode = STREAM_ROWS) override;
38 
43  void Close() override;
44 
49  void Abort() override;
50 
52 
55  void WriteHeader(vtkFieldData*) override;
56  void WriteData(vtkFieldData*) override;
58 
63  void AddColumn(vtkAbstractArray* yarray, const char* yarrayname = nullptr,
64  vtkDataArray* xarray = nullptr) override;
65 
70  void AddStyle(vtkPlot* plot, const char* plotName) override;
71 
75  void SetGlobalStyle(vtkChart* chart) override;
76 
78 
81  vtkSetMacro(WriteToOutputString, bool);
82  vtkGetMacro(WriteToOutputString, bool);
83  vtkBooleanMacro(WriteToOutputString, bool);
85 
86  // When WriteToOutputString is set this can be used to retrieve the string respresentation.
87  std::string GetOutputString() const;
88 
89 protected:
91  ~vtkPlotlyJsonExporter() override;
92 
93 private:
95  void operator=(const vtkPlotlyJsonExporter&) = delete;
96 
97  char* FileName = nullptr;
98  class vtkInternals;
99  bool WriteToOutputString = false;
100  vtkInternals* Internals;
101 };
102 
103 #endif
virtual void SetGlobalStyle(vtkChart *chart)=0
Set Global style elements like graph and axis titles.
virtual void WriteHeader(vtkFieldData *)=0
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use Wr...
virtual void WriteData(vtkFieldData *)=0
In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use Wr...
virtual void AddStyle(vtkPlot *plot, const char *plotName)=0
Attach information about the style of the plot (color,line type, marker type etc. ...
virtual void Abort()=0
Same as Close except deletes the file, if created.
#define VTKPVVTKEXTENSIONSFILTERSRENDERING_EXPORT
static vtkAbstractChartExporter * New()
virtual bool Open(ExporterModes mode=STREAM_ROWS)=0
Open the file and set mode in which the exporter is operating.
virtual void Close()=0
Closes the file cleanly.
exporter used by certain views to export data into a file or stream.
exporter used by certain views to export data into a file or stream.
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void AddColumn(vtkAbstractArray *yarray, const char *yarrayname=nullptr, vtkDataArray *xarray=nullptr)=0
In STREAM_COLUMNS mode, use this method to add a column (yarray).