#ifndef PLOTFUNCTION_HH_ #define PLOTFUNCTION_HH_ // includes boost #include #include "NodeCfg.hh" #include "PanelPlotOutput.hh" #include "PlPlotUtil.hh" #include "PlotFunctionNode.hh" #include "plotFunctionElements/Abscisse.hh" #include #include "DefaultTimeAxisDecorator.hh" #include "TimeAxisDecorator.hh" #include "plplot/plplot.h" #include "plplot/plplotP.h" #include "plplot/plstream.h" #include #include "plplot/plstream.h" extern "C" { #include } #define X_AXIS_ID "x_axis_id" #define Y_AXIS_ID "" namespace plot { class PlotFunction : public PanelPlotOutput { public: enum Function { NONE, FFT, SUM }; PlotFunction(AMDA::Parameters::ParameterManager &manager, boost::shared_ptr panel, TimeAxisDecorator *timeAxisDecorator = new DefaultTimeAxisDecorator()); virtual ~PlotFunction(); /** * @overload plot::PanelPlotOutput */ virtual const std::string typeName() { return PlotFunction_NODENAME; } void setAbscisse(Abscisse abscisse_) { abscisse = abscisse_; }; Abscisse getAbscisse() { return abscisse; }; Function getFunction() { return function; }; void setFunction(Function function_) { function = function_; }; void setParamsNbPoints(std::vector paramsNbPoints_) { paramsNbPoints = paramsNbPoints_; }; void setAbscisseScale(Axis::Scale scale) { abscisseScale = scale; }; Axis::Scale getAbscisseScale() { return abscisseScale; }; Axis::Scale getOrdonneeScale() { return ordonneeScale; }; void setOrdonneeScale(Axis::Scale scale) { ordonneeScale = scale; }; static QSASConfig *qsasconfig; void setTimeAxisDecorator(std::shared_ptr pDecorator_) { _xdecoratorPtr = pDecorator_; } std::shared_ptr getTimeAxisDecorator() { return _xdecoratorPtr; } protected: /** *@brief Draw the serie of a parameter component on plot. */ virtual void drawSeries(double startDate, double stopDate, int intervalIndex, std::string pParamId, SeriesProperties &pSerie, AMDA::Common::ParameterIndexComponent pParamIndex, ParameterAxes ¶m, bool moreThanOneSerieForAxis); virtual void preparePlotArea(double startTime, double stopTime, int intervalIndex); /** * @brief Get original id of the concerned parameter (for the plot) then add it to the usedParametersId_ and store it in originalParamId * * @param usedParametersId_ */ virtual void createParameters(std::list &usedParametersId_); /** * @brief draw the plot for the current time interval */ virtual bool draw(double startTime, double stopTime, int intervalIndex, bool isFirstInterval, bool isLastInterval); // virtual void drawFills(double startDate, double stopDate); private: void configureSeriesAxis(); void configureAxisLegend(); void drawStartDate(std::string _timeFormat, double startTime, double stopTime); void createYAxis(); void createXAxis(); void getMinMax(std::map>, double *minToFill, double *maxToFill); void compute(AMDA::Common::ParameterIndexComponent pParamIndex, plot::ParameterData data, std::string id, std::string param_id); std::map> xValuesMap; std::map> yValuesMap; Function function; std::vector paramsNbPoints; Abscisse abscisse; Axis::Scale abscisseScale; Axis::Scale ordonneeScale; std::shared_ptr _xdecoratorPtr; }; } #endif