diff options
author | tatiana-kondakova <tatiana.kondakova@gmail.com> | 2017-11-16 19:12:21 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-11-17 17:23:41 +0300 |
commit | e03e986c71969db0d3d5b625224368715252c6e8 (patch) | |
tree | ba55212ec0c73863c95a0be2f52c6379d63e19f0 /routing_common | |
parent | 72b70678a6c3c16e2902166046a0e5b190f5ccf5 (diff) |
Rename IsTransitAllowed -> IsPassThroughAllowed because we use "Transit" for public transport
Diffstat (limited to 'routing_common')
-rw-r--r-- | routing_common/bicycle_model.cpp | 6 | ||||
-rw-r--r-- | routing_common/car_model.cpp | 22 | ||||
-rw-r--r-- | routing_common/pedestrian_model.cpp | 2 | ||||
-rw-r--r-- | routing_common/routing_common_tests/vehicle_model_test.cpp | 14 | ||||
-rw-r--r-- | routing_common/vehicle_model.cpp | 14 | ||||
-rw-r--r-- | routing_common/vehicle_model.hpp | 26 |
6 files changed, 44 insertions, 40 deletions
diff --git a/routing_common/bicycle_model.cpp b/routing_common/bicycle_model.cpp index 4e6067228e..fa98fb15a3 100644 --- a/routing_common/bicycle_model.cpp +++ b/routing_common/bicycle_model.cpp @@ -54,7 +54,7 @@ double constexpr kSpeedOffroadKMpH = 3.0; // Default VehicleModel::InitListT const g_bicycleLimitsDefault = { - { {"highway", "trunk"}, kSpeedTrunkKMpH, true /* transitAllowed */ }, + { {"highway", "trunk"}, kSpeedTrunkKMpH, true /* passThroughAllowed */ }, { {"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true }, { {"highway", "primary"}, kSpeedPrimaryKMpH, true }, { {"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true }, @@ -327,7 +327,7 @@ VehicleModel::InitListT const g_bicycleLimitsRomania = g_bicycleLimitsNoTrunk; VehicleModel::InitListT const g_bicycleLimitsRussia = { // Footway and pedestrian are allowed - // No transit for service and living_street + // No pass through service and living_street { {"highway", "trunk"}, kSpeedTrunkKMpH, true }, { {"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true }, { {"highway", "primary"}, kSpeedPrimaryKMpH, true }, @@ -367,7 +367,7 @@ VehicleModel::InitListT const g_bicycleLimitsUkraine = { // No trunk // Footway and perestrian are allowed - // No transit for living_street and service + // No pass through living_street and service { {"highway", "primary"}, kSpeedPrimaryKMpH, true }, { {"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true }, { {"highway", "secondary"}, kSpeedSecondaryKMpH, true }, diff --git a/routing_common/car_model.cpp b/routing_common/car_model.cpp index 65e529e073..889c34fed7 100644 --- a/routing_common/car_model.cpp +++ b/routing_common/car_model.cpp @@ -42,7 +42,7 @@ double constexpr kSpeedOffroadKMpH = 10.0; VehicleModel::InitListT const g_carLimitsDefault = { - {{"highway", "motorway"}, kSpeedMotorwayKMpH, true /* isTransitAllowed */ }, + {{"highway", "motorway"}, kSpeedMotorwayKMpH, true /* passThroughAllowed */ }, {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, {{"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true}, @@ -66,7 +66,7 @@ VehicleModel::InitListT const g_carLimitsDefault = //{ {"highway", "construction"}, 40 }, }; -VehicleModel::InitListT const g_carLimitsNoLivingStreetTransit = +VehicleModel::InitListT const g_carLimitsNoPassThroughLivingStreet = { {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, @@ -86,7 +86,7 @@ VehicleModel::InitListT const g_carLimitsNoLivingStreetTransit = {{"highway", "track"}, kSpeedTrackKMpH, true}, }; -VehicleModel::InitListT const g_carLimitsNoLivingStreetAndServiceTransit = +VehicleModel::InitListT const g_carLimitsNoPassThroughLivingStreetAndService = { {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, @@ -108,9 +108,9 @@ VehicleModel::InitListT const g_carLimitsNoLivingStreetAndServiceTransit = VehicleModel::InitListT const g_carLimitsAustralia = g_carLimitsDefault; -VehicleModel::InitListT const g_carLimitsAustria = g_carLimitsNoLivingStreetTransit; +VehicleModel::InitListT const g_carLimitsAustria = g_carLimitsNoPassThroughLivingStreet; -VehicleModel::InitListT const g_carLimitsBelarus = g_carLimitsNoLivingStreetTransit; +VehicleModel::InitListT const g_carLimitsBelarus = g_carLimitsNoPassThroughLivingStreet; VehicleModel::InitListT const g_carLimitsBelgium = g_carLimitsDefault; @@ -142,7 +142,7 @@ VehicleModel::InitListT const g_carLimitsFinland = g_carLimitsDefault; VehicleModel::InitListT const g_carLimitsGermany = { - // No transit for track + // No pass through track {{"highway", "motorway"}, kSpeedMotorwayKMpH, true}, {{"highway", "motorway_link"}, kSpeedMotorwayLinkKMpH, true}, {{"highway", "trunk"}, kSpeedTrunkKMpH, true}, @@ -161,7 +161,7 @@ VehicleModel::InitListT const g_carLimitsGermany = {{"highway", "track"}, kSpeedTrackKMpH, false}, }; -VehicleModel::InitListT const g_carLimitsHungary = g_carLimitsNoLivingStreetTransit; +VehicleModel::InitListT const g_carLimitsHungary = g_carLimitsNoPassThroughLivingStreet; VehicleModel::InitListT const g_carLimitsIceland = g_carLimitsDefault; @@ -173,11 +173,11 @@ VehicleModel::InitListT const g_carLimitsOman = g_carLimitsDefault; VehicleModel::InitListT const g_carLimitsPoland = g_carLimitsDefault; -VehicleModel::InitListT const g_carLimitsRomania = g_carLimitsNoLivingStreetTransit; +VehicleModel::InitListT const g_carLimitsRomania = g_carLimitsNoPassThroughLivingStreet; -VehicleModel::InitListT const g_carLimitsRussia = g_carLimitsNoLivingStreetAndServiceTransit; +VehicleModel::InitListT const g_carLimitsRussia = g_carLimitsNoPassThroughLivingStreetAndService; -VehicleModel::InitListT const g_carLimitsSlovakia = g_carLimitsNoLivingStreetTransit; +VehicleModel::InitListT const g_carLimitsSlovakia = g_carLimitsNoPassThroughLivingStreet; VehicleModel::InitListT const g_carLimitsSpain = g_carLimitsDefault; @@ -185,7 +185,7 @@ VehicleModel::InitListT const g_carLimitsSwitzerland = g_carLimitsDefault; VehicleModel::InitListT const g_carLimitsTurkey = g_carLimitsDefault; -VehicleModel::InitListT const g_carLimitsUkraine = g_carLimitsNoLivingStreetAndServiceTransit; +VehicleModel::InitListT const g_carLimitsUkraine = g_carLimitsNoPassThroughLivingStreetAndService; VehicleModel::InitListT const g_carLimitsUK = g_carLimitsDefault; diff --git a/routing_common/pedestrian_model.cpp b/routing_common/pedestrian_model.cpp index 7352b93ca3..e0c2a4ed5e 100644 --- a/routing_common/pedestrian_model.cpp +++ b/routing_common/pedestrian_model.cpp @@ -54,7 +54,7 @@ double constexpr kSpeedOffroadKMpH = 3.0; // Default VehicleModel::InitListT const g_pedestrianLimitsDefault = { - { {"highway", "trunk"}, kSpeedTrunkKMpH, true /* transitAllowed */ }, + { {"highway", "trunk"}, kSpeedTrunkKMpH, true /* passThroughAllowed */ }, { {"highway", "trunk_link"}, kSpeedTrunkLinkKMpH, true }, { {"highway", "primary"}, kSpeedPrimaryKMpH, true }, { {"highway", "primary_link"}, kSpeedPrimaryLinkKMpH, true }, diff --git a/routing_common/routing_common_tests/vehicle_model_test.cpp b/routing_common/routing_common_tests/vehicle_model_test.cpp index ba448fe718..4f241d28b4 100644 --- a/routing_common/routing_common_tests/vehicle_model_test.cpp +++ b/routing_common/routing_common_tests/vehicle_model_test.cpp @@ -27,7 +27,7 @@ public: class TestVehicleModel : public routing::VehicleModel { friend void CheckOneWay(initializer_list<uint32_t> const & types, bool expectedValue); - friend void CheckTransitAllowed(initializer_list<uint32_t> const & types, bool expectedValue); + friend void CheckPassThroughAllowed(initializer_list<uint32_t> const & types, bool expectedValue); friend void CheckSpeed(initializer_list<uint32_t> const & types, double expectedSpeed); public: @@ -69,14 +69,14 @@ void CheckOneWay(initializer_list<uint32_t> const & types, bool expectedValue) TEST_EQUAL(vehicleModel.HasOneWayType(h), expectedValue, ()); } -void CheckTransitAllowed(initializer_list<uint32_t> const & types, bool expectedValue) +void CheckPassThroughAllowed(initializer_list<uint32_t> const & types, bool expectedValue) { TestVehicleModel vehicleModel; feature::TypesHolder h; for (uint32_t t : types) h.Add(t); - TEST_EQUAL(vehicleModel.HasTransitType(h), expectedValue, ()); + TEST_EQUAL(vehicleModel.HasPassThroughType(h), expectedValue, ()); } } // namespace @@ -134,9 +134,9 @@ UNIT_CLASS_TEST(VehicleModelTest, VehicleModel_DifferentSpeeds) CheckOneWay({typePrimary, typeOneway, typeSecondary}, true); } -UNIT_CLASS_TEST(VehicleModelTest, VehicleModel_TransitAllowed) +UNIT_CLASS_TEST(VehicleModelTest, VehicleModel_PassThroughAllowed) { - CheckTransitAllowed({GetType("highway", "secondary")}, true); - CheckTransitAllowed({GetType("highway", "primary")}, true); - CheckTransitAllowed({GetType("highway", "service")}, false); + CheckPassThroughAllowed({GetType("highway", "secondary")}, true); + CheckPassThroughAllowed({GetType("highway", "primary")}, true); + CheckPassThroughAllowed({GetType("highway", "service")}, false); } diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp index d3eda7041d..00c6645880 100644 --- a/routing_common/vehicle_model.cpp +++ b/routing_common/vehicle_model.cpp @@ -18,8 +18,8 @@ VehicleModel::AdditionalRoadType::AdditionalRoadType(Classificator const & c, { } -VehicleModel::RoadLimits::RoadLimits(double speedKMpH, bool isTransitAllowed) - : m_speedKMpH(speedKMpH), m_isTransitAllowed(isTransitAllowed) +VehicleModel::RoadLimits::RoadLimits(double speedKMpH, bool isPassThroughAllowed) + : m_speedKMpH(speedKMpH), m_isPassThroughAllowed(isPassThroughAllowed) { CHECK_GREATER(m_speedKMpH, 0.0, ()); } @@ -32,7 +32,7 @@ VehicleModel::VehicleModel(Classificator const & c, InitListT const & featureTyp { m_maxSpeedKMpH = max(m_maxSpeedKMpH, v.m_speedKMpH); m_types.emplace(c.GetTypeByPath(vector<string>(v.m_types, v.m_types + 2)), - RoadLimits(v.m_speedKMpH, v.m_isTransitAllowed)); + RoadLimits(v.m_speedKMpH, v.m_isPassThroughAllowed)); } } @@ -111,19 +111,19 @@ bool VehicleModel::IsRoad(FeatureType const & f) const return HasRoadType(types); } -bool VehicleModel::IsTransitAllowed(FeatureType const & f) const +bool VehicleModel::IsPassThroughAllowed(FeatureType const & f) const { feature::TypesHolder const types(f); - return HasTransitType(types); + return HasPassThroughType(types); } -bool VehicleModel::HasTransitType(feature::TypesHolder const & types) const +bool VehicleModel::HasPassThroughType(feature::TypesHolder const & types) const { for (uint32_t t : types) { uint32_t const type = ftypes::BaseChecker::PrepareToMatch(t, 2); auto it = m_types.find(type); - if (it != m_types.end() && it->second.IsTransitAllowed()) + if (it != m_types.end() && it->second.IsPassThroughAllowed()) return true; } diff --git a/routing_common/vehicle_model.hpp b/routing_common/vehicle_model.hpp index 79206e5a99..ece3f0985b 100644 --- a/routing_common/vehicle_model.hpp +++ b/routing_common/vehicle_model.hpp @@ -43,8 +43,11 @@ public: /// @returns true iff feature |f| can be used for routing with corresponding vehicle model. virtual bool IsRoad(FeatureType const & f) const = 0; - /// @returns true iff feature |f| can be used for transit with corresponding vehicle model. - virtual bool IsTransitAllowed(FeatureType const & f) const = 0; + /// @returns true iff feature |f| can be used for through passage with corresponding vehicle model. + /// e.g. in Russia roads tagged "highway = service" are not allowed for through passage; + /// however, road with this tag can be be used if it is close enough to the start or destination + /// point of the route. + virtual bool IsPassThroughAllowed(FeatureType const & f) const = 0; }; class VehicleModelFactoryInterface @@ -65,9 +68,9 @@ class VehicleModel : public VehicleModelInterface public: struct FeatureTypeLimits final { - char const * m_types[2]; /// 2-arity road type - double m_speedKMpH; /// max allowed speed on this road type - bool m_isTransitAllowed; /// transit allowed for this road type + char const * m_types[2]; /// 2-arity road type + double m_speedKMpH; /// max allowed speed on this road type + bool m_isPassThroughAllowed; /// pass through this road type is allowed }; struct AdditionalRoadTags final @@ -92,7 +95,7 @@ public: double GetMaxSpeed() const override { return m_maxSpeedKMpH; } bool IsOneWay(FeatureType const & f) const override; bool IsRoad(FeatureType const & f) const override; - bool IsTransitAllowed(FeatureType const & f) const override; + bool IsPassThroughAllowed(FeatureType const & f) const override; public: /// @returns true if |m_types| or |m_addRoadTypes| contains |type| and false otherwise. @@ -131,7 +134,7 @@ protected: /// may be considered as features with forward geometry. bool HasOneWayType(feature::TypesHolder const & types) const; - bool HasTransitType(feature::TypesHolder const & types) const; + bool HasPassThroughType(feature::TypesHolder const & types) const; double GetMinTypeSpeed(feature::TypesHolder const & types) const; @@ -151,18 +154,19 @@ private: { public: RoadLimits() = delete; - RoadLimits(double speedKMpH, bool isTransitAllowed); + RoadLimits(double speedKMpH, bool isPassThroughAllowed); double GetSpeedKMpH() const { return m_speedKMpH; }; - bool IsTransitAllowed() const { return m_isTransitAllowed; }; + bool IsPassThroughAllowed() const { return m_isPassThroughAllowed; }; bool operator==(RoadLimits const & rhs) const { - return (m_speedKMpH == rhs.m_speedKMpH) && (m_isTransitAllowed == rhs.m_isTransitAllowed); + return (m_speedKMpH == rhs.m_speedKMpH) && + (m_isPassThroughAllowed == rhs.m_isPassThroughAllowed); } private: double const m_speedKMpH; - bool const m_isTransitAllowed; + bool const m_isPassThroughAllowed; }; std::vector<AdditionalRoadType>::const_iterator FindRoadType(uint32_t type) const; |