Blame view

src/ParamOutputImpl/Plot/LayoutVertical.hh 2.1 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
/*
 * LayoutVertical.hh
 *
 *  Created on: Sep, 2, 2014
 *      Author: AKKA
 */

#ifndef LAYOUTVERTICAL_HH_
#define LAYOUTVERTICAL_HH_
fbe3c2bb   Benjamin Renard   First commit
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <map>
#include <vector>
#include <string>

#include "Layout.hh"

namespace plot {

class PanelInfo {
public:
1d1a3b8a   Erdogan Furkan   Done for tickPlot...
21
	PanelInfo (PanelConstraint constraint, double preferedWidth, double preferedHeight, double width, double height, bool isHeightFixed) :
fbe3c2bb   Benjamin Renard   First commit
22
23
24
25
		_constraint(constraint),
		_preferedWidth(preferedWidth),
		_preferedHeight(preferedHeight),
		_width(width),
1d1a3b8a   Erdogan Furkan   Done for tickPlot...
26
27
		_height(height),
		_isHeightFixed(isHeightFixed) {
fbe3c2bb   Benjamin Renard   First commit
28
29
30
31
32
33
34
	}

	PanelConstraint _constraint;
	double			_preferedWidth;
	double			_preferedHeight;
	double			_width;
	double			_height;
1d1a3b8a   Erdogan Furkan   Done for tickPlot...
35
	bool 			_isHeightFixed;
fbe3c2bb   Benjamin Renard   First commit
36
37
38
39
40
41
42
};

/**
 * LayoutVertical
 */
class LayoutVertical : public Layout {
public:
12353568   Benjamin Renard   Add layout proper...
43
44
	LayoutVertical(double panelHeight, double panelSpacing, double firstPanelHeightFactor = 1.0, bool autoExpand = true, double xyRatio = 1.0, bool onlyLowerTimeAxesLegend = false) :
		Layout (panelHeight, panelSpacing, firstPanelHeightFactor, autoExpand, xyRatio, onlyLowerTimeAxesLegend),
fbe3c2bb   Benjamin Renard   First commit
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
		_curPanel(0),
		_curYPosition(0),
		_maxWidthConstraintFound(false),
		_computedPanelBounds(),
		_panelYSpacing(0),
 		_firstPanelHeightDelta(0)
	{
	}

	virtual ~LayoutVertical() {
		for (auto panelInfo : _panelsInfo) {
			delete panelInfo;
		}
		_panelsInfo.clear();
	}

1d1a3b8a   Erdogan Furkan   Done for tickPlot...
61
	void computePanelsPosition (std::vector<boost::shared_ptr<PanelPlotOutput>> _plots,  std::map<std::string, ParameterData> *parameterValues = NULL);
fbe3c2bb   Benjamin Renard   First commit
62
63

private:
1d1a3b8a   Erdogan Furkan   Done for tickPlot...
64
	void computeLayoutSize (double &layoutWidth, double &layoutHeight, double &fixedHeight);
fbe3c2bb   Benjamin Renard   First commit
65
66
67
68
69
70
71
72
73
74
75
	void expand (double ratio);

	int 		_curPanel;
	double 		_curYPosition;
	bool		_maxWidthConstraintFound;

	Bounds		_computedPanelBounds;
	double		_panelYSpacing;
	double 		_firstPanelHeightDelta;

	std::vector<PanelInfo *> _panelsInfo;
2f0b202e   Benjamin Renard   Reverse panels or...
76

1d1a3b8a   Erdogan Furkan   Done for tickPlot...
77
78
	void addPanel (PanelConstraint panelConstraint, double preferedWidth=-1, double preferedHeight=-1, 
				   bool isHeightFixed = false, double fixedHeight =0);
2f0b202e   Benjamin Renard   Reverse panels or...
79
80
81
82
83

	void reset (void);

	Bounds & getNextBounds (PanelConstraint panelConstraint);

fbe3c2bb   Benjamin Renard   First commit
84
85
86
87
88
};

} /* namespace plot */

#endif /* LAYOUTVERTICAL_HH_ */