SymbolProperties.hh
3.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
/*
* SymbolProperties.hh
*
* Created on: Dec 9, 2013
* Author: amdadev
*/
#ifndef SYMBOLPROPERTIES_HH_
#define SYMBOLPROPERTIES_HH_
#include <iostream>
#include <map>
#include <string>
#include "Color.hh"
namespace plot {
/**
* available symbol types.
*/
enum class SymbolType {
NO = 0, // no symbol
DOT = 1, // .
PLUS = 2, // +
WILDCARD = 3, // *
CIRCLE = 4, // circle
CRUX = 5, // x
SQUARE = 6, // empty square
TRIANGLE = 7, // empty triangle
CRUX_IN_CIRCLE = 8, // crux in a circle
DOT_IN_CIRCLE = 9, // dot in circle
//SQUARE_2 = 10, // strange square with rounded corners. - Obsolete
DIAMOND = 11, // diamond
STAR = 12, // star
//CHRISTIAN_CRUX = 14, // Christian crux - Obsolete
DAVID_STAR = 15, // david star
FULL_SQUARE = 16, // full square
FULL_CIRCLE = 17, // full circle
FULL_STAR = 18 // fullstar
};
static std::map<SymbolType,std::string> fontTypeToSymSymbol = {
{SymbolType::NO, ""},
{SymbolType::DOT, "148"},
{SymbolType::PLUS, "126"},
{SymbolType::WILDCARD, "128"},
{SymbolType::CIRCLE, "135"},
{SymbolType::CRUX,"141"},
{SymbolType::SQUARE,"136"},
{SymbolType::TRIANGLE,"137"},
{SymbolType::CRUX_IN_CIRCLE, "172"},
{SymbolType::DOT_IN_CIRCLE,"171"},
//{SymbolType::SQUARE_2, "235"},
{SymbolType::DIAMOND, "138"},
{SymbolType::STAR,"139"},
//{SymbolType::CHRISTIAN_CRUX,"866"},
{SymbolType::DAVID_STAR,"147"},
{SymbolType::FULL_SQUARE,"144"},
{SymbolType::FULL_CIRCLE,"143"},
{SymbolType::FULL_STAR,"145"}
};
/**
* string to enum translation. string values must be in
* line with plot.xsd definition.
*/
static std::map<const std::string,SymbolType> stoSymbolType = {
{"no", SymbolType::NO},
{"dot", SymbolType::DOT},
{"plus", SymbolType::PLUS},
{"wildcard", SymbolType::WILDCARD},
{"circle", SymbolType::CIRCLE},
{"crux", SymbolType::CRUX},
{"square", SymbolType::SQUARE},
{"triangle", SymbolType::TRIANGLE},
{"crux-in-circle", SymbolType::CRUX_IN_CIRCLE},
{"dot-in-circle", SymbolType::DOT_IN_CIRCLE},
//{"square-2", SymbolType::SQUARE_2},
{"diamond", SymbolType::DIAMOND},
{"star", SymbolType::STAR},
//{"christian-crux", SymbolType::CHRISTIAN_CRUX},
{"david-star", SymbolType::DAVID_STAR},
{"full-square", SymbolType::FULL_SQUARE},
{"full-circle", SymbolType::FULL_CIRCLE},
{"full-star", SymbolType::FULL_STAR}
};
/**
* Symbol properties. Defines symbol to use, size and color for each
* point to draw for a parameter
*/
class SymbolProperties {
public:
friend std::ostream& operator<<(std::ostream& out_, const SymbolProperties& prop_);
/*
* Dumps properties for test.
*/
void dump(std::ostream& out_, std::string& prefix_);
SymbolProperties() :
_type(SymbolType::DOT), _size(4), _color() {
}
SymbolProperties(const SymbolProperties& pSymbolProperties_) :
_type(pSymbolProperties_._type), _size(pSymbolProperties_._size), _color(
pSymbolProperties_._color) {
}
SymbolProperties& operator=(const SymbolProperties& pSymbolProperties_) {
_type = pSymbolProperties_._type;
_size = pSymbolProperties_._size;
_color = pSymbolProperties_._color;
return *this;
}
virtual ~SymbolProperties() {
}
const Color& getColor() const {
return _color;
}
Color& getColor(){
return _color;
}
void setColor(const Color& color) {
_color = color;
}
int getSize() const {
return _size;
}
void setSize(int size) {
_size = size;
}
SymbolType getType() const {
return _type;
}
void setType(SymbolType type) {
_type = type;
}
private:
SymbolType _type;
int _size;
Color _color;
};
} /* namespace plot */
#endif /* SYMBOLPROPERTIES_HH_ */