/* * DefaultTimeAxisDecorator.hh * * Created on: Dec 17, 2013 * Author: amdadev */ #ifndef DEFAULTIMEAXISDECORATOR_HH_ #define DEFAULTIMEAXISDECORATOR_HH_ #include #include #include "plplot/plplot.h" #include "plplot/plstream.h" #include "TimeAxisDecorator.hh" namespace plot { /** * @brief A simple decorator that just display time with a calculated format * on each major tickmark of a time axis. */ class DefaultTimeAxisDecorator: public TimeAxisDecorator { public: DefaultTimeAxisDecorator() : TimeAxisDecorator() { _timeFormat = boost::shared_ptr(new std::string()); } DefaultTimeAxisDecorator(const DefaultTimeAxisDecorator& ref_ ) : TimeAxisDecorator(ref_){ _timeFormat = boost::shared_ptr(new std::string(*(ref_._timeFormat))); } DefaultTimeAxisDecorator& operator=(const DefaultTimeAxisDecorator& ref_) { if( _timeFormat == nullptr ){ _timeFormat = boost::shared_ptr(new std::string(*(ref_._timeFormat))); } else{ _timeFormat->assign(*(ref_._timeFormat)); } return *this; } virtual ~DefaultTimeAxisDecorator(){ } /** * @overloads XAxisDecorator::updatePlotArea */ void updatePlotArea(PanelPlotOutput* pplot_, Axis* axis_, const Bounds& panelBounds_, Bounds& bounds_); /** * @overloads XAxisDecorator::configure */ void configure(PanelPlotOutput* pplot_, Axis* axis_, double start_, double stop_, std::map *pParameterValues); /** * @overloads XAxisDecorator::draw */ void draw(PanelPlotOutput* pplot_, Axis* axis_, std::shared_ptr pls_); protected: /** * @overload TimeAxisDecorator::installLabelGenerator */ void installLabelGenerator(PanelPlotOutput* pplot_, TimeAxis* axis_); boost::shared_ptr _timeFormat; }; /** * @brief Custom generator for time label, just not display min time. */ void generateDefaultTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data); /** * @brief Custom generator for time label, doesn't display anything (if showTickMark = false). */ void generateNoTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data); } /* namespace plot */ #endif /* DEFAULTIMEAXISDECORATOR_HH_ */