From 98e75d8202c4f0bb853038bcbf25ca8142d220bf Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 10 Jan 2013 14:30:15 +0300 Subject: Do better check for distance on earth. --- search/search_engine.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'search') diff --git a/search/search_engine.cpp b/search/search_engine.cpp index 9757b85157..3807311c7a 100644 --- a/search/search_engine.cpp +++ b/search/search_engine.cpp @@ -110,7 +110,6 @@ namespace // X metres in mercator (lon, lat) units. double const epsEqualRects = 100.0 * MercatorBounds::degreeInMetres; - double const epsEqualPoints = 500.0 * MercatorBounds::degreeInMetres; /// Check rects for optimal search (avoid duplicating). void AnalyzeRects(m2::RectD arrRects[2]) @@ -153,10 +152,8 @@ bool Engine::Search(SearchParams const & params, m2::RectD const & viewport) if (!m_params.IsValidPosition()) return false; - m2::PointD const p1 = GetViewportXY(m_params.m_lat, m_params.m_lon); - m2::PointD const p2 = GetViewportXY(params.m_lat, params.m_lon); - - if (p1.EqualDxDy(p2, epsEqualPoints)) + // Check distance between previous and current user's position. + if (ms::DistanceOnEarth(m_params.m_lat, m_params.m_lon, params.m_lat, params.m_lon) < 500.0) return false; } -- cgit v1.2.3