[routing] Remove unnecessary "keep left/right" directions from the route #2397
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#2397
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "navigation-turn-directions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes: #2262
Signed-off-by: Anton Makouski anton.makouski@gmail.com
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
Незавершённое предложение?
Можно выровнять после скобки.
@vng ну хорошо же было бы с std::optional.
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
nodes.candidates.size() != 1
?@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
да. завершил.
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
ок. поправил еще в 2 местах откуда скопировал
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
ок
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
ок
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
ок
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
непонятно
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Просто скопировал как в KeepTurnByHighwayClass.
Я не вижу проблем с
nodes.candidates.size() == 1
.@vng
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Не может, тут все хорошо и да по аналогии с предидущим сравнением.
Эквивалентно nodes.candidates.size() > 1, проверяем когда больше одной альтернативы
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
тут наверное да
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Тогда надо не копипастить, а сделать так:
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
вопросы к @vng :
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Я эти комменты не писал :) но предполагаю что:
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Меняю, если нет возражений, на
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
После перехода на
Стала понятна немного некорректная логика в названиях функций.
Исходя из названия, должно быть так
те если ни одной причины нет, чтобы сохранить поворот - то мы его удаляем.
а у нас получается, что если причины 1 нет - удаляем, если причины 2 нет - удаляем.
Предлагаю инвертировать функции на DiscardTurnByHighwayClass и DiscardTurnByNoAlignedAlternatives.
Тогда получится:
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
спасибо. понял.
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Согласен на переименовать. Тогда надо аккуратно внутри них инвертировать true/false и проверить актуальность комментов к ним.
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
в процессе переименования обратил внимание на
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Исходя из описания GetTurnHighwayClasses()
// If it's possible fills |turnHighwayClasses| and returns true, and returns false otherwise.
это выглядит ошибкой: если данные не получили - то вернуть false и удалить поворот.
должно быть наоборот? если данные не получили - то не трогать поворот на всякий случай.
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Есть подозрение, что
GetTurnHighwayClasses()
не совсем соответствует описанию в отношении возвращаемого значения.
@ -1147,3 +1205,2 @@
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1 &&
!KeepTurnByHighwayClass(nodes, turnInfo, numMwmIds, turn.m_turn))
if (!turn.m_keepAnyway && IsGoStraightOrSlightTurn(turn.m_turn) && nodes.candidates.size() != 1)
{
Оставил старую логику (инвертировав true на false), добавив комент:
@ -190,7 +191,64 @@ bool KeepTurnByHighwayClass(TurnCandidates const & possibleTurns, TurnInfo const
(diff >= kMaxHighwayClassDiffForService && turnHighwayClasses.m_biggestPossibleTurnRoadClass == ftypes::HighwayClass::Service))
{
// The turn shall be removed if the route goes near small roads.
return true;
done
предлагаю пока оставить как есть.
а потом отрефакторить, и заодно разобраться с возвращаемыми значениями GetTurnHighwayClasses()
Не очень понятно, почему не все тесты не прошли.
Сначала смотрим в конце
FAILED
2022-04-15 16:05:25,582 - base_tests
Потом ищем упавший тест:
Running small_set_test.cpp::SmallMap_Benchmark3
FAILED
base_tests/small_set_test.cpp:262 TEST(t3 < t2) 111 111
Это не релевантно к текущему PR. @vng ?
Не релевантно, если @biodranik approve, squash and merge.
@ -194,0 +219,4 @@
Segment inversedLastIngoingSegment;
if (!turnInfo.m_ingoing.m_segmentRange.GetLastSegment(numMwmIds, inversedLastIngoingSegment))
return false;
Момент, если false исправлено на true, то коммент надо дополнить.
// Previous version was returning false and it looked like a bug. If no info received turn should not be discarded.
@ -194,0 +219,4 @@
Segment inversedLastIngoingSegment;
if (!turnInfo.m_ingoing.m_segmentRange.GetLastSegment(numMwmIds, inversedLastIngoingSegment))
return false;
Я не исправлял логику.
False исправлено на True, потому что функция была инверсно переименована, и все return были инвертированы.
Я могу закомитить прямо тут?
Или будут проблемы с подписью?
Попробуйте, все равно будет делать squash
I was having this issue on a route yesterday, tried a build with this fix and it works perfectly! Thank you 😄