Welcome to mirror list, hosted at ThFree Co, Russian Federation.

maxspeeds_parser.hpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 790f8d4590129fabec7b7f18c769622204d96bc6 (plain)
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
#pragma once

#include "routing_common/maxspeed_conversion.hpp"

#include "platform/measurement_utils.hpp"

#include <cstdint>
#include <string>

namespace generator
{
/// \brief Obtains |speed| and |units| by road category based on
/// the table at https://wiki.openstreetmap.org/wiki/Speed_limits
/// This function should be updated regularly. Last update: 23.10.18.
/// \returns true if |speed| and |units| is found for |category| and these fields are filled
/// and false otherwise.
/// \note For example by passing string "RU:urban", you'll get
/// speed = 60 and units = Units::Metric.
/// \note If the method returns true the field |speed| may be filled with |kNoneMaxSpeed| value.
/// It means no speed limits for the |category|. It is currently the case for some road categories
/// in Germany.
bool RoadCategoryToSpeed(std::string const & category, routing::SpeedInUnits & speed);

/// \brief Tries to convert the value of tag maxspeed to speed in appropriate units.
/// \returns false in case of error and true if the conversion is successful.
/// \note speed.m_speed will be filled with kNoneMaxSpeed or kWalkMaxSpeed if
/// maxspeedValue is equal to "none" or "walk". The value of speed.m_units does not
/// matter in this case.
bool ParseMaxspeedTag(std::string const & maxspeedValue, routing::SpeedInUnits & speed);

std::string UnitsToString(measurement_utils::Units units);

/// \brief Converts string to measurement_utils::Units.
/// \note |units| should be "Metric" or "Imperial".
measurement_utils::Units StringToUnits(std::string const & units);
}  // namespace generator