1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "generator/restriction_collector.hpp"
#include "generator/routing_index_generator.hpp"
#include <memory>
#include <string>
namespace routing
{
std::unique_ptr<RestrictionCollector>
CreateRestrictionCollectorAndParse(
std::string const & targetPath, std::string const & mwmPath, std::string const & country,
std::string const & restrictionPath, std::string const & osmIdsToFeatureIdsPath,
CountryParentNameGetterFn const & countryParentNameGetterFn);
void SerializeRestrictions(RestrictionCollector const & restrictionCollector,
std::string const & mwmPath);
// This function is the generator tool's interface to building the mwm
// section which contains road restrictions. (See https://wiki.openstreetmap.org/wiki/Restriction)
// As long as the restrictions are built later than the road features themselves
// during the generation process, we have to store a mapping between osm ids and feature ids:
// the restrictions are written in OSM terms while for the road features only their feature ids
// are known.
// This results in the following pipeline:
// -- OsmToFeatureTranslator uses RestrictionsWriter to prepare a .csv file
// with restrictions in terms of OSM ids while parsing the OSM source.
// -- OsmID2FeatureID saves the OSM id -> feature id mapping.
// -- After all features have been created, RestrictionCollector reads the csv
// and builds the mwm section with restrictions. The serialization/deserialization
// code is in the routing library.
/// \brief Builds section with road restrictions.
/// \param mwmPath path to mwm which will be added with road restriction section.
/// \param restrictionPath comma separated (csv like) file with road restrictions in osm ids terms
/// in the following format:
/// <type of restrictions>, <osm id 1 of the restriction>, <osm id 2>, and so on
/// For example:
/// Only, 335049632, 49356687,
/// No, 157616940, 157616940,
/// \param osmIdsToFeatureIdsPath a binary file with mapping form osm ids to feature ids.
/// One osm id is mapped to one feature id. The file should be saved with the help of
/// OsmID2FeatureID class or using a similar way.
bool BuildRoadRestrictions(std::string const & targetPath,
std::string const & mwmPath,
std::string const & country,
std::string const & restrictionPath,
std::string const & osmIdsToFeatureIdsPath,
CountryParentNameGetterFn const & countryParentNameGetterFn);
} // namespace routing
|