AxisLegend.cc 929 Bytes
/*
 * 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);
	}
}

}