ESA JPIP server  0.1
woi.h
Go to the documentation of this file.
1 #ifndef _JPIP_WOI_H_
2 #define _JPIP_WOI_H_
3 
4 
5 #include <iostream>
6 #include "jpeg2000/point.h"
7 
8 
9 namespace jpip
10 {
11 
12  using namespace std;
13  using namespace jpeg2000;
14 
15 
24  class WOI
25  {
26  public:
29  int resolution;
30 
31 
35  WOI()
36  {
37  resolution = 0;
38  }
39 
46  WOI(const Point& position, const Size& size, int resolution)
47  {
48  this->size = size;
49  this->position = position;
50  this->resolution = resolution;
51  }
52 
56  WOI(const WOI& woi)
57  {
58  *this = woi;
59  }
60 
64  WOI& operator=(const WOI& woi)
65  {
66  this->size = woi.size;
67  this->position = woi.position;
68  this->resolution = woi.resolution;
69 
70  return *this;
71  }
72 
77  friend bool operator==(const WOI& a, const WOI& b)
78  {
79  return ((a.position == b.position) && (a.size == b.size) && (a.resolution == b.resolution));
80  }
81 
86  friend bool operator!=(const WOI& a, const WOI& b)
87  {
88  return !(a == b);
89  }
90 
91  friend ostream& operator << (ostream &out, const WOI &woi)
92  {
93  out << "(" << woi.position.x << ", " << woi.position.y << ", "
94  << woi.size.x << ", " << woi.size.y << ", " << woi.resolution << ")";
95 
96  return out;
97  }
98 
99  virtual ~WOI()
100  {
101  }
102  };
103 
104 }
105 
106 
107 #endif /* _JPIP_WOI_H_ */
WOI(const WOI &woi)
Copy constructor.
Definition: woi.h:56
Class that identifies a WOI (Window Of Interest).
Definition: woi.h:24
WOI()
Initializes the resolution level to zero.
Definition: woi.h:35
WOI & operator=(const WOI &woi)
Copy assignment.
Definition: woi.h:64
friend bool operator!=(const WOI &a, const WOI &b)
Returns true if the two given WOIs are not equal.
Definition: woi.h:86
Represents a couple of integer values that can be used to identify a coordinate as well as a size...
Definition: point.h:18
Size size
Size of the WOI (width and height)
Definition: woi.h:27
friend bool operator==(const WOI &a, const WOI &b)
Returns true if the two given WOIs are equal.
Definition: woi.h:77
int y
Value Y.
Definition: point.h:22
int x
Value X.
Definition: point.h:21
virtual ~WOI()
Definition: woi.h:99
WOI(const Point &position, const Size &size, int resolution)
Initializes the object.
Definition: woi.h:46
int resolution
Resolution level where the WOI is located (0 == the highest)
Definition: woi.h:29
Point position
Position of the upper-left corner of the WOI.
Definition: woi.h:28
ostream & operator<<(ostream &out, const Request &request)
Definition: request.cc:65