CurvePlot.cc 1.66 KB
/*
 * CurvePlot.cc
 *
 *   Created on: 19/09/2014
 *      Author: AKKA
 */

#include "CurvePlot.hh"


namespace plot {

std::ostream& operator<<(std::ostream& out_, const CurvePlot& lprop_){

	out_ << "[CurvePlot]" << std::endl;
	out_ << "{"<<std::endl;
	out_ << "  serie id = " << lprop_._serieId << std::endl;
	if (lprop_._curveFunction == nullptr)
		out_ << "  function name = no function defined!" << std::endl;
	else
		out_ << "  function name = " << lprop_._curveFunction->getFunctionName() << std::endl;
	out_ << "  width = " << lprop_._width << std::endl;
	out_ << "  color = " << lprop_._color << std::endl;
	//out_ << "  style = " << lprop_._style << std::endl;
	out_ << "}" << std::endl;
	return out_;
}

/*
 * Dumps properties for test.
 */
void CurvePlot::dump(std::ostream& out_, std::string& prefix_){
	out_ << prefix_ << "curvePlot.serieId=" << _serieId << std::endl;
	if (_curveFunction == nullptr)
		out_ << prefix_ << "curvePlot.functioName= no function defined!" << std::endl;
	else
		out_ << prefix_ << "curvePlot.functioName=" << _curveFunction->getFunctionName() << std::endl;
	out_ << prefix_ << "curvePlot.width =" << _width << std::endl;
	std::string subPrefix=prefix_+"curvePlot.";
	_color.dump(out_, subPrefix);
	//out_ << prefix_ << "curvePlot.style =" << _style << std::endl;
}

void CurvePlot::resetPlot(void)
{
	_drawn = false;
}

CurveFunctionWriter::CurvePointList& CurvePlot::getPointList(int resolution)
{
	_pointList.clear();
	if (_curveFunction != nullptr)
		_curveFunction->call(resolution,_pointList);
		
	return _pointList;
}

bool CurvePlot::isDrawn(void)
{
	return _drawn;
}

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

} /* namespace plot */