Blame view

src/ParamOutputImpl/Plot/Epoch/EpochPlot.hh 2.57 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * EpochPlot.hh
 *
 *  Created on: 16 jan. 2015
 *      Author: AKKA
 */

#ifndef EPOCHPLOT_HH_
#define EPOCHPLOT_HH_

#include "PanelPlotOutput.hh"
#include "NodeCfg.hh"

#include <algorithm>
#include <map>
#include <memory>

#include "EpochAxisDecorator.hh"


#include "TimeAxisDecorator.hh"

#include "EpochPlotNode.hh"

namespace plot {

class EpochAxis;

class EpochPlot: public PanelPlotOutput {
public:

	EpochPlot(AMDA::Parameters::ParameterManager& manager,
			boost::shared_ptr<Panel> panel);

	virtual ~EpochPlot();
	/**
	 * @overload plot::PanelPlotOutput
	 */
	virtual const std::string typeName(){
		return EPOCHPLOT_NODENAME;
	}

	/**
	 * @brief overloads ParamOutput::preparePlotArea
	 */
	virtual void preparePlotArea (double startTime, double stopTime, int intervalIndex);

	/**
	 * @brief overloads ParamOutput::draw()
	 */
	virtual void draw(double startTime, double stopTime, int intervalIndex, bool isFirstInterval, bool isLastInterval);

	/*
	 * @brief get a pointer to the epoch axis
	 */
	EpochAxis* getEpochAxis();

	/*
	 * @brief set the center time id in the input catalog file
	 */
	void setCenterTimeId(std::string centerTimeId);

protected:
	/**
	 * @overload PanelPlotOutput::calculatePlotArea(Bounds const& pPanelBounds, bool pKeepRatio)
	 * @brief Calculate and draw plot area.
	 */
	virtual void calculatePlotArea(Bounds& bounds_);

	/**
	 * @overload PanelPlotOutput::drawSeries(double startDate, double stopDate, std::string pParamId, SeriesProperties const& pSerie)
	 * @brief Draw series of parameter on plot.
	 */
	virtual void drawSeries(double startDate, double stopDate, int intervalIndex, std::string pParamId,
			SeriesProperties& pSeries,
			AMDA::Common::ParameterIndexComponent pParamIndex,
			ParameterAxes& param, bool moreThanOneSerieForAxis);

	void drawXAxis(boost::shared_ptr<Axis> pXAxis, PlWindow& pPlWindow, Bounds& pPlotAreaSize, TickConf& pTickConf);

private:
	const std::string getXAxisId() const;

	/**
	 * @brief Configure series color (symbols and line) and range of axis (depending of parameters series to draw).
	 */
	void configureSeriesAxis();

	/**
	 * @brief Configure axis legend with paramInfo.
	 */
	void configureAxisLegend();

	/*
	 * @brief Epoch time axis decorator
	 */
	std::shared_ptr<EpochAxisDecorator> _epochDecoratorPtr;

	/*
	 * @brief Center time id defined in the input catalog
	 */
	std::string _centerTimeId;
};

/**
 * @brief Custom generator for time label, just not display min time.
 */
void generateTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length,
		PLPointer data);

} /* namespace plot */
#endif /* EPOCHPLOT_HH_ */