CurvePlot.hh 1.64 KB
/*
 * CurvePlot.hh
 *
 *  Created on: 19/09/2014
 *      Author: AKKA
 */

#ifndef CURVEPLOT_HH_
#define CURVEPLOT_HH_

#include <iostream>
#include <string>
#include <memory>

#include "LineProperties.hh"
#include "CurveFunction/CurveFunctionWriter.hh"

namespace plot {

/**
 * CurvePlot. Defines attributes of each curve drawn on a view port.
 */
class CurvePlot {
public:
	friend std::ostream& operator<<(std::ostream& out_, const CurvePlot& lprop_);
	/*
	 * Dumps properties for test.
	 */
	void dump(std::ostream& out_, std::string& prefix_);


	CurvePlot() :
		_serieId(-1), _width(1), _color(0,0,0), _style(LineStyle::PLAIN), _drawn(false) {
	}

	CurvePlot(const CurvePlot& pCurvePlot_) :
		_serieId(pCurvePlot_._serieId),
		_width(pCurvePlot_._width),
		_color(pCurvePlot_._color),
		_style(pCurvePlot_._style),
		_drawn(pCurvePlot_._drawn),
		_curveFunction(pCurvePlot_._curveFunction),
		_pointList()
	{
	}

	CurvePlot& operator=(const CurvePlot& pCurvePlot_) {
		_serieId = pCurvePlot_._serieId;
		_width = pCurvePlot_._width;
		_color = pCurvePlot_._color;
		_style = pCurvePlot_._style;
		_drawn = pCurvePlot_._drawn;
		_curveFunction = pCurvePlot_._curveFunction;
		_pointList.clear();
		return *this;
	}

	virtual ~CurvePlot() {
	}
	
	void resetPlot(void);

	CurveFunctionWriter::CurvePointList& getPointList(int resolution);

	bool isDrawn(void);

	void setDrawn(bool drawn);

public:
	int         _serieId;
	int         _width;
	Color       _color;
	LineStyle   _style;
	bool        _drawn;
	
	std::shared_ptr<CurveFunctionWriter> _curveFunction;
	
private:
	CurveFunctionWriter::CurvePointList _pointList;
};

} /* namespace plot */

#endif /* CURVEPLOT_HH_ */