TextPlot.hh
1.92 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
/*
* TextPlot.hh
*
* Created on: 01/07/2014
* Author: AKKA
*/
#ifndef TEXTPLOT_HH_
#define TEXTPLOT_HH_
#include <iostream>
#include <string>
#include "Label.hh"
#include "Color.hh"
#include "Font.hh"
namespace plot {
/**
* TextPlot. Defines attributes of each text drawn on a view port.
*/
class TextPlot {
public:
friend std::ostream& operator<<(std::ostream& out_, const TextPlot& lprop_);
/*
* Dumps properties for test.
*/
void dump(std::ostream& out_, std::string& prefix_);
TextPlot() :
_text(), _xAxisId(""), _yAxisId(""), _x("auto"), _y("auto"), _angle(0), _align(0), _color(), _drawn(false), _font("sans-serif", 12) {
}
TextPlot(const TextPlot& pTextPlot_) :
_text(pTextPlot_._text),
_xAxisId(pTextPlot_._xAxisId),
_yAxisId(pTextPlot_._yAxisId),
_x(pTextPlot_._x),
_y(pTextPlot_._y),
_angle(pTextPlot_._angle),
_align(pTextPlot_._align),
_color(pTextPlot_._color),
_drawn(pTextPlot_._drawn),
_font(pTextPlot_.getFont())
{
}
TextPlot& operator=(const TextPlot& pTextPlot_) {
_text = pTextPlot_._text;
_xAxisId = pTextPlot_._xAxisId;
_yAxisId = pTextPlot_._yAxisId;
_x = pTextPlot_._x;
_y = pTextPlot_._y;
_angle = pTextPlot_._angle;
_align = pTextPlot_._align;
_color = pTextPlot_._color;
_font = pTextPlot_.getFont();
_drawn = pTextPlot_._drawn;
return *this;
}
virtual ~TextPlot() {
}
const Font& getFont() const {
return _font;
}
void setFont(const Font& font) {
_font = font;
}
void setFontStyle(Font::Style fontStyle) {
_font._style = fontStyle;
}
void setFontWeight(int fontWeight) {
_font._weight = fontWeight;
}
void reset()
{
_drawn = false;
}
bool isDrawn(void);
void setDrawn(bool drawn);
public:
std::string _text;
std::string _xAxisId;
std::string _yAxisId;
std::string _x;
std::string _y;
int _angle;
double _align;
Color _color;
bool _drawn;
private:
Font _font;
};
} /* namespace plot */
#endif /* TEXTPLOT_HH_ */