TimeAxisDecorator.hh 1.63 KB
/*
 * TickMarkHandler.hh
 *
 *  Created on: Dec 17, 2013
 *      Author: amdadev
 */

#ifndef TIMEAXISDECORATOR_HH_
#define TIMEAXISDECORATOR_HH_


#include <iosfwd>

#include "XAxisDecorator.hh"
#include "PanelPlotOutput.hh"
#include "TimeAxis.hh"

namespace plot {

/**
 * @brief Time 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 TimeAxisDecorator :public XAxisDecorator {
public:
	/**
	 * @brief Default constructor
	 */
	TimeAxisDecorator(): XAxisDecorator() {}

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

	/**
	 * default destructor
	 */
	virtual ~TimeAxisDecorator(){}

	/**
	 * @brief Gets the format used by plPlot for this axis values.
	 * This method should be called after TickMarkHandler::configure has been called, since it
	 * may process the format.
	 * @return
	 */
	const std::string& getPlFormat() const {
		return _PLFormat;
	}


protected:
	/**
	 * @brief Install function used to format each values when displaying tick mark informations.
	 * @param plot_ plot that is decorated
	 * @param axis_ time axis to decorate
	 * @return
	 */
	virtual void installLabelGenerator(PanelPlotOutput* pplot_,TimeAxis* axis_)  =0;

	void setPlFormat(const std::string& plFormat_) {
		_PLFormat = plFormat_;
	}


private:
	/**
	 * PLPlot format for time values.
	 */
	std::string _PLFormat;

};

} /* namespace plot */

#endif /* TIMEAXISDECORATOR_HH_ */