From bc26c799a0c5963a309739c244d8b8d15130008f Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Thu, 23 Dec 2021 00:24:55 +0300 Subject: [PATCH] [desktop] Show maxspeed for lines. Signed-off-by: Viktor Govako --- qt/qt_common/map_widget.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp index 9482629cff..2505a3d5b3 100644 --- a/qt/qt_common/map_widget.cpp +++ b/qt/qt_common/map_widget.cpp @@ -5,6 +5,8 @@ #include "map/framework.hpp" +#include "routing/maxspeeds.hpp" + #include "geometry/point2d.hpp" #include "base/assert.hpp" @@ -287,8 +289,10 @@ void MapWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt) m_framework.ForEachFeatureAtPoint([&](FeatureType & ft) { + // ID addStringFn(DebugPrint(ft.GetID())); + // Types std::string concat; auto types = feature::TypesHolder(ft); types.SortBySpec(); @@ -296,13 +300,29 @@ void MapWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt) concat += type + " "; addStringFn(concat); + // Name std::string name; ft.GetReadableName(name); addStringFn(name); + // Address auto const info = GetFeatureAddressInfo(m_framework, ft); addStringFn(info.FormatAddress()); + if (ft.GetGeomType() == feature::GeomType::Line) + { + // Maxspeed + auto const & dataSource = m_framework.GetDataSource(); + auto const handle = dataSource.GetMwmHandleById(ft.GetID().m_mwmId); + auto const speeds = routing::LoadMaxspeeds(dataSource, handle); + if (speeds) + { + auto const speed = speeds->GetMaxspeed(ft.GetID().m_index); + if (speed.IsValid()) + addStringFn(DebugPrint(speed)); + } + } + menu.addSeparator(); }, m_framework.PtoG(pt));