PlotCommon.cc
1.78 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
/*
* PlotCommon.cc
*
* Created on: 30 oct. 2013
* Author: CS
*/
#include "PlotCommon.hh"
namespace plot {
PlotCommon::PlotCommon() {
}
PlotCommon::~PlotCommon() {
}
/**
* Sets title align.
*/
void PlotCommon::setTitleAlign(const std::string& pAlign,
PlotCommon::Align& intoValue) {
if (pAlign == "center") {
intoValue = PlotCommon::Align::CENTER;
} else if (pAlign == "left") {
intoValue = PlotCommon::Align::LEFT;
} else if (pAlign == "right") {
intoValue = PlotCommon::Align::RIGHT;
}
}
/**
* Sets title or label position.
*/
void PlotCommon::setPosition(const std::string& pPosition,
PlotCommon::Position& intoValue) {
if (pPosition == "top") {
intoValue = PlotCommon::Position::POS_TOP;
} else if (pPosition == "bottom") {
intoValue = PlotCommon::Position::POS_BOTTOM;
} else if (pPosition == "left") {
intoValue = PlotCommon::Position::POS_LEFT;
} else if (pPosition == "right") {
intoValue = PlotCommon::Position::POS_RIGHT;
} else if (pPosition == "center") {
intoValue = PlotCommon::Position::POS_CENTER;
}
}
std::ostream & operator <<(std::ostream & out,
PlotCommon::Position & position) {
switch (position) {
case PlotCommon::Position::POS_TOP:
out << "Top";
break;
case PlotCommon::Position::POS_BOTTOM:
out << "Bottom";
break;
case PlotCommon::Position::POS_LEFT:
out << "Left";
break;
case PlotCommon::Position::POS_RIGHT:
out << "Right";
break;
case PlotCommon::Position::POS_CENTER:
out << "Center";
break;
}
return out;
}
std::ostream & operator <<(std::ostream & out, PlotCommon::Align & ALIGN) {
switch (ALIGN) {
case PlotCommon::Align::CENTER:
out << "Center";
break;
case PlotCommon::Align::LEFT:
out << "Left";
break;
case PlotCommon::Align::RIGHT:
out << "Right";
}
return out;
}
} /* namespace plot */