Blame view

src/ParamOutputImpl/Plot/StatusPlot/StatusBarDecorator.hh 3.49 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
/*
 * StatusBarDecorator.hh
 *
 *  Created on: Jan 12, 2015
 *      Author: AKKA
 */

#ifndef STATUSBARDECORATOR_HH_
#define STATUSBARDECORATOR_HH_

#include <boost/smart_ptr/shared_ptr.hpp>
#include <iosfwd>

#include "plplot/plplot.h"
#include <map>

#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:
8c860e4f   Benjamin Renard   Rework for tickpl...
36
	StatusBarDecorator(AMDA::Parameters::ParameterManager& manager, PanelPlotOutput* decoratorPlot);
fbe3c2bb   Benjamin Renard   First commit
37
38
39
40
41
42
43
44
45
46

	StatusBarDecorator(const StatusBarDecorator& ref_ );

	StatusBarDecorator& operator=(const StatusBarDecorator& ref_);

	virtual ~StatusBarDecorator();

	void setColorMapIndex( int colorMapIndex_){
		_colorMapIndex = colorMapIndex_;
	}
e803aecf   Erdogan Furkan   7616 - Adding mod...
47

fbe3c2bb   Benjamin Renard   First commit
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
	int getColorMapIndex() const{
		return _colorMapIndex;
	}

	void setBarPosition(PlotCommon::Position position_)
	{
		_barPosition = position_;
	}

	PlotCommon::Position getBarPosition() const
	{
		return _barPosition;
	}

	/**
	 * Overrides XAxisDecorator::updatePlotArea
	 */
8c860e4f   Benjamin Renard   Rework for tickpl...
65
	void updatePlotArea(PanelPlotOutput* pplot_, Axis* axis_, const Bounds& panelBounds_, Bounds& bounds_);
fbe3c2bb   Benjamin Renard   First commit
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

	/**
	 * Overrides XAxisDecorator::configure
	 */
	void configure(PanelPlotOutput* pplot_, Axis* axis_, double start_, double stop_,
			std::map<std::string, ParameterData> *pParameterValues);

	/**
	 * Overrides XAxisDecorator::draw
	 * @brief Draws tickmark on given time axis
	 */
	void draw(PanelPlotOutput* pplot_, Axis* axis_, std::shared_ptr<plstream> 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;
e803aecf   Erdogan Furkan   7616 - Adding mod...
105
106
107
108
109

		/*
		 * @brief Given color
		 */
		Color _color;
fbe3c2bb   Benjamin Renard   First commit
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
	};

	/**
	 * @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<BarInfo> _barInfoList;
	
	/**
	 * @brief Color Map index to use
	 */
	int _colorMapIndex;
	
	/*
	 * @brief Bar position
	 */
	PlotCommon::Position _barPosition;

	/**
fbe3c2bb   Benjamin Renard   First commit
153
154
	 * @brief Plot that owns parameter values.
	 */
e803aecf   Erdogan Furkan   7616 - Adding mod...
155
	PanelPlotOutput *_decoratorPlot;
fbe3c2bb   Benjamin Renard   First commit
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
};

/**
 * @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_ */