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 {
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());
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());
132 if (way.nodes().size() < 2) {
133 ++stats().short_ways;
137 if (!way.ends_have_same_id()) {
138 ++stats().duplicate_nodes;
139 if (config().problem_reporter) {
140 config().problem_reporter->report_duplicate_node(way.nodes().front().ref(), way.nodes().back().ref(), way.nodes().front().location());
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";
162 out_buffer.rollback();
166 std::cerr <<
"Done: " << stats() <<
"\n";
180 if (!config().create_new_style_polygons) {
184 assert(relation.cmembers().size() >= members.size());
186 if (config().problem_reporter) {
190 if (relation.members().empty()) {
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 const bool okay =
create_area(out_buffer, relation, members);
220 out_buffer.rollback();
Definition: relation.hpp:161
Definition: assembler.hpp:61
bool create_area(osmium::memory::Buffer &out_buffer, const osmium::Relation &relation, const std::vector< const osmium::Way * > &members)
Definition: assembler.hpp:82
bool operator()(const osmium::Way &way, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:121
bool create_area(osmium::memory::Buffer &out_buffer, const osmium::Way &way)
Definition: assembler.hpp:63
Assembler(const config_type &config)
Definition: assembler.hpp:110
bool operator()(const osmium::Relation &relation, const std::vector< const osmium::Way * > &members, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:179
Definition: osm_object_builder.hpp:567
void initialize_from_object(const osmium::OSMObject &source)
Definition: osm_object_builder.hpp:584
@ area
Definition: entity_bits.hpp:72
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53