Fix scales::GetRectForLevel according to possible mercator bounds.

This commit is contained in:
Kirill Zhdanovich 2013-04-19 13:42:53 +03:00 committed by Alex Zolotarev
parent 0ff0e2de54
commit 63c86c78d1
2 changed files with 5 additions and 2 deletions

View file

@ -50,7 +50,7 @@ struct MercatorBounds
{
lat = my::clamp(lat, -86.0, 86.0);
double const res = my::RadToDeg(log(tan(my::DegToRad(45.0 + lat * 0.5))));
return my::clamp(res, -180.0, 180.0);
return ClampY(res);
}
inline static double XToLon(double x)

View file

@ -68,7 +68,10 @@ namespace scales
ASSERT_GREATER ( xL, 0.0, () );
ASSERT_GREATER ( yL, 0.0, () );
return m2::RectD(center.x - xL, center.y - yL, center.x + xL, center.y + yL);
return m2::RectD(MercatorBounds::ClampX(center.x - xL),
MercatorBounds::ClampY(center.y - yL),
MercatorBounds::ClampX(center.x + xL),
MercatorBounds::ClampY(center.y + yL));
}
namespace