PlotFunction.hh
4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#ifndef PLOTFUNCTION_HH_
#define PLOTFUNCTION_HH_
// includes boost
#include <boost/shared_ptr.hpp>
#include "NodeCfg.hh"
#include "PanelPlotOutput.hh"
#include "PlPlotUtil.hh"
#include "PlotFunctionNode.hh"
#include "plotFunctionElements/Abscisse.hh"
#include <climits>
#include "DefaultTimeAxisDecorator.hh"
#include "TimeAxisDecorator.hh"
#include "plplot/plplot.h"
#include "plplot/plplotP.h"
#include "plplot/plstream.h"
#include <map>
#include "plplot/plstream.h"
extern "C"
{
#include <plplot/qsastime.h>
}
#define X_AXIS_ID "x_axis_id"
#define Y_AXIS_ID ""
namespace plot
{
class PlotFunction : public PanelPlotOutput
{
public:
enum Function
{
NONE,
FFT,
SUM
};
PlotFunction(AMDA::Parameters::ParameterManager &manager,
boost::shared_ptr<Panel> panel, TimeAxisDecorator *timeAxisDecorator = new DefaultTimeAxisDecorator());
virtual ~PlotFunction();
/**
* @overload plot::PanelPlotOutput
*/
virtual const std::string typeName()
{
return PlotFunction_NODENAME;
}
void setOriginalParamId(std::string originalParamId_)
{
originalParamId = originalParamId_;
};
void setAbscisse(Abscisse abscisse_)
{
abscisse = abscisse_;
};
Abscisse getAbscisse()
{
return abscisse;
};
Function getFunction()
{
return function;
};
void setFunction(Function function_)
{
function = function_;
};
void setParamsNbPoints(std::vector<std::string> paramsNbPoints_)
{
paramsNbPoints = paramsNbPoints_;
};
void setAbscisseScale(Axis::Scale scale)
{
abscisseScale = scale;
};
Axis::Scale getAbscisseScale()
{
return abscisseScale;
};
Axis::Scale getOrdonneeScale()
{
return ordonneeScale;
};
void setOrdonneeScale(Axis::Scale scale)
{
ordonneeScale = scale;
};
static QSASConfig *qsasconfig;
void setTimeAxisDecorator(std::shared_ptr<TimeAxisDecorator> pDecorator_)
{
_xdecoratorPtr = pDecorator_;
}
std::shared_ptr<TimeAxisDecorator> getTimeAxisDecorator()
{
return _xdecoratorPtr;
}
protected:
/**
*@brief Draw the serie of a parameter component on plot.
*/
virtual void
drawSeries(double startDate, double stopDate, int intervalIndex, std::string pParamId,
SeriesProperties &pSerie,
AMDA::Common::ParameterIndexComponent pParamIndex,
ParameterAxes ¶m, bool moreThanOneSerieForAxis);
virtual void preparePlotArea(double startTime, double stopTime, int intervalIndex);
/**
* @brief Get original id of the concerned parameter (for the plot) then add it to the usedParametersId_ and store it in originalParamId
*
* @param usedParametersId_
*/
virtual void createParameters(std::list<std::string> &usedParametersId_);
/**
* @brief draw the plot for the current time interval
*/
virtual bool draw(double startTime, double stopTime, int intervalIndex,
bool isFirstInterval, bool isLastInterval);
// virtual void drawFills(double startDate, double stopDate);
private:
void configureSeriesAxis();
void configureAxisLegend();
void drawStartDate(std::string _timeFormat, double startTime, double stopTime);
void createYAxis();
void createXAxis();
void getMinMax(std::map<std::string, std::vector<double>>, double *minToFill, double *maxToFill);
void compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id);
std::map<std::string, std::vector<double>> xValuesMap;
std::map<std::string, std::vector<double>> yValuesMap;
Function function;
std::vector<std::string> paramsNbPoints;
Abscisse abscisse;
Axis::Scale abscisseScale;
Axis::Scale ordonneeScale;
std::shared_ptr<TimeAxisDecorator> _xdecoratorPtr;
/**
* @brief original param Id.
*/
std::string originalParamId;
std::list<std::string> listParamsId;
// std::vector<double> xValues;
// std::vector<double> yValues;
};
}
#endif