Bounds.hh 953 Bytes
/*
 * Bounds.hh
 *
 *  Created on: 28 oct. 2013
 *      Author: CS
 */

#ifndef BOUNDS_HH_
#define BOUNDS_HH_

#include <ostream>
#include <sstream>

namespace plot {

class Bounds {
public:

	Bounds() :
			_x(0), _y(0), _width(1), _height(1) {
	}

	Bounds(double px, double py, double pwidth, double pheight) :
			_x(px), _y(py), _width(pwidth), _height(pheight) {
	}

	Bounds(const Bounds& pbounds) :
			_x(pbounds._x), _y(pbounds._y), _width(pbounds._width), _height(
					pbounds._height) {
	}
	Bounds& operator=(const Bounds& pbounds){
		_x = pbounds._x;
		_y = pbounds._y;
		_width=pbounds._width;
		_height=pbounds._height;
		return *this;
	}
	virtual ~Bounds() {};

	const std::string toString(){
		std::stringstream sstream;
		sstream << "{(" << _x << "," << _y << ") "<< _width << " x " << _height << "}" ;
		return sstream.str();
	}

	double _x;
	double _y;
	double _width;
	double _height;
};

} /* namespace plot */
#endif /* BOUNDS_HH_ */