LineProperties.hh
2.47 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
/*
* LineProperties.hh
*
* Created on: Dec 9, 2013
* Author: amdadev
*/
#ifndef LINEPROPERTIES_HH_
#define LINEPROPERTIES_HH_
#include <iostream>
#include <map>
#include <string>
#include "Color.hh"
namespace plot {
/**
* available line types drawing each parameter dimension.
*/
enum class LineType {
EMPTY, LINE, HISTO
};
/**
* string to enum translation. string values must be in
* line with plot.xsd definition.
*/
static std::map<const std::string, LineType> stoLineType = {
{"no", LineType::EMPTY},
{"line", LineType::LINE},
{"histo", LineType::HISTO}
};
/**
* available line styles.
*/
enum class LineStyle {
PLAIN, DOT, LONG_SPACED_DOT, LONG_SHORTED_DOT
};
/**
* string to enum translation. string values must be in
* line with plot.xsd definition.
*/
static std::map<std::string, LineStyle> stoLineStyle = {
{"plain", LineStyle::PLAIN},
{"dot", LineStyle::DOT},
{"long-spaced-dot", LineStyle::LONG_SPACED_DOT},
{"long-short-dot", LineStyle::LONG_SHORTED_DOT}
};
/**
* Line properties. Defines type, style and color of each line drawn
* on a panel for a parameter.
*/
class LineProperties {
public:
friend std::ostream& operator<<(std::ostream& out_, const LineProperties& lprop_);
/*
* Dumps properties for test.
*/
void dump(std::ostream& out_, std::string& prefix_);
LineProperties() :
_width(1), _color(), _type(LineType::LINE), _style(LineStyle::PLAIN) {
}
LineProperties(const LineProperties& pLineProperties_) :
_width(pLineProperties_._width), _color(pLineProperties_._color), _type(
pLineProperties_._type), _style(pLineProperties_._style) {
}
LineProperties& operator=(const LineProperties& pLineProperties_) {
_width = pLineProperties_._width;
_color = pLineProperties_._color;
_style = pLineProperties_._style;
_type = pLineProperties_._type;
return *this;
}
virtual ~LineProperties() {
}
const Color& getColor() const{
return _color;
}
Color& getColor() {
return _color;
}
void setColor(const Color& color) {
_color = color;
}
LineStyle getStyle() const {
return _style;
}
void setStyle(const LineStyle& style) {
_style = style;
}
LineType getType() const {
return _type;
}
void setType(LineType type) {
_type = type;
}
int getWidth() const {
return _width;
}
void setWidth(int width) {
_width = width;
}
private:
int _width;
Color _color;
LineType _type;
LineStyle _style;
};
int getPlLineStyle (LineStyle pLineStyle);
} /* namespace plot */
#endif /* LINEPROPERTIES_HH_ */