LayoutProperties.hh
2.59 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
/*
* LayoutProperties.hh
*
* Created on: Sep, 2, 2014
* Author: AKKA
*/
#ifndef LAYOUTPROPERTIES_HH_
#define LAYOUTPROPERTIES_HH_
#include <iostream>
#include <map>
#include <string>
namespace plot {
/**
* available layout types.
*/
enum class LayoutType {
MANUAL, AUTO, VERTICAL, TEMPLATE
};
/**
* string to enum translation. string values must be in
* phase with plot.xsd definition.
*/
static std::map<const std::string, LayoutType> stoLayoutType = {
{"manual", LayoutType::MANUAL},
{"auto", LayoutType::AUTO},
{"vertical", LayoutType::VERTICAL},
{"template", LayoutType::TEMPLATE}
};
/**
* Layout properties. Defines type, height and margin defined for the page layout.
*/
class LayoutProperties {
public:
friend std::ostream& operator<<(std::ostream& out_, const LayoutProperties& lprop_);
/*
* Dumps properties for test.
*/
void dump(std::ostream& out_, std::string& prefix_);
LayoutProperties() :
_type(LayoutType::MANUAL), _panelHeight(0.5), _panelSpacing(0.05), _firstPanelHeightFactor(1.0), _expand(false)
{
}
LayoutProperties(const LayoutProperties& pLayoutProperties_) :
_type(pLayoutProperties_._type),
_panelHeight(pLayoutProperties_._panelHeight),
_panelSpacing(pLayoutProperties_._panelSpacing),
_firstPanelHeightFactor(pLayoutProperties_._firstPanelHeightFactor),
_expand(pLayoutProperties_._expand)
{
}
LayoutProperties& operator=(const LayoutProperties& pLayoutProperties_) {
_type = pLayoutProperties_._type;
_panelHeight = pLayoutProperties_._panelHeight;
_panelSpacing = pLayoutProperties_._panelSpacing;
_firstPanelHeightFactor = pLayoutProperties_._firstPanelHeightFactor;
_expand = pLayoutProperties_._expand;
return *this;
}
virtual ~LayoutProperties() {
}
LayoutType getType() const {
return _type;
}
void setType(LayoutType type) {
_type = type;
}
double getPanelHeight() const {
return _panelHeight;
}
void setPanelHeight(double panelHeight) {
_panelHeight = panelHeight;
}
double getPanelSpacing() const {
return _panelSpacing;
}
void setPanelSpacing(double panelSpacing) {
_panelSpacing = panelSpacing;
}
double getFirstPanelHeightFactor() const {
return _firstPanelHeightFactor;
}
void setFirstPanelHeightFactor(double firstPanelHeightFactor) {
_firstPanelHeightFactor = firstPanelHeightFactor;
}
bool isExpand() const {
return _expand;
}
void setExpand(bool expand) {
_expand = expand;
}
private:
LayoutType _type;
double _panelHeight;
double _panelSpacing;
double _firstPanelHeightFactor;
bool _expand;
};
} /* namespace plot */
#endif /* LAYOUTPROPERTIES_HH_ */