Bounds.hh
953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* 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_ */