ConstantLine.hh 2.02 KB
/*
 * ConstantLine.hh
 *
 *  Created on: Jun 26, 2014
 *      Author: AKKA
 */

#ifndef CONSTANTLINE_HH_
#define CONSTANTLINE_HH_

#include <iostream>
#include <string>

#include "LineProperties.hh"

namespace plot {

/**
 * ConstantLine. Defines style, width, color and position of each constant line drawn
 * on a panel for an axis.
 */
class ConstantLine {
public:
	friend std::ostream& operator<<(std::ostream& out_, const ConstantLine& lprop_);
	/*
	 * Dumps properties for test.
	 */
	void dump(std::ostream& out_, std::string& prefix_);


	ConstantLine() :
			_width(1), _color(), _style(LineStyle::PLAIN), _value(), _id(-1), _drawn(false) {
	}

	ConstantLine(const ConstantLine& pConstantLine_) :
			_width(pConstantLine_._width),
			_color(pConstantLine_._color),
			_style(pConstantLine_._style),
			_value(pConstantLine_._value),
			_id(pConstantLine_._id),
			_drawn(pConstantLine_._drawn){
	}

	ConstantLine& operator=(const ConstantLine& pConstantLine_) {
		_width = pConstantLine_._width;
		_color = pConstantLine_._color;
		_style = pConstantLine_._style;
		_value = pConstantLine_._value;
		_id	   = pConstantLine_._id;
		_drawn = pConstantLine_._drawn;
		return *this;
	}

	virtual ~ConstantLine() {
	}

	void reset()
	{
		_drawn = false;
	}

	const Color& getColor() const{
		return _color;
	}
	Color& getColor() {
		return _color;
	}
	void setColor(const Color& color) {
		_color = color;
	}

	LineStyle getStyle() const {
		return _style;
	}
	void setStyle(const LineStyle& style) {
		_style = style;
	}

	int getWidth() const {
		return _width;
	}

	void setWidth(int width) {
		_width = width;
	}

	std::string getValue() const {
		return _value;
	}

	void setValue(const std::string &value) {
		_value = value;
	}

	int getId() const {
		return _id;
	}

	void setId(int id) {
		_id = id;
	}

	bool isDrawn(void)
	{
		return _drawn;
	}

	void setDrawn(bool drawn)
	{
		_drawn = drawn;
	}

private:
	int _width;
	Color _color;
	LineStyle _style;
	std::string _value;
	int _id;
	bool _drawn;

};

} /* namespace plot */

#endif /* CONSTANTLINE_HH_ */