XAxisDecorator.hh 1.83 KB
/*
 * XAxisDecorator.hh
 *
 *  Created on: Dec 21, 2013
 *      Author: amdadev
 */

#ifndef XAXISDECORATOR_HH_
#define XAXISDECORATOR_HH_
#include <memory>

#include "Bounds.hh"
#include "plplot/plstream.h"
#include "PanelPlotOutput.hh"

namespace plot{

/**
 * x axis decorator. decorator is attached to a plot panel and is used to add decoration to the x axis.
 * This class is responsible of reserving space for what it needs to draw in the panel, configuring itself and
 * draws additional stuff it manage.
 */
class XAxisDecorator {
public:
	/**
	 * @brief Constructor
	 */
	XAxisDecorator() : _pParameterValues(NULL) {}

	/**
	 * @brief Copy constructor
	 */
	XAxisDecorator(const XAxisDecorator& ref_):
		_pParameterValues(ref_._pParameterValues) {}

	virtual ~XAxisDecorator(){}

	/**
	 * update plot area according to space needed by this decorator to display item it manages.
	 * @param pplot_ related plot
	 * @param axis_ axis to decorate
	 * @param bounds_ plot area to update.
	 */
	virtual void updatePlotArea(PanelPlotOutput* pplot_, Axis* axis_, Bounds& bounds_)=0;
	/**
	 * configure the decorator according to axis range.
	 * @param pplot_ related plot
	 * @param axis_ axis to configure
	 * @param start_ axis range start.
	 * @param end_ axis range end.
	 * @param pParameterValues pointer to a map of ParameterData
	 */
	virtual void configure(PanelPlotOutput* pplot_, Axis* axis_, double start_, double end_,
			std::map<std::string, ParameterData> *pParameterValues) = 0;
	/**
	 * draw decorator stuff.
	 * @param pplot_ related plot
	 * @param axis_ axis to decorate
	 * @param pls_ plot stream executing plot directives.
	 */
	virtual void draw(PanelPlotOutput* pplot_, Axis* axis_, std::shared_ptr<plstream> pls_)=0;

protected:
	std::map<std::string, ParameterData> *_pParameterValues;
};

} // namespace plot
#endif /* XAXISDECORATOR_HH_ */