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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2017-08-12 10:29:39 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-08-14 14:31:07 +0300
commit0299da3c997eb7dfc1a1971d4085ab41215f13bd (patch)
treeca18b747c3d2dd2f4d927159455dd1a9e6c5e638 /qt
parent571021074aa0e57fe0aa2f99593b46a809dd4795 (diff)
Added recommendation to rebuild route after loading route points
Diffstat (limited to 'qt')
-rw-r--r--qt/draw_widget.cpp22
-rw-r--r--qt/draw_widget.hpp2
2 files changed, 24 insertions, 0 deletions
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index 467cab3638..b42e848110 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -45,6 +45,12 @@ DrawWidget::DrawWidget(Framework & framework, bool apiOpenGLES3, QWidget * paren
m_framework.GetRoutingManager().SetRouteBuildingListener(
[](routing::IRouter::ResultCode, storage::TCountriesVec const &) {});
+ m_framework.GetRoutingManager().SetRouteRecommendationListener(
+ [this](RoutingManager::Recommendation r)
+ {
+ OnRouteRecommendation(r);
+ });
+
m_framework.SetCurrentCountryChangedListener([this](storage::TCountryId const & countryId) {
m_countryId = countryId;
UpdateCountryStatus(countryId);
@@ -408,6 +414,22 @@ void DrawWidget::ClearRoute()
}
}
+void DrawWidget::OnRouteRecommendation(RoutingManager::Recommendation recommendation)
+{
+ if (recommendation == RoutingManager::Recommendation::RebuildAfterPointsLoading)
+ {
+ auto & routingManager = m_framework.GetRoutingManager();
+
+ RouteMarkData startPoint;
+ startPoint.m_pointType = RouteMarkType::Start;
+ startPoint.m_isMyPosition = true;
+ routingManager.AddRoutePoint(std::move(startPoint));
+
+ if (routingManager.GetRoutePoints().size() >= 2)
+ routingManager.BuildRoute(0 /* timeoutSec */);
+ }
+}
+
void DrawWidget::ShowPlacePage(place_page::Info const & info)
{
search::AddressInfo address;
diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp
index 189967799a..d2699499a0 100644
--- a/qt/draw_widget.hpp
+++ b/qt/draw_widget.hpp
@@ -3,6 +3,7 @@
#include "qt/qt_common/map_widget.hpp"
#include "map/place_page_info.hpp"
+#include "map/routing_manager.hpp"
#include "search/everywhere_search_params.hpp"
#include "search/result.hpp"
@@ -77,6 +78,7 @@ public:
void SetRoutePointAddMode(RouteMarkType mode) { m_routePointAddMode = mode; }
void FollowRoute();
void ClearRoute();
+ void OnRouteRecommendation(RoutingManager::Recommendation recommendation);
void RefreshDrawingRules();