TextPlot.hh 1.78 KB
/*
 * 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 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_ */