Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
stats.hpp
Go to the documentation of this file.
1#ifndef OSMIUM_AREA_STATS_HPP
2#define OSMIUM_AREA_STATS_HPP
3
4/*
5
6This file is part of Osmium (https://osmcode.org/libosmium).
7
8Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
9
10Boost Software License - Version 1.0 - August 17th, 2003
11
12Permission is hereby granted, free of charge, to any person or organization
13obtaining a copy of the software and accompanying documentation covered by
14this license (the "Software") to use, reproduce, display, distribute,
15execute, and transmit the Software, and to prepare derivative works of the
16Software, and to permit third-parties to whom the Software is furnished to
17do so, all subject to the following:
18
19The copyright notices in the Software and this entire statement, including
20the above license grant, this restriction and the following disclaimer,
21must be included in all copies of the Software, in whole or in part, and
22all derivative works of the Software, unless such copies or derivative
23works are solely in the form of machine-executable object code generated by
24a source language processor.
25
26THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32DEALINGS IN THE SOFTWARE.
33
34*/
35
36#include <cstdint>
37#include <ostream>
38
39namespace osmium {
40
41 namespace area {
42
49 struct area_stats {
51 uint64_t area_simple_case = 0;
53 uint64_t duplicate_nodes = 0;
54 uint64_t duplicate_segments = 0;
55 uint64_t duplicate_ways = 0;
56 uint64_t from_relations = 0;
57 uint64_t from_ways = 0;
58 uint64_t inner_rings = 0;
59 uint64_t inner_with_same_tags = 0;
60 uint64_t intersections = 0;
61 uint64_t member_ways = 0;
62 uint64_t no_tags_on_relation = 0;
63 uint64_t no_way_in_mp_relation = 0;
64 uint64_t nodes = 0;
65 uint64_t open_rings = 0;
66 uint64_t outer_rings = 0;
67 uint64_t overlapping_segments = 0;
68 uint64_t short_ways = 0;
70 uint64_t touching_rings = 0;
72 uint64_t wrong_role = 0;
73 uint64_t invalid_locations = 0;
74
75 area_stats& operator+=(const area_stats& other) noexcept {
76 area_really_complex_case += other.area_really_complex_case;
77 area_simple_case += other.area_simple_case;
78 area_touching_rings_case += other.area_touching_rings_case;
79 duplicate_nodes += other.duplicate_nodes;
80 duplicate_segments += other.duplicate_segments;
81 duplicate_ways += other.duplicate_ways;
82 from_relations += other.from_relations;
83 from_ways += other.from_ways;
84 inner_rings += other.inner_rings;
85 inner_with_same_tags += other.inner_with_same_tags;
86 intersections += other.intersections;
87 member_ways += other.member_ways;
88 no_tags_on_relation += other.no_tags_on_relation;
89 no_way_in_mp_relation += other.no_way_in_mp_relation;
90 nodes += other.nodes;
91 open_rings += other.open_rings;
92 outer_rings += other.outer_rings;
93 short_ways += other.short_ways;
94 single_way_in_mp_relation += other.single_way_in_mp_relation;
95 touching_rings += other.touching_rings;
96 ways_in_multiple_rings += other.ways_in_multiple_rings;
97 wrong_role += other.wrong_role;
99 return *this;
100 }
101
102 }; // struct area_stats
103
104 template <typename TChar, typename TTraits>
105 inline std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const area_stats& s) {
106 return out << " area_really_complex_case=" << s.area_really_complex_case
107 << " area_simple_case=" << s.area_simple_case
108 << " area_touching_rings_case=" << s.area_touching_rings_case
109 << " duplicate_nodes=" << s.duplicate_nodes
110 << " duplicate_segments=" << s.duplicate_segments
111 << " duplicate_ways=" << s.duplicate_ways
112 << " from_relations=" << s.from_relations
113 << " from_ways=" << s.from_ways
114 << " inner_rings=" << s.inner_rings
115 << " inner_with_same_tags=" << s.inner_with_same_tags
116 << " intersections=" << s.intersections
117 << " member_ways=" << s.member_ways
118 << " no_tags_on_relation=" << s.no_tags_on_relation
119 << " no_way_in_mp_relation=" << s.no_way_in_mp_relation
120 << " nodes=" << s.nodes
121 << " open_rings=" << s.open_rings
122 << " outer_rings=" << s.outer_rings
123 << " short_ways=" << s.short_ways
124 << " single_way_in_mp_relation=" << s.single_way_in_mp_relation
125 << " touching_rings=" << s.touching_rings
126 << " ways_in_multiple_rings=" << s.ways_in_multiple_rings
127 << " wrong_role=" << s.wrong_role
128 << " invalid_locations=" << s.invalid_locations;
129 }
130
131 } // namespace area
132
133} // namespace osmium
134
135#endif // OSMIUM_AREA_STATS_HPP
std::basic_ostream< TChar, TTraits > & operator<<(std::basic_ostream< TChar, TTraits > &out, const area_stats &s)
Definition: stats.hpp:105
@ area
Definition: entity_bits.hpp:72
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
Definition: stats.hpp:49
uint64_t invalid_locations
Invalid location found.
Definition: stats.hpp:73
uint64_t duplicate_ways
Ways that are in relation more than once.
Definition: stats.hpp:55
uint64_t touching_rings
Rings touching in a node.
Definition: stats.hpp:70
uint64_t from_ways
Area created from way.
Definition: stats.hpp:57
uint64_t inner_rings
Number of inner rings.
Definition: stats.hpp:58
uint64_t intersections
Number of intersections between segments.
Definition: stats.hpp:60
uint64_t area_simple_case
Simple case, no touching rings.
Definition: stats.hpp:51
area_stats & operator+=(const area_stats &other) noexcept
Definition: stats.hpp:75
uint64_t duplicate_segments
Segments duplicated (going back and forth)
Definition: stats.hpp:54
uint64_t nodes
Number of nodes in the area.
Definition: stats.hpp:64
uint64_t ways_in_multiple_rings
Different segments of a way ended up in different rings.
Definition: stats.hpp:71
uint64_t duplicate_nodes
Consecutive identical nodes or consecutive nodes with same location.
Definition: stats.hpp:53
uint64_t single_way_in_mp_relation
Multipolygon relation containing a single way.
Definition: stats.hpp:69
uint64_t inner_with_same_tags
Number of inner ways with same tags as area.
Definition: stats.hpp:59
uint64_t open_rings
Number of open rings in the area.
Definition: stats.hpp:65
uint64_t no_tags_on_relation
No tags on relation (old-style multipolygon with tags on outer ways)
Definition: stats.hpp:62
uint64_t short_ways
Number of ways with less than two nodes.
Definition: stats.hpp:68
uint64_t area_touching_rings_case
More difficult case with touching rings.
Definition: stats.hpp:52
uint64_t area_really_complex_case
Most difficult case with rings touching in multiple points.
Definition: stats.hpp:50
uint64_t no_way_in_mp_relation
Multipolygon relation with no way members.
Definition: stats.hpp:63
uint64_t outer_rings
Number of outer rings in the area.
Definition: stats.hpp:66
uint64_t member_ways
Number of ways in the area.
Definition: stats.hpp:61
uint64_t wrong_role
Member has wrong role (not "outer", "inner", or empty)
Definition: stats.hpp:72
uint64_t overlapping_segments
Three or more segments with same end points.
Definition: stats.hpp:67
uint64_t from_relations
Area created from multipolygon relation.
Definition: stats.hpp:56