PlotCommon.cc 1.78 KB
/*
 * PlotCommon.cc
 *
 *  Created on: 30 oct. 2013
 *      Author: CS
 */

#include "PlotCommon.hh"

namespace plot {

PlotCommon::PlotCommon() {

}

PlotCommon::~PlotCommon() {

}

/**
 * Sets title align.
 */
void PlotCommon::setTitleAlign(const std::string& pAlign,
		PlotCommon::Align& intoValue) {
	if (pAlign == "center") {
		intoValue = PlotCommon::Align::CENTER;
	} else if (pAlign == "left") {
		intoValue = PlotCommon::Align::LEFT;
	} else if (pAlign == "right") {
		intoValue = PlotCommon::Align::RIGHT;
	}
}

/**
 * Sets title or label position.
 */
void PlotCommon::setPosition(const std::string& pPosition,
		PlotCommon::Position& intoValue) {
	if (pPosition == "top") {
		intoValue = PlotCommon::Position::POS_TOP;
	} else if (pPosition == "bottom") {
		intoValue = PlotCommon::Position::POS_BOTTOM;
	} else if (pPosition == "left") {
		intoValue = PlotCommon::Position::POS_LEFT;
	} else if (pPosition == "right") {
		intoValue = PlotCommon::Position::POS_RIGHT;
	} else if (pPosition == "center") {
		intoValue = PlotCommon::Position::POS_CENTER;
	}
}

std::ostream & operator <<(std::ostream & out,
		PlotCommon::Position & position) {
	switch (position) {
	case PlotCommon::Position::POS_TOP:
		out << "Top";
		break;
	case PlotCommon::Position::POS_BOTTOM:
		out << "Bottom";
		break;
	case PlotCommon::Position::POS_LEFT:
		out << "Left";
		break;
	case PlotCommon::Position::POS_RIGHT:
		out << "Right";
		break;
	case PlotCommon::Position::POS_CENTER:
		out << "Center";
		break;

	}
	return out;
}
std::ostream & operator <<(std::ostream & out, PlotCommon::Align & ALIGN) {
	switch (ALIGN) {
	case PlotCommon::Align::CENTER:
		out << "Center";
		break;
	case PlotCommon::Align::LEFT:
		out << "Left";
		break;
	case PlotCommon::Align::RIGHT:
		out << "Right";
	}
	return out;
}

} /* namespace plot */