diff --git a/openlr/CMakeLists.txt b/openlr/CMakeLists.txt index a021439a7c..ea59cba7c6 100644 --- a/openlr/CMakeLists.txt +++ b/openlr/CMakeLists.txt @@ -27,8 +27,6 @@ set( paths_connector.hpp road_info_getter.cpp road_info_getter.hpp - road_type_checkers.cpp - road_type_checkers.hpp router.cpp router.hpp stats.hpp diff --git a/openlr/road_info_getter.cpp b/openlr/road_info_getter.cpp index 97c2d35c28..49d96330d3 100644 --- a/openlr/road_info_getter.cpp +++ b/openlr/road_info_getter.cpp @@ -6,8 +6,6 @@ #include "base/assert.hpp" -#include "std/iterator.hpp" - namespace { openlr::FunctionalRoadClass HighwayClassToFunctionalRoadClass(ftypes::HighwayClass const & hwClass) @@ -23,12 +21,12 @@ openlr::FunctionalRoadClass HighwayClassToFunctionalRoadClass(ftypes::HighwayCla default: return openlr::FunctionalRoadClass::FRC7; } } -} +} // namespace namespace openlr { RoadInfoGetter::RoadInfoGetter(DataSource const & dataSource) - : m_dataSource(dataSource), m_c(classif()) + : m_dataSource(dataSource) { } @@ -43,7 +41,6 @@ RoadInfoGetter::RoadInfo RoadInfoGetter::Get(FeatureID const & fid) CHECK(g.GetOriginalFeatureByIndex(fid.m_index, ft), ()); RoadInfo info; -// info.m_frc = GetFunctionalRoadClass(feature::TypesHolder(ft)); info.m_fow = GetFormOfWay(feature::TypesHolder(ft)); info.m_hwClass = ftypes::GetHighwayClass(feature::TypesHolder(ft)); info.m_link = ftypes::IsLinkChecker::Instance()(ft); @@ -55,35 +52,13 @@ RoadInfoGetter::RoadInfo RoadInfoGetter::Get(FeatureID const & fid) return it->second; } -FunctionalRoadClass RoadInfoGetter::GetFunctionalRoadClass(feature::TypesHolder const & types) const -{ - if (m_trunkChecker(types)) - return FunctionalRoadClass::FRC0; - - if (m_primaryChecker(types)) - return FunctionalRoadClass::FRC1; - - if (m_secondaryChecker(types)) - return FunctionalRoadClass::FRC2; - - if (m_tertiaryChecker(types)) - return FunctionalRoadClass::FRC3; - - if (m_residentialChecker(types)) - return FunctionalRoadClass::FRC4; - - if (m_livingStreetChecker(types)) - return FunctionalRoadClass::FRC5; - - return FunctionalRoadClass::FRC7; -} - FormOfWay RoadInfoGetter::GetFormOfWay(feature::TypesHolder const & types) const { - if (m_trunkChecker(types)) + auto const hwClass = ftypes::GetHighwayClass(feature::TypesHolder(types)); + if (hwClass == ftypes::HighwayClass::Trunk) return FormOfWay::Motorway; - if (m_primaryChecker(types)) + if (hwClass == ftypes::HighwayClass::Primary) return FormOfWay::MultipleCarriageway; return FormOfWay::SingleCarriageway; diff --git a/openlr/road_info_getter.hpp b/openlr/road_info_getter.hpp index 72b897d4d3..2a60a452b9 100644 --- a/openlr/road_info_getter.hpp +++ b/openlr/road_info_getter.hpp @@ -1,12 +1,11 @@ #pragma once #include "openlr/openlr_model.hpp" -#include "openlr/road_type_checkers.hpp" #include "indexer/feature_data.hpp" #include "indexer/ftypes_matcher.hpp" -#include "std/map.hpp" +#include class Classificator; class DataSource; @@ -30,24 +29,14 @@ public: bool m_oneWay = false; }; - RoadInfoGetter(DataSource const & dataSource); + explicit RoadInfoGetter(DataSource const & dataSource); RoadInfo Get(FeatureID const & fid); private: - FunctionalRoadClass GetFunctionalRoadClass(feature::TypesHolder const & types) const; FormOfWay GetFormOfWay(feature::TypesHolder const & types) const; DataSource const & m_dataSource; - Classificator const & m_c; - - TrunkChecker const m_trunkChecker; - PrimaryChecker const m_primaryChecker; - SecondaryChecker const m_secondaryChecker; - TertiaryChecker const m_tertiaryChecker; - ResidentialChecker const m_residentialChecker; - LivingStreetChecker const m_livingStreetChecker; - - map m_cache; + std::map m_cache; }; } // namespace openlr diff --git a/openlr/road_type_checkers.cpp b/openlr/road_type_checkers.cpp deleted file mode 100644 index c9b1e9b704..0000000000 --- a/openlr/road_type_checkers.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "openlr/road_type_checkers.hpp" - -#include "indexer/classificator.hpp" - -namespace openlr -{ -// TrunkChecker ------------------------------------------------------------------------------------ -TrunkChecker::TrunkChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "motorway"})); - m_types.push_back(c.GetTypeByPath({"highway", "motorway_link"})); - m_types.push_back(c.GetTypeByPath({"highway", "trunk"})); - m_types.push_back(c.GetTypeByPath({"highway", "trunk_link"})); -} - -// PrimaryChecker ---------------------------------------------------------------------------------- -PrimaryChecker::PrimaryChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "primary"})); - m_types.push_back(c.GetTypeByPath({"highway", "primary_link"})); -} - -// SecondaryChecker -------------------------------------------------------------------------------- -SecondaryChecker::SecondaryChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "secondary"})); - m_types.push_back(c.GetTypeByPath({"highway", "secondary_link"})); -} - -// TertiaryChecker --------------------------------------------------------------------------------- -TertiaryChecker::TertiaryChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "tertiary"})); - m_types.push_back(c.GetTypeByPath({"highway", "tertiary_link"})); -} - -// ResidentialChecker ------------------------------------------------------------------------------ -ResidentialChecker::ResidentialChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "road"})); - m_types.push_back(c.GetTypeByPath({"highway", "unclassified"})); - m_types.push_back(c.GetTypeByPath({"highway", "residential"})); -} - -// LivingStreetChecker ----------------------------------------------------------------------------- -LivingStreetChecker::LivingStreetChecker() -{ - auto const & c = classif(); - m_types.push_back(c.GetTypeByPath({"highway", "living_street"})); -} -} // namespace openlr diff --git a/openlr/road_type_checkers.hpp b/openlr/road_type_checkers.hpp deleted file mode 100644 index 689743ca11..0000000000 --- a/openlr/road_type_checkers.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "indexer/ftypes_matcher.hpp" - -namespace openlr -{ -class TrunkChecker final : public ftypes::BaseChecker -{ -public: - TrunkChecker(); -}; - -class PrimaryChecker final : public ftypes::BaseChecker -{ -public: - PrimaryChecker(); -}; - -class SecondaryChecker final : public ftypes::BaseChecker -{ -public: - SecondaryChecker(); -}; - -class TertiaryChecker final : public ftypes::BaseChecker -{ -public: - TertiaryChecker(); -}; - -class ResidentialChecker final : public ftypes::BaseChecker -{ -public: - ResidentialChecker(); -}; - -class LivingStreetChecker final : public ftypes::BaseChecker -{ -public: - LivingStreetChecker(); -}; -} // namespace openlr diff --git a/xcode/openlr/openlr.xcodeproj/project.pbxproj b/xcode/openlr/openlr.xcodeproj/project.pbxproj index b19cfc2ecc..57a9c4dd6f 100644 --- a/xcode/openlr/openlr.xcodeproj/project.pbxproj +++ b/xcode/openlr/openlr.xcodeproj/project.pbxproj @@ -11,8 +11,6 @@ 671E79111E6A502200B2859B /* openlr_model.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 671E79021E6A502200B2859B /* openlr_model.hpp */; }; 671E79181E6A502200B2859B /* road_info_getter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 671E79091E6A502200B2859B /* road_info_getter.cpp */; }; 671E79191E6A502200B2859B /* road_info_getter.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 671E790A1E6A502200B2859B /* road_info_getter.hpp */; }; - 671E791A1E6A502200B2859B /* road_type_checkers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 671E790B1E6A502200B2859B /* road_type_checkers.cpp */; }; - 671E791B1E6A502200B2859B /* road_type_checkers.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 671E790C1E6A502200B2859B /* road_type_checkers.hpp */; }; 671E791C1E6A502200B2859B /* router.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 671E790D1E6A502200B2859B /* router.cpp */; }; 671E791D1E6A502200B2859B /* router.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 671E790E1E6A502200B2859B /* router.hpp */; }; 671E791E1E6A502200B2859B /* way_point.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 671E790F1E6A502200B2859B /* way_point.hpp */; }; @@ -30,8 +28,6 @@ 671E79021E6A502200B2859B /* openlr_model.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = openlr_model.hpp; sourceTree = ""; }; 671E79091E6A502200B2859B /* road_info_getter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = road_info_getter.cpp; sourceTree = ""; }; 671E790A1E6A502200B2859B /* road_info_getter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = road_info_getter.hpp; sourceTree = ""; }; - 671E790B1E6A502200B2859B /* road_type_checkers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = road_type_checkers.cpp; sourceTree = ""; }; - 671E790C1E6A502200B2859B /* road_type_checkers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = road_type_checkers.hpp; sourceTree = ""; }; 671E790D1E6A502200B2859B /* router.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = router.cpp; sourceTree = ""; }; 671E790E1E6A502200B2859B /* router.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = router.hpp; sourceTree = ""; }; 671E790F1E6A502200B2859B /* way_point.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = way_point.hpp; sourceTree = ""; }; @@ -87,8 +83,6 @@ 671E79021E6A502200B2859B /* openlr_model.hpp */, 671E79091E6A502200B2859B /* road_info_getter.cpp */, 671E790A1E6A502200B2859B /* road_info_getter.hpp */, - 671E790B1E6A502200B2859B /* road_type_checkers.cpp */, - 671E790C1E6A502200B2859B /* road_type_checkers.hpp */, 671E790D1E6A502200B2859B /* router.cpp */, 671E790E1E6A502200B2859B /* router.hpp */, 671E790F1E6A502200B2859B /* way_point.hpp */, @@ -105,7 +99,6 @@ buildActionMask = 2147483647; files = ( 671E791D1E6A502200B2859B /* router.hpp in Headers */, - 671E791B1E6A502200B2859B /* road_type_checkers.hpp in Headers */, E92EE0821F98E8EC00B57D20 /* openlr_model_xml.hpp in Headers */, 671E79111E6A502200B2859B /* openlr_model.hpp in Headers */, 671E79191E6A502200B2859B /* road_info_getter.hpp in Headers */, @@ -178,7 +171,6 @@ 671E79181E6A502200B2859B /* road_info_getter.cpp in Sources */, 671E791C1E6A502200B2859B /* router.cpp in Sources */, E92EE0871F98E8EC00B57D20 /* openlr_decoder.cpp in Sources */, - 671E791A1E6A502200B2859B /* road_type_checkers.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };