Blame view

src/ParamOutputImpl/Plot/AxisLegend.cc 929 Bytes
df45df5e   Benjamin Renard   Introduce AxisLeg...
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
/*
 * AxisLegend.cc
 *
 *  Created on: 01 jun. 2018
 *      Author: AKKA
 */

#include "AxisLegend.hh"
#include <sstream>
#include <algorithm>
#include <boost/regex.hpp>
#include <boost/algorithm/string/regex.hpp>

namespace plot {

LabelRowInfo append(LabelRowInfo& a, LabelRowInfo& b)
{
	LabelRowInfo result;
	for (auto row : a) {
		result.push_back(row);
	}
	for (auto row : b) {
		result.push_back(row);
	}
	return result;
}

LabelRowInfo AxisLegend::getRowNumber(AxisLegend const& pLegend) {
	LabelRowInfo lMergedLegend;

	for (auto label : pLegend._labels) {
		LabelRowInfo labelRow = Label::getRowNumber(label);
		lMergedLegend = append(lMergedLegend, labelRow);
	}

	return lMergedLegend;
}

void AxisLegend::dump(std::ostream& out, std::string& prefix) {
	prefix += "legend.";
	out << prefix << "color=" << _color << std::endl;
	_font.dump(out, prefix);
	for (auto label : _labels) {
		label.dump(out, prefix);
	}
}

}