From e3891524042c90421e94d6b80a84e3dcc1cfb013 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Tue, 9 Apr 2024 20:17:13 +0300 Subject: [PATCH] [generator] Add comments to DetermineSurface() Signed-off-by: Konstantin Pastbin --- generator/osm2type.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 6bbf3a5a71..7d7676d976 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -582,7 +582,7 @@ string DetermineSurface(OsmElement * p) surface = tag.m_value; else if (tag.m_key == "smoothness") smoothness = tag.m_value; - else if (tag.m_key == "surface:grade") + else if (tag.m_key == "surface:grade") // discouraged, 25k usages as of 2024 (void)strings::to_double(tag.m_value, surfaceGrade); else if (tag.m_key == "tracktype") trackGrade = tag.m_value; @@ -601,6 +601,7 @@ string DetermineSurface(OsmElement * p) "metal", "paved", "paving_stones", "sett", "unhewn_cobblestone", "wood" }; + // All not explicitly listed surface types are considered unpaved good, e.g. "compacted", "fine_gravel". static base::StringIL badSurfaces = { "cobblestone", "dirt", "earth", "grass", "gravel", "ground", "metal", "mud", "rock", "unpaved", "pebblestone", "sand", "sett", "snow", "stepping_stones", "unhewn_cobblestone", "wood", "woodchips" @@ -623,6 +624,7 @@ string DetermineSurface(OsmElement * p) auto const Has = [](base::StringIL const & il, string const & v) { bool res = false; + // Also matches compound values like concrete:plates, sand/dirt, etc. if a single part matches. strings::Tokenize(v, ";:/", [&il, &res](std::string_view sv) { if (!res)