#include <PrintEpsCommand.h>
#include <PlotCommand.h>


PrintEpsCommand :: PrintEpsCommand() :
	name("PrintEps")
{
}


string PrintEpsCommand :: execute(Projection *projection, Profile *profile)
{
	string decor;

	Gnuplot * gplt = projection->projection();

	if ( profile->decoration() )
		decor = "_decor";
	else
		decor = "";

	system ("mkdir -p img");
	cout << "Saving image 'img/proj"<< projection->ID() << "_step" << profile->index() << decor << ".eps" << endl;

	gplt->cmd ("set terminal postscript eps size 7.0,5.24 enhanced color");
	gplt->cmd ("set output 'img/proj%d_step%d%s.eps'", projection->ID(), profile->index(), decor.c_str());

	PlotCommand * plotCmd = new PlotCommand;
	plotCmd->execute(projection, profile);

	gplt->cmd ("set term %s noraise title 'Projection %d'", projection->terminal().c_str(), projection->ID());
	gplt->cmd ("unset output");

	return "";
}


