Blame view

src/ParamOutputImpl/Plot/TextPlot.hh 1.44 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * TextPlot.hh
 *
 *  Created on: 01/07/2014
 *      Author: AKKA
 */

#ifndef TEXTPLOT_HH_
#define TEXTPLOT_HH_

#include <iostream>
#include <string>

#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(), _x("auto"), _y("auto"), _angle(0), _align(0), _color(), _font("sans-serif", 12), _drawn(false) {
	}

	TextPlot(const TextPlot& pTextPlot_) :
		_text(pTextPlot_._text),
		_x(pTextPlot_._x),
		_y(pTextPlot_._y),
		_angle(pTextPlot_._angle),
		_align(pTextPlot_._align),
		_color(pTextPlot_._color),
		_font(pTextPlot_._font),
		_drawn(pTextPlot_._drawn)
	{
	}

	TextPlot& operator=(const TextPlot& pTextPlot_) {
		_text  = pTextPlot_._text;
		_x = pTextPlot_._x;
		_y = pTextPlot_._y;
		_angle = pTextPlot_._angle;
		_align = pTextPlot_._align;
		_color = pTextPlot_._color;
		_font = pTextPlot_._font;
		_drawn = pTextPlot_._drawn;
		return *this;
	}

	virtual ~TextPlot() {
	}

	void reset()
	{
		_drawn = false;
	}

	bool isDrawn(void);

	void setDrawn(bool drawn);

public:

	std::string _text;
	std::string _x;
	std::string _y;
	int _angle;
	double _align;
	Color _color;
	Font _font;
	bool _drawn;
};

} /* namespace plot */

#endif /* TEXTPLOT_HH_ */