#include <RangeCommand.h>


RangeCommand :: RangeCommand() :
	name("Range")
{
}


string RangeCommand :: execute(Projection *projection, Profile *profile)
{
	Gnuplot * gplt = projection->projection();

	float xmin_ = projection->xmin();
	float xmax_ = projection->xmax();
	float ymin_ = projection->ymin();
	float ymax_ = projection->ymax();

	ymin_ = ymin_ - profile->border() * (ymax_ - ymin_)/2;
	ymax_ = ymax_ + profile->border() * (ymax_ - ymin_)/2;

	gplt->cmd ("set xrange [%f:%f]", xmin_, xmax_);
	gplt->cmd ("set yrange [%f:%f]", ymin_, ymax_);

	return "";
}


