AxisLegendManager.hh
3.11 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
/*
* AxisLegendManager.hh
*
* Created on: 23 jan. 2015
* Author: AKKA
*/
#ifndef AXISLEGENDMANAGER_HH_
#define AXISLEGENDMANAGER_HH_
#include "PanelPlotOutput.hh"
#include "ParamMgr.hh"
#include "XYPlot.hh"
using namespace AMDA::Info;
namespace plot
{
class ParameterIndexComponentColor
{
public:
ParameterIndexComponentColor(int dim1Index, int dim2Index, Color &color) : _dim1Index(dim1Index), _dim2Index(dim2Index), _color(color)
{
}
ParameterIndexComponentColor(AMDA::Common::ParameterIndexComponent index, Color &color) : _dim1Index(index.getDim1Index()), _dim2Index(index.getDim2Index()), _color(color)
{
}
ParameterIndexComponentColor(const ParameterIndexComponentColor &index) : _dim1Index(index._dim1Index), _dim2Index(index._dim2Index), _color(index._color)
{
}
const Color &getColor() const
{
return _color;
}
void setColor(Color &color)
{
_color = color;
}
int getDim1Index()
{
return _dim1Index;
}
int getDim2Index()
{
return _dim2Index;
}
private:
int _dim1Index;
int _dim2Index;
Color _color;
};
class AxisLegendManager
{
public:
typedef std::map<std::string, std::list<ParameterIndexComponentColor>> AxisParamsComponents;
static void configureYAxisLegendForSpectro(PanelPlotOutput *plot);
static void configureYAxisLegendForSeries(PanelPlotOutput *plot);
static void configureColorAxisLegendForSpectro(PanelPlotOutput *plot);
static void configureColorAxisLegendForSeries(PanelPlotOutput *plot);
static void configureXAxisLegendForSeries(PanelPlotOutput *plot);
static void setAxisLegendForSeries(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, AxisParamsComponents &axisParamsComponents, std::vector<std::string> insertionOrder, std::string legendPrefix="");
static void setAxisLegendForSpectro(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, std::string originalParamId);
static void setAxisLegendForTable(PanelPlotOutput *plot, boost::shared_ptr<Axis> &pAxis, std::string originalParamId, std::string paramId, AMDA::Common::ParameterIndexComponentList &indexes, int relatedDim);
static std::string getTransformedUnits(const std::string &rawUnit);
private:
static void addInfoPart(std::string &legend, std::string info);
static void addIndexPart(std::string &legend, ParameterIndexComponentColor &index);
static void addIndexPart(std::string &legend, int index);
static void addBoundsPart(std::string &legend, PLFLT min, PLFLT max);
static void addBreakLine(std::string &legend);
static void pushComponentInList(std::string paramId, ParameterIndexComponentColor &index, AxisParamsComponents &axisParamsComponents, std::vector<std::string> &insertionOrder);
static std::string getParamLegend(AMDA::Info::ParamInfoSPtr paramInfo, ParameterIndexComponentColor &index);
// static std::string getParamLegend(AMDA::Info::ParamInfoSPtr paramInfo, int index);
static std::string getMissionInstrumentInfo(AMDA::Info::ParamInfoSPtr paramInfo);
static std::string getMissionInfo(AMDA::Info::ParamInfoSPtr paramInfo);
static std::string transformPower(std::string &unit, std::string pattern);
};
}
#endif