mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-10 19:20:44 +01: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 *
|
* Plot implementation *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
Plot::Plot(void)
|
||||||
|
{
|
||||||
|
initOptions();
|
||||||
|
}
|
||||||
|
|
||||||
// destructor //////////////////////////////////////////////////////////////////
|
// destructor //////////////////////////////////////////////////////////////////
|
||||||
Plot::~Plot(void)
|
Plot::~Plot(void)
|
||||||
|
{
|
||||||
|
cleanTmpFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean temporary files ///////////////////////////////////////////////////////
|
||||||
|
void Plot::cleanTmpFiles(void)
|
||||||
{
|
{
|
||||||
while (!tmpFileName_.empty())
|
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 objects ////////////////////////////////////////////////////////////////
|
||||||
Plot & Plot::operator<<(PlotObject &&command)
|
Plot & Plot::operator<<(PlotObject &&command)
|
||||||
{
|
{
|
||||||
|
22
lib/Plot.hpp
22
lib/Plot.hpp
@ -104,13 +104,13 @@ struct Range
|
|||||||
|
|
||||||
struct PlotOptions
|
struct PlotOptions
|
||||||
{
|
{
|
||||||
std::string terminal {""};
|
std::string terminal;
|
||||||
std::string output {""};
|
std::string output;
|
||||||
std::string title {""};
|
std::string title;
|
||||||
unsigned int scaleMode[2] {0,0};
|
unsigned int scaleMode[2];
|
||||||
Range scale[2] {{0.0,0.0},{0.0,0.0}};
|
Range scale[2];
|
||||||
std::string label[2] {"",""};
|
std::string label[2];
|
||||||
std::string lineColor {""};
|
std::string lineColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlotModifier
|
class PlotModifier
|
||||||
@ -193,7 +193,7 @@ public:
|
|||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
// constructor/destructor
|
// constructor/destructor
|
||||||
Plot(void) = default;
|
Plot(void);
|
||||||
virtual ~Plot(void);
|
virtual ~Plot(void);
|
||||||
// plot operations
|
// plot operations
|
||||||
Plot & operator<<(PlotObject &&command);
|
Plot & operator<<(PlotObject &&command);
|
||||||
@ -201,9 +201,15 @@ public:
|
|||||||
// plot parsing and output
|
// plot parsing and output
|
||||||
void display(void);
|
void display(void);
|
||||||
friend std::ostream & operator<<(std::ostream &out, const Plot &plot);
|
friend std::ostream & operator<<(std::ostream &out, const Plot &plot);
|
||||||
|
// plot reset
|
||||||
|
void reset(void);
|
||||||
private:
|
private:
|
||||||
|
// clean temporary files
|
||||||
|
void cleanTmpFiles(void);
|
||||||
// find gnuplot
|
// find gnuplot
|
||||||
void getProgramPath(void);
|
void getProgramPath(void);
|
||||||
|
// default options
|
||||||
|
void initOptions(void);
|
||||||
private:
|
private:
|
||||||
// gnuplot execution parameters
|
// gnuplot execution parameters
|
||||||
std::string gnuplotBin_ {GNUPLOT_BIN};
|
std::string gnuplotBin_ {GNUPLOT_BIN};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user