Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-03-30 17:52:53 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:37:10 +0300
commit75d43c2d566d3efd3b4b865ec0df5c6e29a6dd13 (patch)
tree9f87c5c686a48a528dcece9d4418bd2cc68e0215 /indexer/mercator.hpp
parent3299c163061266e002cbc9696544ecacfaa3866e (diff)
Add some functions for coordinates checking.
Diffstat (limited to 'indexer/mercator.hpp')
-rw-r--r--indexer/mercator.hpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/indexer/mercator.hpp b/indexer/mercator.hpp
index ae41831b61..b976fb2509 100644
--- a/indexer/mercator.hpp
+++ b/indexer/mercator.hpp
@@ -12,18 +12,31 @@ struct MercatorBounds
static double minY;
static double maxY;
- inline static double ClampX(double d)
+ inline static bool ValidLon(double d)
+ {
+ return my::between_s(-180.0, 180.0, d);
+ }
+ inline static bool ValidLat(double d)
{
- if (d < MercatorBounds::minX) return MercatorBounds::minX;
- if (d > MercatorBounds::maxX) return MercatorBounds::maxX;
- return d;
+ return my::between_s(-90.0, 90.0, d);
}
+ inline static bool ValidX(double d)
+ {
+ return my::between_s(minX, maxX, d);
+ }
+ inline static bool ValidY(double d)
+ {
+ return my::between_s(minY, maxY, d);
+ }
+
+ inline static double ClampX(double d)
+ {
+ return my::clamp(d, minX, maxX);
+ }
inline static double ClampY(double d)
{
- if (d < MercatorBounds::minY) return MercatorBounds::minY;
- if (d > MercatorBounds::maxY) return MercatorBounds::maxY;
- return d;
+ return my::clamp(d, minY, maxY);
}
inline static double YToLat(double y)