1 #ifndef OSMIUM_AREA_ASSEMBLER_HPP 2 #define OSMIUM_AREA_ASSEMBLER_HPP 41 #include <osmium/area/detail/basic_assembler_with_tags.hpp> 42 #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) {
124 if (!config().create_way_polygons) {
128 if (config().problem_reporter) {
130 config().problem_reporter->set_nodes(way.
nodes().
size());
135 ++stats().short_ways;
140 ++stats().duplicate_nodes;
141 if (config().problem_reporter) {
147 stats().invalid_locations = segment_list().extract_segments_from_way(config().problem_reporter,
148 stats().duplicate_nodes,
150 if (!config().ignore_invalid_locations && stats().invalid_locations > 0) {
154 if (config().debug_level > 0) {
155 std::cerr <<
"\nAssembling way " << way.
id() <<
" containing " << segment_list().size() <<
" nodes\n";
168 std::cerr <<
"Done: " << stats() <<
"\n";
182 if (!config().create_new_style_polygons) {
188 if (config().problem_reporter) {
193 ++stats().no_way_in_mp_relation;
197 ++stats().from_relations;
198 stats().invalid_locations = segment_list().extract_segments_from_ways(config().problem_reporter,
199 stats().duplicate_nodes,
200 stats().duplicate_ways,
203 if (!config().ignore_invalid_locations && stats().invalid_locations > 0) {
206 stats().member_ways = members.size();
208 if (stats().member_ways == 1) {
209 ++stats().single_way_in_mp_relation;
212 if (config().debug_level > 0) {
213 std::cerr <<
"\nAssembling relation " << relation.
id() <<
" containing " << members.size() <<
" way members with " << segment_list().size() <<
" nodes\n";
218 bool okay =
create_area(out_buffer, relation, members);
234 #endif // OSMIUM_AREA_ASSEMBLER_HPP WayNodeList & nodes()
Definition: way.hpp:89
std::size_t commit()
Definition: buffer.hpp:355
bool operator()(const osmium::Way &way, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:123
const TagList & tags() const
Get the list of tags for this object.
Definition: object.hpp:325
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:65
~Assembler() noexcept=default
bool operator()(const osmium::Relation &relation, const std::vector< const osmium::Way *> &members, osmium::memory::Buffer &out_buffer)
Definition: assembler.hpp:181
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:79
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:126
bool ends_have_same_id() const
Definition: way.hpp:116
Definition: buffer.hpp:98
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:371
size_type size() const noexcept
Definition: node_ref_list.hpp:83
Definition: osm_object_builder.hpp:540