mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 03:43:46 +00:00
[routing] Relaxed roundabout skip turns check (driveway, parking_aisle).
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
014b54b1f7
commit
effc8ba5d1
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "geometry/angles.hpp"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
namespace routing
|
||||
{
|
||||
@@ -175,8 +174,8 @@ bool KeepRoundaboutTurnByHighwayClass(TurnCandidates const & possibleTurns,
|
||||
if (t.m_segment == firstOutgoingSegment)
|
||||
continue;
|
||||
// For roundabouts of Tertiary and less significant class count every road.
|
||||
// For more significant roundabouts - ignore service roads.
|
||||
if (turnInfo.m_outgoing->m_highwayClass >= HighwayClass::Tertiary || t.m_highwayClass != HighwayClass::Service)
|
||||
// For more significant roundabouts - ignore service roads (driveway, parking_aisle).
|
||||
if (turnInfo.m_outgoing->m_highwayClass >= HighwayClass::Tertiary || t.m_highwayClass != HighwayClass::ServiceMinor)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -303,7 +302,8 @@ bool CanDiscardTurnByHighwayClassOrAngles(CarDirection const routeDirection,
|
||||
continue;
|
||||
|
||||
// If outgoing route's road is significantly larger than candidate's service road, the candidate can be ignored.
|
||||
if (CalcDiffRoadClasses(outgoingRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiffForService && candidateRoadClass == HighwayClass::Service)
|
||||
if (CalcDiffRoadClasses(outgoingRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiffForService &&
|
||||
(candidateRoadClass == HighwayClass::Service || candidateRoadClass == HighwayClass::ServiceMinor))
|
||||
continue;
|
||||
|
||||
// If igngoing and outgoing edges are not links
|
||||
@@ -445,7 +445,8 @@ void GetTurnDirectionBasic(IRoutingResult const & result, size_t const outgoingS
|
||||
return;
|
||||
|
||||
// No turns are needed on transported road.
|
||||
if (turnInfo.m_ingoing->m_highwayClass == HighwayClass::Transported && turnInfo.m_outgoing->m_highwayClass == HighwayClass::Transported)
|
||||
if (turnInfo.m_ingoing->m_highwayClass == HighwayClass::Transported &&
|
||||
turnInfo.m_outgoing->m_highwayClass == HighwayClass::Transported)
|
||||
return;
|
||||
|
||||
Segment firstOutgoingSeg;
|
||||
|
||||
@@ -93,6 +93,8 @@ UNIT_TEST(Russia_Moscow_TrikotagniAndPohodniRoundabout_TurnTest)
|
||||
Route const & route = *routeResult.first;
|
||||
RouterResultCode const result = routeResult.second;
|
||||
|
||||
/// @todo Simple highway=service is now included in turns count.
|
||||
/// Fix OSM on driveway/parking_aisle ?
|
||||
TEST_EQUAL(result, RouterResultCode::NoError, ());
|
||||
integration::TestTurnCount(route, 2 /* expectedTurnCount */);
|
||||
|
||||
@@ -1389,4 +1391,39 @@ UNIT_TEST(UK_Junction_Circular)
|
||||
GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::LeaveRoundAbout);
|
||||
}
|
||||
|
||||
UNIT_TEST(Integrated_TurnTest_IncludeServiceRoads)
|
||||
{
|
||||
struct Sample
|
||||
{
|
||||
ms::LatLon start, finish;
|
||||
int expectedTurns;
|
||||
};
|
||||
Sample arr[] = {
|
||||
// https://github.com/organicmaps/organicmaps/issues/8892
|
||||
{{50.128011, 14.7100098}, {50.1283017, 14.7119639}, 3},
|
||||
{{50.1283462, 14.7122953}, {50.1280032, 14.7099638}, 3},
|
||||
// https://github.com/organicmaps/organicmaps/issues/5888
|
||||
{{58.8428062, 5.71619759}, {58.8422583, 5.71672851}, 3},
|
||||
// https://github.com/organicmaps/organicmaps/issues/3596
|
||||
{{38.7114203, 0.0365096768}, {38.7103102, 0.0349380496}, 2},
|
||||
};
|
||||
|
||||
for (auto const & s : arr)
|
||||
{
|
||||
using namespace integration;
|
||||
TRouteResult const routeResult = CalculateRoute(GetVehicleComponents(VehicleType::Car),
|
||||
mercator::FromLatLon(s.start), {0., 0.},
|
||||
mercator::FromLatLon(s.finish));
|
||||
|
||||
Route const & route = *routeResult.first;
|
||||
RouterResultCode const result = routeResult.second;
|
||||
TEST_EQUAL(result, RouterResultCode::NoError, ());
|
||||
|
||||
GetNthTurn(route, 0)
|
||||
.TestValid()
|
||||
.TestDirection(CarDirection::EnterRoundAbout)
|
||||
.TestRoundAboutExitNum(s.expectedTurns);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace turn_test
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
|
||||
#include "base/stl_helpers.hpp"
|
||||
|
||||
namespace routing
|
||||
{
|
||||
@@ -47,7 +46,8 @@ bool CanDiscardTurnByHighwayClass(std::vector<TurnCandidate> const & turnCandida
|
||||
continue;
|
||||
|
||||
// If route's road is significantly larger than candidate's service road, the candidate can be ignored.
|
||||
if (CalcDiffRoadClasses(maxRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiffForService && candidateRoadClass == HighwayClass::Service)
|
||||
if (CalcDiffRoadClasses(maxRouteRoadClass, candidateRoadClass) <= kMinHighwayClassDiffForService &&
|
||||
(candidateRoadClass == HighwayClass::Service || candidateRoadClass == HighwayClass::ServiceMinor))
|
||||
continue;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "routing/turns_generator_utils.hpp"
|
||||
#include "platform/measurement_utils.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "routing/turns.hpp"
|
||||
|
||||
#include "platform/measurement_utils.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
|
||||
namespace routing
|
||||
{
|
||||
namespace turns
|
||||
@@ -19,7 +22,9 @@ bool IsHighway(HighwayClass hwClass, bool isLink)
|
||||
bool IsSmallRoad(HighwayClass hwClass)
|
||||
{
|
||||
return hwClass == HighwayClass::LivingStreet ||
|
||||
hwClass == HighwayClass::Service || hwClass == HighwayClass::Pedestrian;
|
||||
hwClass == HighwayClass::Service ||
|
||||
hwClass == HighwayClass::ServiceMinor ||
|
||||
hwClass == HighwayClass::Pedestrian;
|
||||
}
|
||||
|
||||
int CalcDiffRoadClasses(HighwayClass const left, HighwayClass const right)
|
||||
@@ -120,7 +125,8 @@ double CalcEstimatedTimeToPass(double const distanceMeters, HighwayClass const h
|
||||
case HighwayClass::Secondary: speedKmph = 70.0; break;
|
||||
case HighwayClass::Tertiary: speedKmph = 50.0; break;
|
||||
case HighwayClass::LivingStreet: speedKmph = 20.0; break;
|
||||
case HighwayClass::Service: speedKmph = 10.0; break;
|
||||
case HighwayClass::Service:
|
||||
case HighwayClass::ServiceMinor: speedKmph = 10.0; break;
|
||||
case HighwayClass::Pedestrian: speedKmph = 5.0; break;
|
||||
default: speedKmph = 50.0; break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user