From 484b73c857fea71f9291c502503c02bd66125bcb Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 19 Sep 2018 13:05:58 +0300 Subject: [PATCH] Adding and using InOutCitySpeedKMpH struct for weight roads and eta in city and outside. --- routing_common/bicycle_model.cpp | 564 +++++++++--------- routing_common/car_model.cpp | 244 ++++---- routing_common/pedestrian_model.cpp | 312 +++++----- .../vehicle_model_test.cpp | 18 +- routing_common/vehicle_model.cpp | 20 +- routing_common/vehicle_model.hpp | 58 +- 6 files changed, 583 insertions(+), 633 deletions(-) diff --git a/routing_common/bicycle_model.cpp b/routing_common/bicycle_model.cpp index 558797d363..725445f837 100644 --- a/routing_common/bicycle_model.cpp +++ b/routing_common/bicycle_model.cpp @@ -12,6 +12,8 @@ using namespace std; namespace { +using InOutCitySpeedKMpH = VehicleModel::InOutCitySpeedKMpH; +using SpeedKMpH = VehicleModel::SpeedKMpH; // See model specifics in different countries here: // https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions @@ -28,175 +30,151 @@ namespace // less bicycle. As result of such heuristic road is not totally the shortest, but it avoids non bicycle roads, which were // not marked as "hwtag=nobicycle" in OSM. -// Speed of road features located outside cities and towns polygons in km per hour. -double constexpr kOutCitySpeedTrunkKMpH = 3.0; -double constexpr kOutCitySpeedTrunkLinkKMpH = 3.0; -double constexpr kOutCitySpeedPrimaryKMpH = 5.0; -double constexpr kOutCitySpeedPrimaryLinkKMpH = 5.0; -double constexpr kOutCitySpeedSecondaryKMpH = 20.0; -double constexpr kOutCitySpeedSecondaryLinkKMpH = 20.0; -double constexpr kOutCitySpeedTertiaryKMpH = 20.0; -double constexpr kOutCitySpeedTertiaryLinkKMpH = 20.0; -double constexpr kOutCitySpeedServiceKMpH = 12.0; -double constexpr kOutCitySpeedUnclassifiedKMpH = 12.0; -double constexpr kOutCitySpeedRoadKMpH = 10.0; -double constexpr kOutCitySpeedTrackKMpH = 8.0; -double constexpr kOutCitySpeedPathKMpH = 6.0; -double constexpr kOutCitySpeedBridlewayKMpH = 4.0; -double constexpr kOutCitySpeedCyclewayKMpH = 20.0; -double constexpr kOutCitySpeedResidentialKMpH = 8.0; -double constexpr kOutCitySpeedLivingStreetKMpH = 7.0; -double constexpr kOutCitySpeedStepsKMpH = 1.0; -double constexpr kOutCitySpeedPedestrianKMpH = 5.0; -double constexpr kOutCitySpeedFootwayKMpH = 7.0; -double constexpr kOutCitySpeedPlatformKMpH = 3.0; -double constexpr kOutCitySpeedPierKMpH = 7.0; -double constexpr kOutCitySpeedFerryKMpH = 3.0; - -// Speed of road features located inside cities and towns polygons in km per hour. -double constexpr kInCitySpeedTrunkKMpH = kOutCitySpeedTrunkKMpH; -double constexpr kInCitySpeedTrunkLinkKMpH = kOutCitySpeedTrunkLinkKMpH; -double constexpr kInCitySpeedPrimaryKMpH = 10.0; -double constexpr kInCitySpeedPrimaryLinkKMpH = 10.0; -double constexpr kInCitySpeedSecondaryKMpH = 15.0; -double constexpr kInCitySpeedSecondaryLinkKMpH = 15.0; -double constexpr kInCitySpeedTertiaryKMpH = 15.0; -double constexpr kInCitySpeedTertiaryLinkKMpH = 15.0; -double constexpr kInCitySpeedServiceKMpH = kOutCitySpeedServiceKMpH; -double constexpr kInCitySpeedUnclassifiedKMpH = kOutCitySpeedUnclassifiedKMpH; -double constexpr kInCitySpeedRoadKMpH = kOutCitySpeedRoadKMpH; -double constexpr kInCitySpeedTrackKMpH = kOutCitySpeedTrackKMpH; -double constexpr kInCitySpeedPathKMpH = kOutCitySpeedPathKMpH; -double constexpr kInCitySpeedBridlewayKMpH = kOutCitySpeedBridlewayKMpH; -double constexpr kInCitySpeedCyclewayKMpH = kOutCitySpeedCyclewayKMpH; -double constexpr kInCitySpeedResidentialKMpH = kOutCitySpeedResidentialKMpH; -double constexpr kInCitySpeedLivingStreetKMpH = kOutCitySpeedLivingStreetKMpH; -double constexpr kInCitySpeedStepsKMpH = kOutCitySpeedStepsKMpH; -double constexpr kInCitySpeedPedestrianKMpH = kOutCitySpeedPedestrianKMpH; -double constexpr kInCitySpeedFootwayKMpH = kOutCitySpeedFootwayKMpH; -double constexpr kInCitySpeedPlatformKMpH = kOutCitySpeedPlatformKMpH; -double constexpr kInCitySpeedPierKMpH = kOutCitySpeedPierKMpH; -double constexpr kInCitySpeedFerryKMpH = kOutCitySpeedFerryKMpH; +// Speed of road features located inside and outside cities and towns polygons in km per hour. +// in city out city +InOutCitySpeedKMpH const kSpeedTrunkKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); +InOutCitySpeedKMpH const kSpeedTrunkLinkKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); +InOutCitySpeedKMpH const kSpeedPrimaryKMpH(SpeedKMpH(10.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedPrimaryLinkKMpH(SpeedKMpH(10.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedSecondaryKMpH(SpeedKMpH(15.0), SpeedKMpH(20.0)); +InOutCitySpeedKMpH const kSpeedSecondaryLinkKMpH(SpeedKMpH(15.0), SpeedKMpH(20.0)); +InOutCitySpeedKMpH const kSpeedTertiaryKMpH(SpeedKMpH(15.0), SpeedKMpH(20.0)); +InOutCitySpeedKMpH const kSpeedTertiaryLinkKMpH(SpeedKMpH(15.0), SpeedKMpH(20.0)); +InOutCitySpeedKMpH const kSpeedServiceKMpH(SpeedKMpH(12.0), SpeedKMpH(12.0)); +InOutCitySpeedKMpH const kSpeedUnclassifiedKMpH(SpeedKMpH(12.0), SpeedKMpH(12.0)); +InOutCitySpeedKMpH const kSpeedRoadKMpH(SpeedKMpH(10.0), SpeedKMpH(10.0)); +InOutCitySpeedKMpH const kSpeedTrackKMpH(SpeedKMpH(8.0), SpeedKMpH(8.0)); +InOutCitySpeedKMpH const kSpeedPathKMpH(SpeedKMpH(6.0), SpeedKMpH(6.0)); +InOutCitySpeedKMpH const kSpeedBridlewayKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedCyclewayKMpH(SpeedKMpH(20.0), SpeedKMpH(20.0)); +InOutCitySpeedKMpH const kSpeedResidentialKMpH(SpeedKMpH(8.0), SpeedKMpH(8.0)); +InOutCitySpeedKMpH const kSpeedLivingStreetKMpH(SpeedKMpH(7.0), SpeedKMpH(7.0)); +InOutCitySpeedKMpH const kSpeedStepsKMpH(SpeedKMpH(1.0), SpeedKMpH(1.0)); +InOutCitySpeedKMpH const kSpeedPedestrianKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedFootwayKMpH(SpeedKMpH(7.0), SpeedKMpH(7.0)); +InOutCitySpeedKMpH const kSpeedPlatformKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); +InOutCitySpeedKMpH const kSpeedPierKMpH(SpeedKMpH(7.0), SpeedKMpH(7.0)); +InOutCitySpeedKMpH const kSpeedFerryKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); double constexpr kSpeedOffroadKMpH = 3.0; // Default VehicleModel::LimitsInitList const g_bicycleLimitsDefault = { - // {{roadType, roadType} {weightSpeedKMpH, etSpeedKMpH} passThroughAllowed} - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} +// {{roadType, roadType} Speed km per hour passThroughAllowed} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // All options available. VehicleModel::LimitsInitList const g_bicycleLimitsAll = { - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except trunk and trunk_link are not allowed VehicleModel::LimitsInitList const g_bicycleLimitsNoTrunk = { - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except pedestrian is allowed VehicleModel::LimitsInitList const g_bicycleLimitsPedestrianAllowed = { - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except bridleway is allowed VehicleModel::LimitsInitList const g_bicycleLimitsBridlewayAllowed = { - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Australia @@ -206,47 +184,47 @@ VehicleModel::LimitsInitList const g_bicycleLimitsAustralia = g_bicycleLimitsAll VehicleModel::LimitsInitList const g_bicycleLimitsAustria = { // No trunk, trunk_link, path - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Belarus VehicleModel::LimitsInitList const g_bicycleLimitsBelarus = { // Footway and pedestrian are allowed - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Belgium @@ -254,49 +232,49 @@ VehicleModel::LimitsInitList const g_bicycleLimitsBelgium = { // No trunk, trunk_link // Pedestrian is allowed - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Brazil VehicleModel::LimitsInitList const g_bicycleLimitsBrazil = { // Bridleway and fotway are allowed - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Denmark @@ -307,23 +285,23 @@ VehicleModel::LimitsInitList const g_bicycleLimitsFrance = { // No trunk, trunk_link // Pedestrian is allowed - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Finland @@ -358,26 +336,26 @@ VehicleModel::LimitsInitList const g_bicycleLimitsRussia = { // Footway and pedestrian are allowed // No pass through service and living_street - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, false}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, false}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, false}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, false}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedPedestrianKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Slovakia @@ -398,24 +376,24 @@ VehicleModel::LimitsInitList const g_bicycleLimitsUkraine = // No trunk // Footway and perestrian are allowed // No pass through living_street and service - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, false}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, false}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, false}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, false}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // United Kingdom @@ -425,26 +403,26 @@ VehicleModel::LimitsInitList const g_bicycleLimitsUK = g_bicycleLimitsBridlewayA VehicleModel::LimitsInitList const g_bicycleLimitsUS = { // Bridleway and pedesprian are allowed - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; VehicleModel::SurfaceInitList const g_bicycleSurface = { @@ -478,9 +456,9 @@ void BicycleModel::Init() m_bidirBicycleType = classif().GetTypeByPath({"hwtag", "bidir_bicycle"}); vector const additionalTags = { - {hwtagYesBicycle, m_maxSpeed, m_maxSpeed}, - {{"route", "ferry"}, kOutCitySpeedFerryKMpH, kInCitySpeedFerryKMpH}, - {{"man_made", "pier"}, kOutCitySpeedPierKMpH, kInCitySpeedPierKMpH} + {hwtagYesBicycle, InOutCitySpeedKMpH(m_maxSpeed, m_maxSpeed)}, + {{"route", "ferry"}, kSpeedFerryKMpH}, + {{"man_made", "pier"}, kSpeedPierKMpH} }; SetAdditionalRoadTypes(classif(), additionalTags); diff --git a/routing_common/car_model.cpp b/routing_common/car_model.cpp index fa0af224a7..b90ef91b0d 100644 --- a/routing_common/car_model.cpp +++ b/routing_common/car_model.cpp @@ -11,79 +11,59 @@ using namespace routing; namespace { +using InOutCitySpeedKMpH = VehicleModel::InOutCitySpeedKMpH; +using SpeedKMpH = VehicleModel::SpeedKMpH; + // See model specifics in different countries here: // https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions // See road types here: // https://wiki.openstreetmap.org/wiki/Key:highway - -// Speed of road features located outside cities and towns polygons in km per hour. -double constexpr kOutCitySpeedMotorwayKMpH = 115.37; -double constexpr kOutCitySpeedMotorwayLinkKMpH = 75.0; -double constexpr kOutCitySpeedTrunkKMpH = 93.89; -double constexpr kOutCitySpeedTrunkLinkKMpH = 70.0; -double constexpr kOutCitySpeedPrimaryKMpH = 84.29; -double constexpr kOutCitySpeedPrimaryLinkKMpH = 60.0; -double constexpr kOutCitySpeedSecondaryKMpH = 72.23; -double constexpr kOutCitySpeedSecondaryLinkKMpH = 50.0; -double constexpr kOutCitySpeedTertiaryKMpH = 62.63; -double constexpr kOutCitySpeedTertiaryLinkKMpH = 30.0; -double constexpr kOutCitySpeedResidentialKMpH = 25.0; -double constexpr kOutCitySpeedUnclassifiedKMpH = 51.09; -double constexpr kOutCitySpeedServiceKMpH = 15.0; -double constexpr kOutCitySpeedLivingStreetKMpH = 10.0; -double constexpr kOutCitySpeedRoadKMpH = 10.0; -double constexpr kOutCitySpeedTrackKMpH = 5.0; -double constexpr kOutCitySpeedFerryMotorcarKMpH = 15.0; -double constexpr kOutCitySpeedFerryMotorcarVehicleKMpH = 15.0; -double constexpr kOutCitySpeedRailMotorcarVehicleKMpH = 25.0; -double constexpr kOutCitySpeedShuttleTrainKMpH = 25.0; -double constexpr kOutCitySpeedPierKMpH = 10.0; - -// Speed of road features located inside cities and towns polygons in km per hour. -double constexpr kInCitySpeedMotorwayKMpH = kOutCitySpeedMotorwayKMpH; -double constexpr kInCitySpeedMotorwayLinkKMpH = kOutCitySpeedMotorwayLinkKMpH; -double constexpr kInCitySpeedTrunkKMpH = 70.0; -double constexpr kInCitySpeedTrunkLinkKMpH = 50.0; -double constexpr kInCitySpeedPrimaryKMpH = 65.0; -double constexpr kInCitySpeedPrimaryLinkKMpH = 55.0; -double constexpr kInCitySpeedSecondaryKMpH = 45.0; -double constexpr kInCitySpeedSecondaryLinkKMpH = 40.0; -double constexpr kInCitySpeedTertiaryKMpH = 40.0; -double constexpr kInCitySpeedTertiaryLinkKMpH = 30.0; -double constexpr kInCitySpeedResidentialKMpH = 25.0; -double constexpr kInCitySpeedUnclassifiedKMpH = 25.0; -double constexpr kInCitySpeedServiceKMpH = kOutCitySpeedServiceKMpH; -double constexpr kInCitySpeedLivingStreetKMpH = kOutCitySpeedLivingStreetKMpH; -double constexpr kInCitySpeedRoadKMpH = kOutCitySpeedRoadKMpH; -double constexpr kInCitySpeedTrackKMpH = kOutCitySpeedTrackKMpH; -double constexpr kInCitySpeedFerryMotorcarKMpH = kOutCitySpeedFerryMotorcarKMpH; -double constexpr kInCitySpeedFerryMotorcarVehicleKMpH = kOutCitySpeedFerryMotorcarVehicleKMpH; -double constexpr kInCitySpeedRailMotorcarVehicleKMpH = kOutCitySpeedRailMotorcarVehicleKMpH; -double constexpr kInCitySpeedShuttleTrainKMpH = kOutCitySpeedShuttleTrainKMpH; -double constexpr kInCitySpeedPierKMpH = kOutCitySpeedPierKMpH; +// Speed of road features located inside and outside cities and towns polygons in km per hour. +// in city out city +InOutCitySpeedKMpH const kSpeedMotorwayKMpH(SpeedKMpH(115.37), SpeedKMpH(115.37)); +InOutCitySpeedKMpH const kSpeedMotorwayLinkKMpH(SpeedKMpH(75.0), SpeedKMpH(75.0)); +InOutCitySpeedKMpH const kSpeedTrunkKMpH(SpeedKMpH(70.0), SpeedKMpH(93.89)); +InOutCitySpeedKMpH const kSpeedTrunkLinkKMpH(SpeedKMpH(50.0), SpeedKMpH(70.0)); +InOutCitySpeedKMpH const kSpeedPrimaryKMpH(SpeedKMpH(65.0), SpeedKMpH(84.29)); +InOutCitySpeedKMpH const kSpeedPrimaryLinkKMpH(SpeedKMpH(55.0), SpeedKMpH(60.0)); +InOutCitySpeedKMpH const kSpeedSecondaryKMpH(SpeedKMpH(45.0), SpeedKMpH(72.23)); +InOutCitySpeedKMpH const kSpeedSecondaryLinkKMpH(SpeedKMpH(40.0), SpeedKMpH(50.0)); +InOutCitySpeedKMpH const kSpeedTertiaryKMpH(SpeedKMpH(40.0), SpeedKMpH(62.63)); +InOutCitySpeedKMpH const kSpeedTertiaryLinkKMpH(SpeedKMpH(30.0), SpeedKMpH(30.0)); +InOutCitySpeedKMpH const kSpeedResidentialKMpH(SpeedKMpH(25.0), SpeedKMpH(25.0)); +InOutCitySpeedKMpH const kSpeedUnclassifiedKMpH(SpeedKMpH(25.0), SpeedKMpH(51.09)); +InOutCitySpeedKMpH const kSpeedServiceKMpH(SpeedKMpH(15.0), SpeedKMpH(15.0)); +InOutCitySpeedKMpH const kSpeedLivingStreetKMpH(SpeedKMpH(10.0), SpeedKMpH(10.0)); +InOutCitySpeedKMpH const kSpeedRoadKMpH(SpeedKMpH(10.0), SpeedKMpH(10.0)); +InOutCitySpeedKMpH const kSpeedTrackKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedFerryMotorcarKMpH(SpeedKMpH(15.0), SpeedKMpH(15.0)); +InOutCitySpeedKMpH const kSpeedFerryMotorcarVehicleKMpH(SpeedKMpH(15.0), SpeedKMpH(15.0)); +InOutCitySpeedKMpH const kSpeedRailMotorcarVehicleKMpH(SpeedKMpH(15.0), SpeedKMpH(15.0)); +InOutCitySpeedKMpH const kSpeedShuttleTrainKMpH(SpeedKMpH(25.0), SpeedKMpH(25.0)); +InOutCitySpeedKMpH const kSpeedPierKMpH(SpeedKMpH(10.0), SpeedKMpH(10.0)); double constexpr kSpeedOffroadKMpH = 10.0; VehicleModel::LimitsInitList const g_carLimitsDefault = { - // {{roadType, roadType} {weightSpeedKMpH, etSpeedKMpH} passThroughAllowed} - {{"highway", "motorway"}, kOutCitySpeedMotorwayKMpH, kInCitySpeedMotorwayKMpH, true}, - {{"highway", "motorway_link"}, kOutCitySpeedMotorwayLinkKMpH, kInCitySpeedMotorwayLinkKMpH, true}, - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true} + // {{roadType, roadType} Speed km per hour passThroughAllowed} + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, + {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true} /// @todo: Add to classificator //{ {"highway", "shuttle_train"}, 10 }, //{ {"highway", "ferry"}, 5 }, @@ -94,42 +74,42 @@ VehicleModel::LimitsInitList const g_carLimitsDefault = VehicleModel::LimitsInitList const g_carLimitsNoPassThroughLivingStreet = { - {{"highway", "motorway"}, kOutCitySpeedMotorwayKMpH, kInCitySpeedMotorwayKMpH, true}, - {{"highway", "motorway_link"}, kOutCitySpeedMotorwayLinkKMpH, kInCitySpeedMotorwayLinkKMpH, true}, - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, false}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true} + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, + {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, false}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true} }; VehicleModel::LimitsInitList const g_carLimitsNoPassThroughLivingStreetAndService = { - {{"highway", "motorway"}, kOutCitySpeedMotorwayKMpH, kInCitySpeedMotorwayKMpH, true}, - {{"highway", "motorway_link"}, kOutCitySpeedMotorwayLinkKMpH, kInCitySpeedMotorwayLinkKMpH, true}, - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, false}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, false}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true} + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, + {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, false}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, false}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true} }; VehicleModel::LimitsInitList const g_carLimitsAustralia = g_carLimitsDefault; @@ -145,21 +125,21 @@ VehicleModel::LimitsInitList const g_carLimitsBrazil = g_carLimitsDefault; VehicleModel::LimitsInitList const g_carLimitsDenmark = { // No track - {{"highway", "motorway"}, kOutCitySpeedMotorwayKMpH, kInCitySpeedMotorwayKMpH, true}, - {{"highway", "motorway_link"}, kOutCitySpeedMotorwayLinkKMpH, kInCitySpeedMotorwayLinkKMpH, true}, - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true} + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, + {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true} }; VehicleModel::LimitsInitList const g_carLimitsFrance = g_carLimitsDefault; @@ -169,22 +149,22 @@ VehicleModel::LimitsInitList const g_carLimitsFinland = g_carLimitsDefault; VehicleModel::LimitsInitList const g_carLimitsGermany = { // No pass through track - {{"highway", "motorway"}, kOutCitySpeedMotorwayKMpH, kInCitySpeedMotorwayKMpH, true}, - {{"highway", "motorway_link"}, kOutCitySpeedMotorwayLinkKMpH, kInCitySpeedMotorwayLinkKMpH, true}, - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, false} + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, + {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, false} }; VehicleModel::LimitsInitList const g_carLimitsHungary = g_carLimitsNoPassThroughLivingStreet; @@ -219,12 +199,12 @@ VehicleModel::LimitsInitList const g_carLimitsUS = g_carLimitsDefault; vector const kAdditionalTags = { // {{highway tags}, {weightSpeed, etaSpeed}} - {{"route", "ferry", "motorcar"}, kOutCitySpeedFerryMotorcarKMpH, kInCitySpeedFerryMotorcarKMpH}, - {{"route", "ferry", "motor_vehicle"}, kOutCitySpeedFerryMotorcarVehicleKMpH, kInCitySpeedFerryMotorcarVehicleKMpH}, - {{"railway", "rail", "motor_vehicle"}, kOutCitySpeedRailMotorcarVehicleKMpH, kInCitySpeedRailMotorcarVehicleKMpH}, - {{"route", "shuttle_train"}, kOutCitySpeedShuttleTrainKMpH, kInCitySpeedShuttleTrainKMpH}, - {{"route", "ferry"}, kOutCitySpeedFerryMotorcarKMpH, kInCitySpeedFerryMotorcarKMpH}, - {{"man_made", "pier"}, kOutCitySpeedPierKMpH, kInCitySpeedPierKMpH} + {{"route", "ferry", "motorcar"}, kSpeedFerryMotorcarKMpH}, + {{"route", "ferry", "motor_vehicle"}, kSpeedFerryMotorcarVehicleKMpH}, + {{"railway", "rail", "motor_vehicle"}, kSpeedRailMotorcarVehicleKMpH}, + {{"route", "shuttle_train"}, kSpeedShuttleTrainKMpH}, + {{"route", "ferry"}, kSpeedFerryMotorcarKMpH}, + {{"man_made", "pier"}, kSpeedPierKMpH} }; VehicleModel::SurfaceInitList const g_carSurface = { diff --git a/routing_common/pedestrian_model.cpp b/routing_common/pedestrian_model.cpp index 6922ee1a40..cc186c80dd 100644 --- a/routing_common/pedestrian_model.cpp +++ b/routing_common/pedestrian_model.cpp @@ -12,6 +12,8 @@ using namespace std; namespace { +using InOutCitySpeedKMpH = VehicleModel::InOutCitySpeedKMpH; +using SpeedKMpH = VehicleModel::SpeedKMpH; // See model specifics in different countries here: // https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions @@ -28,55 +30,31 @@ namespace // less pedestrian. As result of such heuristic road is not totally the shortest, but it avoids non pedestrian roads, which were // not marked as "foot=no" in OSM. -// Speed of road features located outside cities and towns polygons in km per hour. -double constexpr kOutCitySpeedTrunkKMpH = 1.0; -double constexpr kOutCitySpeedTrunkLinkKMpH = 1.0; -double constexpr kOutCitySpeedPrimaryKMpH = 2.0; -double constexpr kOutCitySpeedPrimaryLinkKMpH = 2.0; -double constexpr kOutCitySpeedSecondaryKMpH = 3.0; -double constexpr kOutCitySpeedSecondaryLinkKMpH = 3.0; -double constexpr kOutCitySpeedTertiaryKMpH = 4.0; -double constexpr kOutCitySpeedTertiaryLinkKMpH = 4.0; -double constexpr kOutCitySpeedServiceKMpH = 5.0; -double constexpr kOutCitySpeedUnclassifiedKMpH = 4.5; -double constexpr kOutCitySpeedRoadKMpH = 4.0; -double constexpr kOutCitySpeedTrackKMpH = 5.0; -double constexpr kOutCitySpeedPathKMpH = 5.0; -double constexpr kOutCitySpeedBridlewayKMpH = 1.0; -double constexpr kOutCitySpeedCyclewayKMpH = 4.0; -double constexpr kOutCitySpeedResidentialKMpH = 4.5; -double constexpr kOutCitySpeedLivingStreetKMpH = 5.0; -double constexpr kOutCitySpeedStepsKMpH = 4.9; -double constexpr kOutCitySpeedPedestrianKMpH = 5.0; -double constexpr kOutCitySpeedFootwayKMpH = 5.0; -double constexpr kOutCitySpeedPlatformKMpH = 5.0; -double constexpr kOutCitySpeedPierKMpH = 4.0; -double constexpr kOutCitySpeedFerryKMpH = 1.0; - -// Speed of road features located inside cities and towns polygons in km per hour. -double constexpr kInCitySpeedTrunkKMpH = kOutCitySpeedTrunkKMpH; -double constexpr kInCitySpeedTrunkLinkKMpH = kOutCitySpeedTrunkLinkKMpH; -double constexpr kInCitySpeedPrimaryKMpH = kOutCitySpeedPrimaryKMpH; -double constexpr kInCitySpeedPrimaryLinkKMpH = kOutCitySpeedPrimaryLinkKMpH; -double constexpr kInCitySpeedSecondaryKMpH = kOutCitySpeedSecondaryKMpH; -double constexpr kInCitySpeedSecondaryLinkKMpH = kOutCitySpeedSecondaryLinkKMpH; -double constexpr kInCitySpeedTertiaryKMpH = kOutCitySpeedTertiaryKMpH; -double constexpr kInCitySpeedTertiaryLinkKMpH = kOutCitySpeedTertiaryLinkKMpH; -double constexpr kInCitySpeedServiceKMpH = kOutCitySpeedServiceKMpH; -double constexpr kInCitySpeedUnclassifiedKMpH = kOutCitySpeedUnclassifiedKMpH; -double constexpr kInCitySpeedRoadKMpH = kOutCitySpeedRoadKMpH; -double constexpr kInCitySpeedTrackKMpH = kOutCitySpeedTrackKMpH; -double constexpr kInCitySpeedPathKMpH = kOutCitySpeedPathKMpH; -double constexpr kInCitySpeedBridlewayKMpH = kOutCitySpeedBridlewayKMpH; -double constexpr kInCitySpeedCyclewayKMpH = kOutCitySpeedCyclewayKMpH; -double constexpr kInCitySpeedResidentialKMpH = kOutCitySpeedResidentialKMpH; -double constexpr kInCitySpeedLivingStreetKMpH = kOutCitySpeedLivingStreetKMpH; -double constexpr kInCitySpeedStepsKMpH = kOutCitySpeedStepsKMpH; -double constexpr kInCitySpeedPedestrianKMpH = kOutCitySpeedPedestrianKMpH; -double constexpr kInCitySpeedFootwayKMpH = kOutCitySpeedFootwayKMpH; -double constexpr kInCitySpeedPlatformKMpH = kOutCitySpeedPlatformKMpH; -double constexpr kInCitySpeedPierKMpH = kOutCitySpeedPierKMpH; -double constexpr kInCitySpeedFerryKMpH = kOutCitySpeedFerryKMpH; +// Speed of road features located inside and outside cities and towns polygons in km per hour. +// in city out city +InOutCitySpeedKMpH const kSpeedTrunkKMpH(SpeedKMpH(1.0), SpeedKMpH(1.0)); +InOutCitySpeedKMpH const kSpeedTrunkLinkKMpH(SpeedKMpH(1.0), SpeedKMpH(1.0)); +InOutCitySpeedKMpH const kSpeedPrimaryKMpH(SpeedKMpH(2.0), SpeedKMpH(2.0)); +InOutCitySpeedKMpH const kSpeedPrimaryLinkKMpH(SpeedKMpH(2.0), SpeedKMpH(2.0)); +InOutCitySpeedKMpH const kSpeedSecondaryKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); +InOutCitySpeedKMpH const kSpeedSecondaryLinkKMpH(SpeedKMpH(3.0), SpeedKMpH(3.0)); +InOutCitySpeedKMpH const kSpeedTertiaryKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedTertiaryLinkKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedServiceKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedUnclassifiedKMpH(SpeedKMpH(4.5), SpeedKMpH(4.5)); +InOutCitySpeedKMpH const kSpeedRoadKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedTrackKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedPathKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedBridlewayKMpH(SpeedKMpH(1.0), SpeedKMpH(1.0)); +InOutCitySpeedKMpH const kSpeedCyclewayKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedResidentialKMpH(SpeedKMpH(4.5), SpeedKMpH(4.5)); +InOutCitySpeedKMpH const kSpeedLivingStreetKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedStepsKMpH(SpeedKMpH(4.9), SpeedKMpH(4.9)); +InOutCitySpeedKMpH const kSpeedPedestrianKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedFootwayKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedPlatformKMpH(SpeedKMpH(5.0), SpeedKMpH(5.0)); +InOutCitySpeedKMpH const kSpeedPierKMpH(SpeedKMpH(4.0), SpeedKMpH(4.0)); +InOutCitySpeedKMpH const kSpeedFerryKMpH(SpeedKMpH(1.0), SpeedKMpH(1.0)); double constexpr kSpeedOffroadKMpH = 3.0; @@ -84,122 +62,122 @@ double constexpr kSpeedOffroadKMpH = 3.0; VehicleModel::LimitsInitList const g_pedestrianLimitsDefault = { // {{roadType, roadType} {weightSpeedKMpH, etSpeedKMpH} passThroughAllowed} - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // All options available. VehicleModel::LimitsInitList const g_pedestrianLimitsAll = { - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except trunk and trunk link are not allowed. VehicleModel::LimitsInitList const g_pedestrianLimitsNoTrunk = { - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except cycleway is allowed. VehicleModel::LimitsInitList const g_pedestrianLimitsCyclewayAllowed = { - {{"highway", "trunk"}, kOutCitySpeedTrunkKMpH, kInCitySpeedTrunkKMpH, true}, - {{"highway", "trunk_link"}, kOutCitySpeedTrunkLinkKMpH, kInCitySpeedTrunkLinkKMpH, true}, - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, + {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Same as defaults except cycleway is allowed and trunk and trunk_link are not allowed. VehicleModel::LimitsInitList const g_pedestrianLimitsCyclewayAllowedNoTrunk = { - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Australia @@ -216,25 +194,25 @@ VehicleModel::LimitsInitList const g_pedestrianLimitsBelgium = { // Trunk and trunk_link are not allowed // Bridleway and cycleway are allowed - {{"highway", "primary"}, kOutCitySpeedPrimaryKMpH, kInCitySpeedPrimaryKMpH, true}, - {{"highway", "primary_link"}, kOutCitySpeedPrimaryLinkKMpH, kInCitySpeedPrimaryLinkKMpH, true}, - {{"highway", "secondary"}, kOutCitySpeedSecondaryKMpH, kInCitySpeedSecondaryKMpH, true}, - {{"highway", "secondary_link"}, kOutCitySpeedSecondaryLinkKMpH, kInCitySpeedSecondaryLinkKMpH, true}, - {{"highway", "tertiary"}, kOutCitySpeedTertiaryKMpH, kInCitySpeedTertiaryKMpH, true}, - {{"highway", "tertiary_link"}, kOutCitySpeedTertiaryLinkKMpH, kInCitySpeedTertiaryLinkKMpH, true}, - {{"highway", "service"}, kOutCitySpeedServiceKMpH, kInCitySpeedServiceKMpH, true}, - {{"highway", "unclassified"}, kOutCitySpeedUnclassifiedKMpH, kInCitySpeedUnclassifiedKMpH, true}, - {{"highway", "road"}, kOutCitySpeedRoadKMpH, kInCitySpeedRoadKMpH, true}, - {{"highway", "track"}, kOutCitySpeedTrackKMpH, kInCitySpeedTrackKMpH, true}, - {{"highway", "path"}, kOutCitySpeedPathKMpH, kInCitySpeedPathKMpH, true}, - {{"highway", "bridleway"}, kOutCitySpeedBridlewayKMpH, kInCitySpeedBridlewayKMpH, true}, - {{"highway", "cycleway"}, kOutCitySpeedCyclewayKMpH, kInCitySpeedCyclewayKMpH, true}, - {{"highway", "residential"}, kOutCitySpeedResidentialKMpH, kInCitySpeedResidentialKMpH, true}, - {{"highway", "living_street"}, kOutCitySpeedLivingStreetKMpH, kInCitySpeedLivingStreetKMpH, true}, - {{"highway", "steps"}, kOutCitySpeedStepsKMpH, kInCitySpeedStepsKMpH, true}, - {{"highway", "pedestrian"}, kOutCitySpeedPedestrianKMpH, kInCitySpeedPedestrianKMpH, true}, - {{"highway", "footway"}, kOutCitySpeedFootwayKMpH, kInCitySpeedFootwayKMpH, true}, - {{"highway", "platform"}, kOutCitySpeedPlatformKMpH, kInCitySpeedPlatformKMpH, true} + {{"highway", "primary"}, kSpeedPrimaryKMpH, true}, + {{"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true}, + {{"highway", "secondary"}, kSpeedSecondaryKMpH, true}, + {{"highway", "secondary_link"}, kSpeedSecondaryLinkKMpH, true}, + {{"highway", "tertiary"}, kSpeedTertiaryKMpH, true}, + {{"highway", "tertiary_link"}, kSpeedTertiaryLinkKMpH, true}, + {{"highway", "service"}, kSpeedServiceKMpH, true}, + {{"highway", "unclassified"}, kSpeedUnclassifiedKMpH, true}, + {{"highway", "road"}, kSpeedRoadKMpH, true}, + {{"highway", "track"}, kSpeedTrackKMpH, true}, + {{"highway", "path"}, kSpeedPathKMpH, true}, + {{"highway", "bridleway"}, kSpeedBridlewayKMpH, true}, + {{"highway", "cycleway"}, kSpeedCyclewayKMpH, true}, + {{"highway", "residential"}, kSpeedResidentialKMpH, true}, + {{"highway", "living_street"}, kSpeedLivingStreetKMpH, true}, + {{"highway", "steps"}, kSpeedStepsKMpH, true}, + {{"highway", "pedestrian"}, kSpeedPedestrianKMpH, true}, + {{"highway", "footway"}, kSpeedFootwayKMpH, true}, + {{"highway", "platform"}, kSpeedPlatformKMpH, true} }; // Brazil @@ -330,9 +308,9 @@ void PedestrianModel::Init() m_yesFootType = classif().GetTypeByPath(hwtagYesFoot); vector const additionalTags = { - {hwtagYesFoot, m_maxSpeed, m_maxSpeed}, - {{"route", "ferry"}, kOutCitySpeedFerryKMpH, kInCitySpeedFerryKMpH}, - {{"man_made", "pier"}, kOutCitySpeedPierKMpH, kInCitySpeedPierKMpH} + {hwtagYesFoot, InOutCitySpeedKMpH(m_maxSpeed, m_maxSpeed)}, + {{"route", "ferry"}, kSpeedFerryKMpH}, + {{"man_made", "pier"}, kSpeedPierKMpH} }; SetAdditionalRoadTypes(classif(), additionalTags); diff --git a/routing_common/routing_common_tests/vehicle_model_test.cpp b/routing_common/routing_common_tests/vehicle_model_test.cpp index 4f37122b65..9a1916e6df 100644 --- a/routing_common/routing_common_tests/vehicle_model_test.cpp +++ b/routing_common/routing_common_tests/vehicle_model_test.cpp @@ -12,14 +12,15 @@ using namespace std; namespace { +using SpeedKMpH = routing::VehicleModel::SpeedKMpH; + routing::VehicleModel::LimitsInitList const s_testLimits = { // Out of city weight and eta speeds. In city weight and eta speeds. - {{"highway", "trunk"}, {150.0, 150.0}, {100.0, 100.0}, true}, - {{"highway", "primary"}, {120.0, 120.0}, {90.0, 90.0}, true}, - {{"highway", "secondary"}, {80.0, 70.0}, {80.0, 70.0}, true}, - {{"highway", "residential"}, {50.0, 60.0}, {45.0, 55.0}, true}, - {{"highway", "service"}, {50.0, 40.0}, {47.0, 36.0}, false} -}; + {{"highway", "trunk"}, {SpeedKMpH(150.0, 150.0), SpeedKMpH(100.0, 100.0)}, true}, + {{"highway", "primary"}, {SpeedKMpH(120.0, 120.0), SpeedKMpH(90.0, 90.0)}, true}, + {{"highway", "secondary"}, {SpeedKMpH(80.0, 70.0), SpeedKMpH(80.0, 70.0)}, true}, + {{"highway", "residential"}, {SpeedKMpH(50.0, 60.0), SpeedKMpH(45.0, 55.0)}, true}, + {{"highway", "service"}, {SpeedKMpH(50.0, 40.0), SpeedKMpH(47.0, 36.0)}, false}}; routing::VehicleModel::SurfaceInitList const g_carSurface = { {{"psurface", "paved_good"}, {0.8 /* weightFactor */, 0.9 /* etaFactor */}}, @@ -38,8 +39,7 @@ class TestVehicleModel : public routing::VehicleModel { friend void CheckOneWay(initializer_list const & types, bool expectedValue); friend void CheckPassThroughAllowed(initializer_list const & types, bool expectedValue); - friend void CheckSpeed(initializer_list const & types, - routing::VehicleModelInterface::SpeedKMpH && expectedSpeed); + friend void CheckSpeed(initializer_list const & types, SpeedKMpH && expectedSpeed); public: TestVehicleModel() : VehicleModel(classif(), s_testLimits, g_carSurface) {} @@ -60,7 +60,7 @@ uint32_t GetOnewayType() return GetType("hwtag", "oneway"); } -void CheckSpeed(initializer_list const & types, routing::VehicleModelInterface::SpeedKMpH && expectedSpeed) +void CheckSpeed(initializer_list const & types, SpeedKMpH && expectedSpeed) { TestVehicleModel vehicleModel; feature::TypesHolder h; diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp index 940ef172b4..905f6ee309 100644 --- a/routing_common/vehicle_model.cpp +++ b/routing_common/vehicle_model.cpp @@ -26,17 +26,18 @@ namespace routing VehicleModel::AdditionalRoadType::AdditionalRoadType(Classificator const & c, AdditionalRoadTags const & tag) : m_type(c.GetTypeByPath(tag.m_hwtag)) - , m_outCitySpeed(tag.m_outCitySpeed) - , m_inCitySpeed(tag.m_inCitySpeed) + , m_speed(tag.m_speed) { } -VehicleModel::RoadLimits::RoadLimits(VehicleModel::SpeedKMpH const & speed, +VehicleModel::RoadLimits::RoadLimits(VehicleModel::InOutCitySpeedKMpH const & speed, bool isPassThroughAllowed) : m_speed(speed), m_isPassThroughAllowed(isPassThroughAllowed) { - CHECK_GREATER(m_speed.m_weight, 0.0, ()); - CHECK_GREATER(m_speed.m_eta, 0.0, ()); + CHECK_GREATER(m_speed.m_inCity.m_weight, 0.0, ()); + CHECK_GREATER(m_speed.m_inCity.m_eta, 0.0, ()); + CHECK_GREATER(m_speed.m_outCity.m_weight, 0.0, ()); + CHECK_GREATER(m_speed.m_outCity.m_eta, 0.0, ()); } VehicleModel::VehicleModel(Classificator const & c, LimitsInitList const & featureTypeLimits, @@ -50,9 +51,9 @@ VehicleModel::VehicleModel(Classificator const & c, LimitsInitList const & featu for (auto const & v : featureTypeLimits) { - m_maxSpeed = Pick(m_maxSpeed, Pick(v.m_outCitySpeed, v.m_inCitySpeed)); + m_maxSpeed = Pick(m_maxSpeed, Pick(v.m_speed.m_outCity, v.m_speed.m_inCity)); m_highwayTypes.emplace(c.GetTypeByPath(v.m_types), - RoadLimits(v.m_inCitySpeed, v.m_isPassThroughAllowed)); + RoadLimits(v.m_speed, v.m_isPassThroughAllowed)); } size_t i = 0; @@ -77,7 +78,7 @@ void VehicleModel::SetAdditionalRoadTypes(Classificator const & c, for (auto const & tag : additionalTags) { m_addRoadTypes.emplace_back(c, tag); - m_maxSpeed = Pick(m_maxSpeed, Pick(tag.m_outCitySpeed, tag.m_inCitySpeed)); + m_maxSpeed = Pick(m_maxSpeed, Pick(tag.m_speed.m_outCity, tag.m_speed.m_inCity)); } } @@ -110,8 +111,9 @@ VehicleModel::SpeedKMpH VehicleModel::GetMinTypeSpeed(feature::TypesHolder const speed = Pick(speed, itHighway->second.GetSpeed()); auto const addRoadInfoIter = FindRoadType(t); + // @TODO(bykoianko) Check if there's a feature in city or not and use correct speed. if (addRoadInfoIter != m_addRoadTypes.cend()) - speed = Pick(speed, addRoadInfoIter->m_outCitySpeed); + speed = Pick(speed, addRoadInfoIter->m_speed.m_outCity); auto const itFactor = find_if(m_surfaceFactors.cbegin(), m_surfaceFactors.cend(), [t](TypeFactor const & v) { return v.m_type == t; }); diff --git a/routing_common/vehicle_model.hpp b/routing_common/vehicle_model.hpp index fbe0628d73..3b262f59e5 100644 --- a/routing_common/vehicle_model.hpp +++ b/routing_common/vehicle_model.hpp @@ -31,20 +31,33 @@ public: struct SpeedKMpH { SpeedKMpH() = default; - SpeedKMpH(double weight) noexcept : m_weight(weight), m_eta(weight) {} + explicit SpeedKMpH(double weight) noexcept : m_weight(weight), m_eta(weight) {} SpeedKMpH(double weight, double eta) noexcept : m_weight(weight), m_eta(eta) {} - double m_weight = 0.0; // KMpH - double m_eta = 0.0; // KMpH - bool operator==(SpeedKMpH const & rhs) const { return m_weight == rhs.m_weight && m_eta == rhs.m_eta; } + + double m_weight = 0.0; // KMpH + double m_eta = 0.0; // KMpH }; - // @TODO(bykoianko) A struct for adding speed in city and out side should be added. - // This structure should contain to fields of SpeedKMpH type. + struct InOutCitySpeedKMpH + { + InOutCitySpeedKMpH(SpeedKMpH const & inCity, SpeedKMpH const & outCity) noexcept + : m_inCity(inCity), m_outCity(outCity) + { + } + + bool operator==(InOutCitySpeedKMpH const & rhs) const + { + return m_inCity == rhs.m_inCity && m_outCity == rhs.m_outCity; + } + + SpeedKMpH m_inCity; + SpeedKMpH m_outCity; + }; /// Factors which reduce weight and ETA speed on feature in case of bad pavement. /// Both should be in range [0.0, 1.0]. @@ -99,23 +112,22 @@ public: class VehicleModel : public VehicleModelInterface { public: - using SpeedKMpH = VehicleModelInterface::SpeedKMpH; + using InOutCitySpeedKMpH = VehicleModelInterface::InOutCitySpeedKMpH; using SpeedFactor = VehicleModelInterface::SpeedFactor; + using SpeedKMpH = VehicleModelInterface::SpeedKMpH; struct FeatureTypeLimits final { - FeatureTypeLimits(std::vector const & types, SpeedKMpH const & outCitySpeed, - SpeedKMpH const & inCitySpeed, bool isPassThroughAllowed) + FeatureTypeLimits(std::vector const & types, InOutCitySpeedKMpH const & speed, + bool isPassThroughAllowed) : m_types(types) - , m_outCitySpeed(outCitySpeed) - , m_inCitySpeed(inCitySpeed) + , m_speed(speed) , m_isPassThroughAllowed(isPassThroughAllowed) { } std::vector m_types; - SpeedKMpH m_outCitySpeed; // Average speed on this road type out of cities. - SpeedKMpH m_inCitySpeed; // Average speed on this road type in cities. + InOutCitySpeedKMpH m_speed; // Average speed on this road type in and out of cities. bool m_isPassThroughAllowed; // Pass through this road type is allowed. }; @@ -132,14 +144,13 @@ public: AdditionalRoadTags() = default; AdditionalRoadTags(std::initializer_list const & hwtag, - SpeedKMpH const & outCitySpeed, SpeedKMpH const & inCitySpeed) - : m_hwtag(hwtag), m_outCitySpeed(outCitySpeed), m_inCitySpeed(inCitySpeed) + InOutCitySpeedKMpH const & speed) noexcept + : m_hwtag(hwtag), m_speed(speed) { } std::initializer_list m_hwtag; - SpeedKMpH m_outCitySpeed; - SpeedKMpH m_inCitySpeed; + InOutCitySpeedKMpH m_speed; }; using LimitsInitList = std::initializer_list; @@ -195,6 +206,8 @@ protected: SpeedKMpH GetMinTypeSpeed(feature::TypesHolder const & types) const; + // @TODO(bykoianko) |m_maxSpeed| should be kept for in city and out city roads. + // Use InOutCitySpeedKMpH structure. SpeedKMpH m_maxSpeed; private: @@ -205,16 +218,16 @@ private: bool operator==(AdditionalRoadType const & rhs) const { return m_type == rhs.m_type; } uint32_t const m_type; - SpeedKMpH m_outCitySpeed; - SpeedKMpH m_inCitySpeed; + InOutCitySpeedKMpH m_speed; }; class RoadLimits final { public: - RoadLimits(SpeedKMpH const & speed, bool isPassThroughAllowed); + RoadLimits(InOutCitySpeedKMpH const & speed, bool isPassThroughAllowed); - SpeedKMpH const & GetSpeed() const { return m_speed; }; + // @TODO() GetSpeed() should return speed in city and outside. + SpeedKMpH const & GetSpeed() const { return m_speed.m_outCity; }; bool IsPassThroughAllowed() const { return m_isPassThroughAllowed; }; bool operator==(RoadLimits const & rhs) const { @@ -222,8 +235,7 @@ private: } private: - // @TODO(bykoianko) Road limits should contain speed for roads inside a city and outside. - SpeedKMpH const m_speed; + InOutCitySpeedKMpH const m_speed; bool const m_isPassThroughAllowed; };