TextPlot.hh 1.64 KB
/*
 * 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(), _xAxisId(""), _yAxisId(""), _x("auto"), _y("auto"), _angle(0), _align(0), _color(), _font("sans-serif", 12), _drawn(false) {
	}

	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),
		_font(pTextPlot_._font),
		_drawn(pTextPlot_._drawn)
	{
	}

	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_._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 _xAxisId;
	std::string _yAxisId;
	std::string _x;
	std::string _y;
	int _angle;
	double _align;
	Color _color;
	Font _font;
	bool _drawn;
};

} /* namespace plot */

#endif /* TEXTPLOT_HH_ */