[qt] Show turns on the map if the checkbox is set to true.

This commit is contained in:
Olga Khlopkova 2020-10-07 16:38:39 +03:00 committed by Arsentiy Milchakov
parent 60242f368a
commit 94525d5342
2 changed files with 29 additions and 21 deletions

View file

@ -8,10 +8,10 @@
#include "qt/routing_settings_dialog.hpp"
#include "qt/screenshoter.hpp"
#include "map/framework.hpp"
#include "generator/borders.hpp"
#include "map/framework.hpp"
#include "search/result.hpp"
#include "search/reverse_geocoder.hpp"
@ -32,22 +32,19 @@
#include "base/assert.hpp"
#include "base/file_name_utils.hpp"
#include <string>
#include <vector>
#include "defines.hpp"
#include <QtGui/QMouseEvent>
#include <QtCore/QThread>
#include <QtCore/QTimer>
#include <QtGui/QGuiApplication>
#include <QtGui/QMouseEvent>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QMenu>
#include <QtCore/QLocale>
#include <QtCore/QThread>
#include <QtCore/QTimer>
#include "defines.hpp"
#include <string>
#include <vector>
using namespace qt::common;
@ -96,14 +93,20 @@ DrawWidget::DrawWidget(Framework & framework, bool apiOpenGLES3, std::unique_ptr
m_framework.SetPlacePageListeners([this]() { ShowPlacePage(); },
{} /* onClose */, {} /* onUpdate */);
m_framework.GetRoutingManager().SetRouteBuildingListener(
[](routing::RouterResultCode, storage::CountriesSet const &) {});
auto & routingManager = m_framework.GetRoutingManager();
m_framework.GetRoutingManager().SetRouteRecommendationListener(
[this](RoutingManager::Recommendation r)
{
OnRouteRecommendation(r);
});
routingManager.SetRouteBuildingListener(
[&routingManager, this](routing::RouterResultCode, storage::CountriesSet const &) {
auto & drapeApi = m_framework.GetDrapeApi();
m_turnsVisualizer.ClearTurns(drapeApi);
if (RoutingSettings::TurnsEnabled())
m_turnsVisualizer.Visualize(routingManager, drapeApi);
});
routingManager.SetRouteRecommendationListener(
[this](RoutingManager::Recommendation r) { OnRouteRecommendation(r); });
m_framework.SetCurrentCountryChangedListener([this](storage::CountryId const & countryId) {
m_countryId = countryId;
@ -578,7 +581,9 @@ void DrawWidget::SubmitRoutingPoint(m2::PointD const & pt)
routingManager.AddRoutePoint(std::move(point));
if (routingManager.GetRoutePoints().size() >= 2)
{
routingManager.BuildRoute();
}
}
void DrawWidget::SubmitBookmark(m2::PointD const & pt)
@ -626,6 +631,8 @@ void DrawWidget::ClearRoute()
else if (style == MapStyle::MapStyleVehicleDark)
SetMapStyle(MapStyle::MapStyleDark);
}
m_turnsVisualizer.ClearTurns(m_framework.GetDrapeApi());
}
void DrawWidget::OnRouteRecommendation(RoutingManager::Recommendation recommendation)

View file

@ -1,6 +1,7 @@
#pragma once
#include "qt/qt_common/map_widget.hpp"
#include "qt/routing_turns_visualizer.hpp"
#include "qt/ruler.hpp"
#include "map/everywhere_search_params.hpp"
@ -11,9 +12,10 @@
#include "routing/router.hpp"
#include "drape_frontend/drape_engine.hpp"
#include "drape_frontend/gui/skin.hpp"
#include "drape_frontend/drape_engine.hpp"
#include <QtWidgets/QRubberBand>
#include <condition_variable>
#include <functional>
@ -22,8 +24,6 @@
#include <optional>
#include <string>
#include <QtWidgets/QRubberBand>
class Framework;
namespace qt
@ -150,5 +150,6 @@ private:
std::unique_ptr<Screenshoter> m_screenshoter;
Ruler m_ruler;
RoutingTurnsVisualizer m_turnsVisualizer;
};
} // namespace qt