Blame view

src/ParamOutputImpl/Plot/TextPlot.hh 1.92 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * TextPlot.hh
 *
 *  Created on: 01/07/2014
 *      Author: AKKA
 */

#ifndef TEXTPLOT_HH_
#define TEXTPLOT_HH_

#include <iostream>
#include <string>

f6eaec4e   Benjamin Renard   Optimize plot ele...
14
#include "Label.hh"
fbe3c2bb   Benjamin Renard   First commit
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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() :
f6eaec4e   Benjamin Renard   Optimize plot ele...
33
		 _text(), _xAxisId(""), _yAxisId(""), _x("auto"), _y("auto"), _angle(0), _align(0), _color(), _drawn(false), _font("sans-serif", 12) {
fbe3c2bb   Benjamin Renard   First commit
34
35
36
37
	}

	TextPlot(const TextPlot& pTextPlot_) :
		_text(pTextPlot_._text),
078ec265   Benjamin Renard   Give the possibil...
38
39
		_xAxisId(pTextPlot_._xAxisId),
		_yAxisId(pTextPlot_._yAxisId),
fbe3c2bb   Benjamin Renard   First commit
40
41
42
43
44
		_x(pTextPlot_._x),
		_y(pTextPlot_._y),
		_angle(pTextPlot_._angle),
		_align(pTextPlot_._align),
		_color(pTextPlot_._color),
f6eaec4e   Benjamin Renard   Optimize plot ele...
45
46
		_drawn(pTextPlot_._drawn),
		_font(pTextPlot_.getFont())
fbe3c2bb   Benjamin Renard   First commit
47
48
49
50
51
	{
	}

	TextPlot& operator=(const TextPlot& pTextPlot_) {
		_text  = pTextPlot_._text;
078ec265   Benjamin Renard   Give the possibil...
52
53
		_xAxisId = pTextPlot_._xAxisId;
		_yAxisId = pTextPlot_._yAxisId;
fbe3c2bb   Benjamin Renard   First commit
54
55
56
57
58
		_x = pTextPlot_._x;
		_y = pTextPlot_._y;
		_angle = pTextPlot_._angle;
		_align = pTextPlot_._align;
		_color = pTextPlot_._color;
f6eaec4e   Benjamin Renard   Optimize plot ele...
59
		_font = pTextPlot_.getFont();
fbe3c2bb   Benjamin Renard   First commit
60
61
62
63
64
65
66
		_drawn = pTextPlot_._drawn;
		return *this;
	}

	virtual ~TextPlot() {
	}

f6eaec4e   Benjamin Renard   Optimize plot ele...
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	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;
	}

fbe3c2bb   Benjamin Renard   First commit
83
84
85
86
87
88
89
90
91
92
93
94
	void reset()
	{
		_drawn = false;
	}

	bool isDrawn(void);

	void setDrawn(bool drawn);

public:

	std::string _text;
078ec265   Benjamin Renard   Give the possibil...
95
96
	std::string _xAxisId;
	std::string _yAxisId;
fbe3c2bb   Benjamin Renard   First commit
97
98
99
100
101
	std::string _x;
	std::string _y;
	int _angle;
	double _align;
	Color _color;
fbe3c2bb   Benjamin Renard   First commit
102
	bool _drawn;
f6eaec4e   Benjamin Renard   Optimize plot ele...
103
104
105
106

private:
	Font _font;

fbe3c2bb   Benjamin Renard   First commit
107
108
109
110
111
};

} /* namespace plot */

#endif /* TEXTPLOT_HH_ */