/* * StatusBarDecorator.hh * * Created on: Jan 12, 2015 * Author: AKKA */ #ifndef STATUSBARDECORATOR_HH_ #define STATUSBARDECORATOR_HH_ #include #include #include "plplot/plplot.h" #include #include "plplot/plstream.h" #include "DefaultTimeAxisDecorator.hh" #include "ParameterData.hh" #include "ParameterIndexesTool.hh" #include "ParamInfo.hh" using std::map; using namespace AMDA::Parameters; using namespace AMDA::Info; namespace plot { /** * @brief decorator used when status bar are needed for a time graph. */ class StatusBarDecorator: public DefaultTimeAxisDecorator { public: StatusBarDecorator(AMDA::Parameters::ParameterManager& manager, PanelPlotOutput* decoratorPlot); StatusBarDecorator(const StatusBarDecorator& ref_ ); StatusBarDecorator& operator=(const StatusBarDecorator& ref_); virtual ~StatusBarDecorator(); void setColorMapIndex( int colorMapIndex_){ _colorMapIndex = colorMapIndex_; } int getColorMapIndex() const{ return _colorMapIndex; } void setBarPosition(PlotCommon::Position position_) { _barPosition = position_; } PlotCommon::Position getBarPosition() const { return _barPosition; } /** * Overrides XAxisDecorator::updatePlotArea */ void updatePlotArea(PanelPlotOutput* pplot_, Axis* axis_, const Bounds& panelBounds_, Bounds& bounds_); /** * Overrides XAxisDecorator::configure */ void configure(PanelPlotOutput* pplot_, Axis* axis_, double start_, double stop_, std::map *pParameterValues); /** * Overrides XAxisDecorator::draw * @brief Draws tickmark on given time axis */ void draw(PanelPlotOutput* pplot_, Axis* axis_, std::shared_ptr pls_); private: /* * @brief Working structure use to store a status bar info */ struct BarInfo { /** * @brief name of the bar */ std::string _name; /** * @brief pointer to the associated ParameterData */ ParameterData* _dataPtr; /** * @brief component to use for the bar */ AMDA::Common::ParameterIndexComponent _index; /* * @brief pointer to the parameter info */ ParamInfoSPtr _paramInfoSPtr; }; /** * @brief Calculates tick values (closest value from the tick time) */ //unsigned int fillSeriesData(SeriesData& seriesdata_, TimeAxis* pAxis_, ParameterData& paramdata_, AMDA::Common::ParameterIndexComponent indexSerie_); /** * @brief Build associated series list */ void buildBarList(void); /** * @brief Calculates plot area for date display */ double computeStartDateWidth(PanelPlotOutput* pplot_, TimeAxis* pAxis_); /** * @brief A logger for tick plot decorator */ static log4cxx::LoggerPtr _logger; /* * @brief Reference to the parameter manager */ ParameterManager& _parameterManager; /** * @brief Bar info list */ std::vector _barInfoList; /** * @brief Color Map index to use */ int _colorMapIndex; /* * @brief Bar position */ PlotCommon::Position _barPosition; /** * @brief Plot that owns parameter values. */ PanelPlotOutput* _decoratorPlot; }; /** * @brief Custom generator for time label, just not display min time. */ //void generateBarTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data); /** * @brief Custom generator for a tick serie (one per serie). */ //void generateBarYLabel(PLINT axis, PLFLT value, char *label, PLINT length, // PLPointer data); } /* namespace plot */ #endif /* STATUSBARDECORATOR_HH_ */