27 #include "terralib_config.h"
28 #include "../common/Exception.h"
29 #include "../common/Translator.h"
30 #include "../srs/Converter.h"
53 return Coord2D(m_llx + (m_urx - m_llx) / 2.0, m_lly + (m_ury - m_lly) / 2.0);
65 dx = rhs.
m_llx - m_urx;
69 dx = m_llx - rhs.
m_urx;
75 dy = rhs.
m_lly - m_ury;
79 dy = m_lly - rhs.
m_ury;
89 return sqrt((dx * dx) + (dy * dy));
94 #ifdef TERRALIB_MOD_SRS_ENABLED
95 if(oldsrid == newsrid)
102 converter->setSourceSRID(oldsrid);
103 converter->setTargetSRID(newsrid);
110 double x1, x2, x3, x4;
111 double y1, y2, y3, y4;
114 converter->convert(m_llx, m_lly, x1, y1);
115 converter->convert(m_urx, m_lly, x2, y2);
116 converter->convert(m_urx, m_ury, x3, y3);
117 converter->convert(m_llx, m_ury, x4, y4);
120 m_llx = std::min(std::min(x1,x4),std::min(x2,x3));
121 m_urx = std::max(std::max(x1,x4),std::max(x2,x3));
122 m_lly = std::min(std::min(y1,y4),std::min(y2,y3));
123 m_ury = std::max(std::max(y1,y4),std::max(y2,y3));
125 throw Exception(
TE_TR(
"transform method is not supported!"));
126 #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.