mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
Plot: method to reset plot
This commit is contained in:
parent
11fb009d11
commit
6a1031a8c0
36
lib/Plot.cpp
36
lib/Plot.cpp
@ -185,8 +185,20 @@ void Title::operator()(PlotOptions &option) const
|
||||
/******************************************************************************
|
||||
* Plot implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
Plot::Plot(void)
|
||||
{
|
||||
initOptions();
|
||||
}
|
||||
|
||||
// destructor //////////////////////////////////////////////////////////////////
|
||||
Plot::~Plot(void)
|
||||
{
|
||||
cleanTmpFiles();
|
||||
}
|
||||
|
||||
// clean temporary files ///////////////////////////////////////////////////////
|
||||
void Plot::cleanTmpFiles(void)
|
||||
{
|
||||
while (!tmpFileName_.empty())
|
||||
{
|
||||
@ -199,6 +211,30 @@ Plot::~Plot(void)
|
||||
}
|
||||
}
|
||||
|
||||
// default options /////////////////////////////////////////////////////////////
|
||||
void Plot::initOptions(void)
|
||||
{
|
||||
options_.terminal = "";
|
||||
options_.output = "";
|
||||
options_.title = "";
|
||||
options_.scaleMode[0] = Plot::Scale::reset;
|
||||
options_.scaleMode[1] = Plot::Scale::reset;
|
||||
options_.scale[0] = {0.0, 0.0};
|
||||
options_.scale[1] = {0.0, 0.0};
|
||||
options_.label[0] = "";
|
||||
options_.label[1] = "";
|
||||
options_.lineColor = "";
|
||||
}
|
||||
|
||||
// plot reset //////////////////////////////////////////////////////////////////
|
||||
void Plot::reset(void)
|
||||
{
|
||||
headCommand_.clear();
|
||||
plotCommand_.clear();
|
||||
cleanTmpFiles();
|
||||
initOptions();
|
||||
}
|
||||
|
||||
// plot objects ////////////////////////////////////////////////////////////////
|
||||
Plot & Plot::operator<<(PlotObject &&command)
|
||||
{
|
||||
|
22
lib/Plot.hpp
22
lib/Plot.hpp
@ -104,13 +104,13 @@ struct Range
|
||||
|
||||
struct PlotOptions
|
||||
{
|
||||
std::string terminal {""};
|
||||
std::string output {""};
|
||||
std::string title {""};
|
||||
unsigned int scaleMode[2] {0,0};
|
||||
Range scale[2] {{0.0,0.0},{0.0,0.0}};
|
||||
std::string label[2] {"",""};
|
||||
std::string lineColor {""};
|
||||
std::string terminal;
|
||||
std::string output;
|
||||
std::string title;
|
||||
unsigned int scaleMode[2];
|
||||
Range scale[2];
|
||||
std::string label[2];
|
||||
std::string lineColor;
|
||||
};
|
||||
|
||||
class PlotModifier
|
||||
@ -193,7 +193,7 @@ public:
|
||||
};
|
||||
public:
|
||||
// constructor/destructor
|
||||
Plot(void) = default;
|
||||
Plot(void);
|
||||
virtual ~Plot(void);
|
||||
// plot operations
|
||||
Plot & operator<<(PlotObject &&command);
|
||||
@ -201,9 +201,15 @@ public:
|
||||
// plot parsing and output
|
||||
void display(void);
|
||||
friend std::ostream & operator<<(std::ostream &out, const Plot &plot);
|
||||
// plot reset
|
||||
void reset(void);
|
||||
private:
|
||||
// clean temporary files
|
||||
void cleanTmpFiles(void);
|
||||
// find gnuplot
|
||||
void getProgramPath(void);
|
||||
// default options
|
||||
void initOptions(void);
|
||||
private:
|
||||
// gnuplot execution parameters
|
||||
std::string gnuplotBin_ {GNUPLOT_BIN};
|
||||
|
Loading…
Reference in New Issue
Block a user