1 #ifndef OSMIUM_AREA_ASSEMBLER_HPP 2 #define OSMIUM_AREA_ASSEMBLER_HPP 37 #include <osmium/area/detail/basic_assembler_with_tags.hpp> 38 #include <osmium/area/detail/segment_list.hpp> 61 class Assembler :
public detail::BasicAssemblerWithTags {
65 builder.initialize_from_object(way);
67 const bool area_okay = create_rings();
68 if (area_okay || config().create_empty_areas) {
69 builder.add_item(way.
tags());
72 add_rings_to_area(builder);
76 config().problem_reporter->report_way(way);
79 return area_okay || config().create_empty_areas;
83 set_num_members(members.size());
85 builder.initialize_from_object(relation);
87 const bool area_okay = create_rings();
88 if (area_okay || config().create_empty_areas) {
89 if (config().keep_type_tag) {
90 builder.add_item(relation.
tags());
92 copy_tags_without_type(builder, relation.
tags());
96 add_rings_to_area(builder);
101 config().problem_reporter->report_way(*way);
105 return area_okay || config().create_empty_areas;
111 detail::BasicAssemblerWithTags(config) {
122 if (!config().create_way_polygons) {
126 if (config().problem_reporter) {
128 config().problem_reporter->set_nodes(way.
nodes().
size());
133 ++stats().short_ways;
138 ++stats().duplicate_nodes;
139 if (config().problem_reporter) {
145 stats().invalid_locations = segment_list().extract_segments_from_way(config().problem_reporter,
146 stats().duplicate_nodes,
148 if (!config().ignore_invalid_locations && stats().invalid_locations > 0) {
152 if (config().debug_level > 0) {
153 std::cerr <<
"\nAssembling way " << way.
id() <<
" containing " << segment_list().size() <<
" nodes\n";
166 std::cerr <<
"Done: " << stats() <<
"\n";
180 if (!config().create_new_style_polygons) {
186 if (config().problem_reporter) {
191 ++stats().no_way_in_mp_relation;
195 ++stats().from_relations;
196 stats().invalid_locations = segment_list().extract_segments_from_ways(config().problem_reporter,
197 stats().duplicate_nodes,
198 stats().duplicate_ways,
201 if (!config().ignore_invalid_locations && stats().invalid_locations > 0) {
204 stats().member_ways = members.size();
206 if (stats().member_ways == 1) {
207 ++stats().single_way_in_mp_relation;
210 if (config().debug_level > 0) {
211 std::cerr <<
"\nAssembling relation " << relation.
id() <<
" containing " << members.size() <<
" way members with " << segment_list().size() <<
" nodes\n";
216 bool okay =
create_area(out_buffer, relation, members);
232 #endif // OSMIUM_AREA_ASSEMBLER_HPP WayNodeList & nodes()
Definition: way.hpp:89
std::size_t commit()
Definition: buffer.hpp:468
bool operator()(const osmium::Way &way, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:121
const TagList & tags() const
Get the list of tags for this object.
Definition: object.hpp:332
bool ends_have_same_id() const noexcept
Definition: way.hpp:129
RelationMemberList & members()
Get a reference to the member list.
Definition: relation.hpp:186
Definition: relation.hpp:168
const RelationMemberList & cmembers() const
Get a const reference to the member list.
Definition: relation.hpp:196
Definition: entity_bits.hpp:72
size_type size() const noexcept
Definition: collection.hpp:152
bool create_area(osmium::memory::Buffer &out_buffer, const osmium::Way &way)
Definition: assembler.hpp:63
constexpr osmium::object_id_type ref() const noexcept
Definition: node_ref.hpp:71
bool operator()(const osmium::Relation &relation, const std::vector< const osmium::Way *> &members, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:179
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
bool empty() const noexcept
Definition: collection.hpp:143
Assembler(const config_type &config)
Definition: assembler.hpp:110
osmium::Location & location() noexcept
Definition: node_ref.hpp:85
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:122
Definition: buffer.hpp:97
bool create_area(osmium::memory::Buffer &out_buffer, const osmium::Relation &relation, const std::vector< const osmium::Way *> &members)
Definition: assembler.hpp:82
const NodeRef & front() const noexcept
Definition: node_ref_list.hpp:126
const NodeRef & back() const noexcept
Definition: node_ref_list.hpp:138
Definition: assembler.hpp:61
void rollback()
Definition: buffer.hpp:484
size_type size() const noexcept
Definition: node_ref_list.hpp:83
Definition: osm_object_builder.hpp:570