diff options
author | Yury Melnichek <melnichek@gmail.com> | 2011-05-30 22:41:46 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:18:25 +0300 |
commit | cc223b4afcbc5612f931d64023544518155d9a41 (patch) | |
tree | 9fb84f3205bbcdeda2393f4dbb0cc4c47a0c4c1f /indexer/mercator.hpp | |
parent | 8ed03fa38ed4c273d98fcd114a8ab2202d811c08 (diff) |
[search] Estimate feature's viewport - first sketch version.
Diffstat (limited to 'indexer/mercator.hpp')
-rw-r--r-- | indexer/mercator.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indexer/mercator.hpp b/indexer/mercator.hpp index 03807e6aa7..f77e6a5db0 100644 --- a/indexer/mercator.hpp +++ b/indexer/mercator.hpp @@ -55,5 +55,18 @@ struct MercatorBounds LatToY(lat + degreeOffset)); } + inline static m2::RectD RectByCenterXYAndSizeInMeters(double centerX, double centerY, + double sizeX, double sizeY) + { + ASSERT_GREATER_OR_EQUAL(sizeX, 0, ()); + ASSERT_GREATER_OR_EQUAL(sizeY, 0, ()); + double const degreesLon = fabs(sizeX) / 2.0 * degreeInMetres; + double const degreesLat = fabs(sizeY) / 2.0 * degreeInMetres; + double const lon = XToLon(centerX); + double const lat = YToLat(centerY); + return m2::RectD(LonToX(lon - degreesLon), LatToY(lat - degreesLat), + LonToX(lon + degreesLon), LatToY(lat + degreesLat)); + } + static double GetCellID2PointAbsEpsilon() { return 1.0E-4; } }; |