27 #include "../common/Exception.h"
28 #include "../common/Translator.h"
29 #include "../srs/Converter.h"
51 return Coord2D(m_llx + (m_urx - m_llx) / 2.0, m_lly + (m_ury - m_lly) / 2.0);
63 dx = rhs.
m_llx - m_urx;
67 dx = m_llx - rhs.
m_urx;
73 dy = rhs.
m_lly - m_ury;
77 dy = m_lly - rhs.
m_ury;
87 return sqrt((dx * dx) + (dy * dy));
92 #ifdef TERRALIB_MOD_SRS_ENABLED
93 if(oldsrid == newsrid)
100 converter->setSourceSRID(oldsrid);
101 converter->setTargetSRID(newsrid);
108 double x1, x2, x3, x4;
109 double y1, y2, y3, y4;
112 converter->convert(m_llx, m_lly, x1, y1);
113 converter->convert(m_urx, m_lly, x2, y2);
114 converter->convert(m_urx, m_ury, x3, y3);
115 converter->convert(m_llx, m_ury, x4, y4);
118 m_llx = std::min(std::min(x1,x4),std::min(x2,x3));
119 m_urx = std::max(std::max(x1,x4),std::max(x2,x3));
120 m_lly = std::min(std::min(y1,y4),std::min(y2,y3));
121 m_ury = std::max(std::max(y1,y4),std::max(y2,y3));
123 throw Exception(
TE_TR(
"transform method is not supported!"));
124 #endif // TERRALIB_MOD_SRS_ENABLED
double m_urx
Upper right corner x-coordinate.
An utility struct for representing 2D coordinates.
#define TE_TR(message)
It marks a string in order to get translated.
Coord2D getCenter() const
It returns the rectangle's center coordinate.
double m_llx
Lower left corner x-coordinate.
An Envelope defines a 2D rectangular region.
An Envelope defines a 2D rectangular region.
double distance(const Envelope &rhs) const
It returns the shortest distance between any two points in the two envelopes.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
double m_lly
Lower left corner y-coordinate.
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
double m_ury
Upper right corner y-coordinate.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Coord2D getUpperRight() const
It returns the upper right coordinate of the envelope.
Coord2D getLowerLeft() const
It returns the lower left coordinate of the envelope.
An utility struct for representing 2D coordinates.
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.