1 #ifndef OSMIUM_AREA_DETAIL_BASIC_ASSEMBLER_WITH_TAGS_HPP
2 #define OSMIUM_AREA_DETAIL_BASIC_ASSEMBLER_WITH_TAGS_HPP
3 
4 /*
5 
6 This file is part of Osmium (https://osmcode.org/libosmium).
7 
8 Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
9 
10 Boost Software License - Version 1.0 - August 17th, 2003
11 
12 Permission is hereby granted, free of charge, to any person or organization
13 obtaining a copy of the software and accompanying documentation covered by
14 this license (the "Software") to use, reproduce, display, distribute,
15 execute, and transmit the Software, and to prepare derivative works of the
16 Software, and to permit third-parties to whom the Software is furnished to
17 do so, all subject to the following:
18 
19 The copyright notices in the Software and this entire statement, including
20 the above license grant, this restriction and the following disclaimer,
21 must be included in all copies of the Software, in whole or in part, and
22 all derivative works of the Software, unless such copies or derivative
23 works are solely in the form of machine-executable object code generated by
24 a source language processor.
25 
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 DEALINGS IN THE SOFTWARE.
33 
34 */
35 
36 #include <osmium/area/assembler_config.hpp>
37 #include <osmium/area/detail/basic_assembler.hpp>
38 #include <osmium/area/stats.hpp>
39 #include <osmium/builder/osm_object_builder.hpp>
40 #include <osmium/osm/tag.hpp>
41 
42 #include <cstring>
43 
44 namespace osmium {
45 
46     namespace area {
47 
48         namespace detail {
49 
50             class BasicAssemblerWithTags : public detail::BasicAssembler {
51 
52             protected:
53 
report_ways() const54                 bool report_ways() const noexcept {
55                     if (!config().problem_reporter) {
56                         return false;
57                     }
58                     return stats().duplicate_nodes ||
59                         stats().duplicate_segments ||
60                         stats().intersections ||
61                         stats().open_rings ||
62                         stats().short_ways ||
63                         stats().touching_rings ||
64                         stats().ways_in_multiple_rings ||
65                         stats().wrong_role;
66                 }
67 
copy_tags_without_type(osmium::builder::AreaBuilder & builder,const osmium::TagList & tags)68                 static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {
69                     osmium::builder::TagListBuilder tl_builder{builder};
70                     for (const osmium::Tag& tag : tags) {
71                         if (std::strcmp(tag.key(), "type") != 0) {
72                             tl_builder.add_tag(tag.key(), tag.value());
73                         }
74                     }
75                 }
76 
77             public:
78 
79                 using config_type = osmium::area::AssemblerConfig;
80 
BasicAssemblerWithTags(const config_type & config)81                 explicit BasicAssemblerWithTags(const config_type& config) :
82                     BasicAssembler(config) {
83                 }
84 
85             }; // class BasicAssemblerWithTags
86 
87         } // namespace detail
88 
89     } // namespace area
90 
91 } // namespace osmium
92 
93 #endif // OSMIUM_AREA_DETAIL_BASIC_ASSEMBLER_WITH_TAGS_HPP
94