#include <string>
#include <vector>
#include <gnuplot_i.hpp>
#include <Component.h>
#include <Profile.h>

using namespace std;

#ifndef _Projection
#define _Projection

class Command;

class Projection
{
private:
	int ID_;
	Gnuplot *gplt;
	string terminal_;
	string argvComp_;		// string sent by the user with -p or -t option

	vector <Component *> comp;
	vector <Command *> cmds;
	vector <string> compToProj_;	// individual components separated from argvComp_ (: striped)
	vector <string> compToLabel_;	// individual components separated from argvComp_ (: striped)
	vector <string> compToRange_;	// individual components separated from argvComp_ (: striped)
	vector <string> colorToProj_;	// individual components separated from argvComp_ (: striped)

	float xmin_, xmax_, ymin_, ymax_;	// min and max values in x and y coords
	float border;
	bool geometry_;
	float xSmin_, xSmax_, ySmin_, ySmax_;	// special range selected by the user
	bool sRange_;				// indicate spacial range must be used

	void calcRange(string);
	void replaceCompName(void);
	void replaceAll(string& str, const string& from, const string& to);
public:
	Projection(int, string);
	Gnuplot * projection(void);

	int ID(void);
	void addComp(Component *);
	void addCmd(Command *);
	void geometry(argvOpt);

	Command * cmd(int);
	int nCmd(void);
	string terminal(void);
	string argvComp(void);
	string compToProj(int);
	string compToLabel(int);
	string colorToProj(int);
	float xmin(void);
	float xmax(void);
	float ymin(void);
	float ymax(void);
	int nComps(void);	// number of components

	bool sRange(void);
	void setSrange(float, float, float, float);
	void resetSrange(void);

	void triangularTransform(void);
	void extractArgv(void);
	void findColors(void);
	void showComps(void);
};

#endif
