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
path: root/qt
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2017-07-13 13:43:58 +0300
committermpimenov <mpimenov@users.noreply.github.com>2017-07-14 12:36:42 +0300
commit9c71fbdcc07f920337af1113cb27289ce8b0c634 (patch)
tree6960ba1803feb5b314907af7e590ab1716ff5be9 /qt
parent92358135885b3f71767fa8b6fc53af160ae58d9d (diff)
[assessment-tool] Show user position on map, when available.
Diffstat (limited to 'qt')
-rw-r--r--qt/draw_widget.cpp12
-rw-r--r--qt/qt_common/helpers.cpp15
-rw-r--r--qt/qt_common/helpers.hpp4
3 files changed, 21 insertions, 10 deletions
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index 858b17236f..24b405e954 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -28,7 +28,6 @@
#include <QtWidgets/QMenu>
#include <QtCore/QLocale>
-#include <QtCore/QDateTime>
#include <QtCore/QThread>
#include <QtCore/QTimer>
@@ -317,15 +316,8 @@ void DrawWidget::SetMapStyle(MapStyle mapStyle)
void DrawWidget::SubmitFakeLocationPoint(m2::PointD const & pt)
{
m_emulatingLocation = true;
- m2::PointD const point = m_framework.P3dtoG(pt);
-
- location::GpsInfo info;
- info.m_latitude = MercatorBounds::YToLat(point.y);
- info.m_longitude = MercatorBounds::XToLon(point.x);
- info.m_horizontalAccuracy = 10;
- info.m_timestamp = QDateTime::currentMSecsSinceEpoch() / 1000.0;
-
- m_framework.OnLocationUpdate(info);
+ auto const point = m_framework.P3dtoG(pt);
+ m_framework.OnLocationUpdate(qt::common::MakeGpsInfo(point));
if (m_framework.GetRoutingManager().IsRoutingActive())
{
diff --git a/qt/qt_common/helpers.cpp b/qt/qt_common/helpers.cpp
index a6081809b3..15ba4b68b1 100644
--- a/qt/qt_common/helpers.cpp
+++ b/qt/qt_common/helpers.cpp
@@ -1,5 +1,9 @@
#include "qt/qt_common/helpers.hpp"
+#include "geometry/mercator.hpp"
+
+#include <QtCore/QDateTime>
+
namespace qt
{
namespace common
@@ -23,5 +27,16 @@ bool IsCommandModifier(QMouseEvent const * const e) { return e->modifiers() & Qt
bool IsShiftModifier(QMouseEvent const * const e) { return e->modifiers() & Qt::ShiftModifier; }
bool IsAltModifier(QMouseEvent const * const e) { return e->modifiers() & Qt::AltModifier; }
+
+location::GpsInfo MakeGpsInfo(m2::PointD const & point)
+{
+ location::GpsInfo info;
+ info.m_source = location::EUser;
+ info.m_latitude = MercatorBounds::YToLat(point.y);
+ info.m_longitude = MercatorBounds::XToLon(point.x);
+ info.m_horizontalAccuracy = 10;
+ info.m_timestamp = QDateTime::currentMSecsSinceEpoch() / 1000.0;
+ return info;
+}
} // namespace common
} // namespace qt
diff --git a/qt/qt_common/helpers.hpp b/qt/qt_common/helpers.hpp
index 71c1c37e83..b3f6882852 100644
--- a/qt/qt_common/helpers.hpp
+++ b/qt/qt_common/helpers.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "platform/location.hpp"
+
#include <QtGui/QMouseEvent>
namespace qt
@@ -24,5 +26,7 @@ struct Hotkey
int m_key = 0;
char const * m_slot = nullptr;
};
+
+location::GpsInfo MakeGpsInfo(m2::PointD const & point);
} // namespace common
} // namespace qt