Beispiel #1
0
bool Coordinate::IsValid() const
{
    return !(lat > FixedLatitude(90 * COORDINATE_PRECISION) ||
             lat < FixedLatitude(-90 * COORDINATE_PRECISION) ||
             lon > FixedLongitude(180 * COORDINATE_PRECISION) ||
             lon < FixedLongitude(-180 * COORDINATE_PRECISION));
}
Beispiel #2
0
 void MergeBoundingBoxes(const RectangleInt2D &other)
 {
     min_lon = std::min(min_lon, other.min_lon);
     max_lon = std::max(max_lon, other.max_lon);
     min_lat = std::min(min_lat, other.min_lat);
     max_lat = std::max(max_lat, other.max_lat);
     BOOST_ASSERT(min_lon != FixedLongitude(std::numeric_limits<std::int32_t>::min()));
     BOOST_ASSERT(min_lat != FixedLatitude(std::numeric_limits<std::int32_t>::min()));
     BOOST_ASSERT(max_lon != FixedLongitude(std::numeric_limits<std::int32_t>::min()));
     BOOST_ASSERT(max_lat != FixedLatitude(std::numeric_limits<std::int32_t>::min()));
 }
Beispiel #3
0
 Coordinate Centroid() const
 {
     Coordinate centroid;
     // The coordinates of the midpoints are given by:
     // x = (x1 + x2) /2 and y = (y1 + y2) /2.
     centroid.lon = (min_lon + max_lon) / FixedLongitude(2);
     centroid.lat = (min_lat + max_lat) / FixedLatitude(2);
     return centroid;
 }