diff --git a/generator/statistics.cpp b/generator/statistics.cpp index 9e0bd9e3f1..3f41ae01a0 100644 --- a/generator/statistics.cpp +++ b/generator/statistics.cpp @@ -244,14 +244,16 @@ namespace stats os << "\n"; } + /// @note If you gonna change this function, take into account + /// ./tools/python/maps_generator/generator/statistics.py void PrintTypeStats(std::ostream & os, MapInfo & info) { os << "Feature stats by Classificator Type\n" << "(a single feature can contain several types and thus its size can be included in several type lines)\n"; - for (auto it = info.m_byClassifType.begin(); it != info.m_byClassifType.end(); ++it) - { - PrintInfo(os, GetKey(it->first), it->second, 30, true, true); - } + + for (auto const & e : info.m_byClassifType) + PrintInfo(os, GetKey(e.first), e.second, 30, true, true); + os << "\n"; } diff --git a/tools/python/maps_generator/generator/statistics.py b/tools/python/maps_generator/generator/statistics.py index 2a32769345..ea639598c2 100644 --- a/tools/python/maps_generator/generator/statistics.py +++ b/tools/python/maps_generator/generator/statistics.py @@ -13,13 +13,14 @@ from maps_generator.generator.exceptions import ParseError logger = logging.getLogger("maps_generator") +# Parse entries, written by ./generator/statistics.cpp PrintTypeStats. RE_STAT = re.compile( - r"(?:\d+\. )?([\w:|-]+?)\|: " - r"size = \d+; " - r"count = (\d+); " - r"length = ([0-9.e+-]+) m; " - r"area = ([0-9.e+-]+) m²; " - r"names = (\d+)\s*" + r"([\w:-]+): " + r"size = +\d+; " + r"features = +(\d+); " + r"length = +([0-9.e+-]+) m; " + r"area = +([0-9.e+-]+) m²; " + r"w\/names = +(\d+)" ) RE_TIME_DELTA = re.compile( @@ -37,9 +38,13 @@ def read_stat(f): stats = [] for line in f: m = RE_STAT.match(line) + # Skip explanation header strings. + if m is None: + continue + stats.append( { - "name": m.group(1).replace("|", "-"), + "name": m.group(1), "cnt": int(m.group(2)), "len": float(m.group(3)), "area": float(m.group(4)),