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>2013-08-15 19:21:13 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:59:45 +0300
commit1269e13617f552b6404efca5bbf3c4b2107349f8 (patch)
treeecf01d8c17b7d0ac3b08e957cbd782f8027128b7 /map/mwm_url.cpp
parent59a0e39dacf58245a19adce3ab83e8f08dbf0c6a (diff)
[api] Show viewport on correct zoom level in on API request.
Diffstat (limited to 'map/mwm_url.cpp')
-rw-r--r--map/mwm_url.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/map/mwm_url.cpp b/map/mwm_url.cpp
index e7bd3b84f4..eea9f97ceb 100644
--- a/map/mwm_url.cpp
+++ b/map/mwm_url.cpp
@@ -11,6 +11,7 @@
#include "../std/algorithm.hpp"
#include "../std/bind.hpp"
+
using namespace url_scheme;
namespace
@@ -143,11 +144,26 @@ void ParsedMapApi::Reset()
m_zoomLevel = 0.0;
}
-m2::RectD ParsedMapApi::GetLatLonRect() const
+bool ParsedMapApi::GetViewport(m2::PointD & pt, double & zoom) const
{
- // Use zoom only for one point and ignore it for several points
if (m_zoomLevel >= 1.0 && m_points.size() == 1)
- return scales::GetRectForLevel(m_zoomLevel, m_showRect.Center(), 1.0);
+ {
+ zoom = min(static_cast<double>(scales::GetUpperComfortScale()), m_zoomLevel);
+ pt.x = MercatorBounds::LonToX(m_points.front().m_lon);
+ pt.y = MercatorBounds::LatToY(m_points.front().m_lat);
+ return true;
+ }
+
+ return false;
+}
- return m_showRect;
+bool ParsedMapApi::GetViewportRect(m2::RectD & rect) const
+{
+ if (m_showRect.IsValid())
+ {
+ rect = MercatorBounds::FromLatLonRect(m_showRect);
+ return true;
+ }
+ else
+ return false;
}