diff --git a/generator/camera_info_collector.cpp b/generator/camera_info_collector.cpp index 0627270f5d..3cc003a9e4 100644 --- a/generator/camera_info_collector.cpp +++ b/generator/camera_info_collector.cpp @@ -24,7 +24,7 @@ CamerasInfoCollector::CamerasInfoCollector(std::string const & dataFilePath, std::string const & camerasInfoPath, std::string const & osmIdsToFeatureIdsPath) { - std::map> osmIdToFeatureIds; + routing::OsmIdToFeatureIds osmIdToFeatureIds; if (!routing::ParseRoadsOsmIdToFeatureIdMapping(osmIdsToFeatureIdsPath, osmIdToFeatureIds)) { LOG(LCRITICAL, ("An error happened while parsing feature id to osm ids mapping from file:", @@ -97,8 +97,7 @@ void CamerasInfoCollector::Serialize(FileWriter & writer) const } bool CamerasInfoCollector::ParseIntermediateInfo( - std::string const & camerasInfoPath, - std::map> const & osmIdToFeatureIds) + std::string const & camerasInfoPath, routing::OsmIdToFeatureIds const & osmIdToFeatureIds) { FileReader reader(camerasInfoPath); ReaderSource src(reader); diff --git a/generator/camera_info_collector.hpp b/generator/camera_info_collector.hpp index 83693157fa..4b67df8ae2 100644 --- a/generator/camera_info_collector.hpp +++ b/generator/camera_info_collector.hpp @@ -80,9 +80,8 @@ private: inline static double constexpr kMaxDistFromCameraToClosestSegmentMeters = 20.0; inline static double constexpr kSearchCameraRadiusMeters = 10.0; - bool ParseIntermediateInfo( - std::string const & camerasInfoPath, - std::map> const & osmIdToFeatureIds); + bool ParseIntermediateInfo(std::string const & camerasInfoPath, + routing::OsmIdToFeatureIds const & osmIdToFeatureIds); std::vector m_cameras; }; diff --git a/generator/metalines_builder.cpp b/generator/metalines_builder.cpp index a75c4bd2fc..6c4f4cfe60 100644 --- a/generator/metalines_builder.cpp +++ b/generator/metalines_builder.cpp @@ -225,7 +225,7 @@ void MetalinesBuilder::MergeInto(MetalinesBuilder & collector) const bool WriteMetalinesSection(std::string const & mwmPath, std::string const & metalinesPath, std::string const & osmIdsToFeatureIdsPath) { - std::map> osmIdToFeatureIds; + routing::OsmIdToFeatureIds osmIdToFeatureIds; if (!routing::ParseRoadsOsmIdToFeatureIdMapping(osmIdsToFeatureIdsPath, osmIdToFeatureIds)) return false; diff --git a/generator/restriction_collector.cpp b/generator/restriction_collector.cpp index 5e156d54e7..8039153b7d 100644 --- a/generator/restriction_collector.cpp +++ b/generator/restriction_collector.cpp @@ -314,7 +314,7 @@ bool RestrictionCollector::AddRestriction(m2::PointD const & coords, auto const result = m_osmIdToFeatureIds.find(osmIds[i]); if (result == m_osmIdToFeatureIds.cend()) { - // It could happens near mwm border when one of a restriction lines is not included in mwm + // It happens near mwm border when one of a restriction lines is not included in mwm // but the restriction is included. return false; } diff --git a/generator/restriction_collector.hpp b/generator/restriction_collector.hpp index 225df06a5d..36f40eb3db 100644 --- a/generator/restriction_collector.hpp +++ b/generator/restriction_collector.hpp @@ -1,6 +1,7 @@ #pragma once #include "generator/restriction_writer.hpp" +#include "generator/routing_helpers.hpp" #include "generator/routing_index_generator.hpp" #include "routing/index_graph.hpp" @@ -91,7 +92,7 @@ private: std::vector const & osmIds); std::vector m_restrictions; - std::map> m_osmIdToFeatureIds; + OsmIdToFeatureIds m_osmIdToFeatureIds; std::unique_ptr m_indexGraph; diff --git a/generator/road_access_generator.cpp b/generator/road_access_generator.cpp index 52ebe079b2..98803d1777 100644 --- a/generator/road_access_generator.cpp +++ b/generator/road_access_generator.cpp @@ -162,8 +162,7 @@ set const kHighwaysWhereIgnoreBarriersWithoutAccess = { {OsmElement::Tag("highway", "trunk_link")} }; -bool ParseRoadAccess(string const & roadAccessPath, - map> const & osmIdToFeatureIds, +bool ParseRoadAccess(string const & roadAccessPath, OsmIdToFeatureIds const & osmIdToFeatureIds, RoadAccessCollector::RoadAccessByVehicleType & roadAccessByVehicleType) { ifstream stream(roadAccessPath); @@ -264,8 +263,7 @@ bool ParseRoadAccess(string const & roadAccessPath, } void ParseRoadAccessConditional( - string const & roadAccessPath, - map> const & osmIdToFeatureIds, + string const & roadAccessPath, OsmIdToFeatureIds const & osmIdToFeatureIds, RoadAccessCollector::RoadAccessByVehicleType & roadAccessByVehicleType) { ifstream stream(roadAccessPath); @@ -648,7 +646,7 @@ void RoadAccessWriter::MergeInto(RoadAccessWriter & collector) const RoadAccessCollector::RoadAccessCollector(string const & dataFilePath, string const & roadAccessPath, string const & osmIdsToFeatureIdsPath) { - map> osmIdToFeatureIds; + OsmIdToFeatureIds osmIdToFeatureIds; if (!ParseRoadsOsmIdToFeatureIdMapping(osmIdsToFeatureIdsPath, osmIdToFeatureIds)) { LOG(LWARNING, ("An error happened while parsing feature id to osm ids mapping from file:", diff --git a/generator/routing_helpers.cpp b/generator/routing_helpers.cpp index 4f01a48e59..5a6cbe5f3d 100644 --- a/generator/routing_helpers.cpp +++ b/generator/routing_helpers.cpp @@ -27,14 +27,13 @@ bool ForEachRoadFromFile(string const & filename, ToDo && toDo) namespace routing { void AddFeatureId(base::GeoObjectId osmId, uint32_t featureId, - map> & osmIdToFeatureIds) + OsmIdToFeatureIds & osmIdToFeatureIds) { osmIdToFeatureIds[osmId].push_back(featureId); } -bool ParseRoadsOsmIdToFeatureIdMapping( - string const & osmIdsToFeatureIdPath, - map> & osmIdToFeatureIds) +bool ParseRoadsOsmIdToFeatureIdMapping(string const & osmIdsToFeatureIdPath, + OsmIdToFeatureIds & osmIdToFeatureIds) { return ForEachRoadFromFile(osmIdsToFeatureIdPath, [&](uint32_t featureId, base::GeoObjectId osmId) { diff --git a/generator/routing_helpers.hpp b/generator/routing_helpers.hpp index 9257c1c690..4eea6cb7fc 100644 --- a/generator/routing_helpers.hpp +++ b/generator/routing_helpers.hpp @@ -9,6 +9,8 @@ namespace routing { +using OsmIdToFeatureIds = std::map>; + // Adds |featureId| and corresponding |osmId| to |osmIdToFeatureId|. // Note. In general, one |featureId| may correspond to several osm ids. // Or on the contrary one osm id may correspond to several feature ids. It may happens for example @@ -16,7 +18,7 @@ namespace routing // As for road features a road |osmId| may correspond to several feature ids if // the |osmId| is split by a mini_roundabout or a turning_loop. void AddFeatureId(base::GeoObjectId osmId, uint32_t featureId, - std::map> & osmIdToFeatureIds); + OsmIdToFeatureIds & osmIdToFeatureIds); // Parses comma separated text file with line in following format: // , , , and so @@ -26,9 +28,8 @@ void AddFeatureId(base::GeoObjectId osmId, uint32_t featureId, // 138000, 5170209, 5143342, // 138001, 5170228, // 137999, 5170197, -bool ParseRoadsOsmIdToFeatureIdMapping( - std::string const & osmIdsToFeatureIdPath, - std::map> & osmIdToFeatureIds); +bool ParseRoadsOsmIdToFeatureIdMapping(std::string const & osmIdsToFeatureIdPath, + OsmIdToFeatureIds & osmIdToFeatureIds); bool ParseRoadsFeatureIdToOsmIdMapping(std::string const & osmIdsToFeatureIdPath, std::map & featureIdToOsmId); } // namespace routing