Skip to content

Commit ce20da2

Browse files
authored
Merge pull request #1593 from joto/libosmium-update
Libosmium update
2 parents 0a1a458 + b6c4cac commit ce20da2

File tree

88 files changed

+789
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+789
-395
lines changed

cmake/FindOsmium.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
# geos - include if you want to use any of the GEOS functions
3434
# gdal - include if you want to use any of the OGR functions
3535
# proj - include if you want to use any of the Proj.4 functions
36-
# sparsehash - include if you use the sparsehash index
36+
# sparsehash - include if you use the sparsehash index (deprecated!)
37+
# lz4 - include support for LZ4 compression of PBF files
3738
#
3839
# You can check for success with something like this:
3940
#
@@ -116,14 +117,21 @@ if(Osmium_USE_PBF)
116117
find_package(Threads)
117118
find_package(Protozero 1.6.3)
118119

120+
if(Osmium_USE_LZ4)
121+
find_package(LZ4 REQUIRED)
122+
add_definitions(-DOSMIUM_WITH_LZ4)
123+
endif()
124+
119125
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
120126
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_FOUND)
121127
list(APPEND OSMIUM_PBF_LIBRARIES
122128
${ZLIB_LIBRARIES}
129+
${LZ4_LIBRARIES}
123130
${CMAKE_THREAD_LIBS_INIT}
124131
)
125132
list(APPEND OSMIUM_INCLUDE_DIRS
126133
${ZLIB_INCLUDE_DIR}
134+
${LZ4_INCLUDE_DIRS}
127135
${PROTOZERO_INCLUDE_DIR}
128136
)
129137
else()
@@ -216,6 +224,7 @@ endif()
216224
#----------------------------------------------------------------------
217225
# Component 'sparsehash'
218226
if(Osmium_USE_SPARSEHASH)
227+
message(WARNING "Osmium: Use of Google SparseHash is deprecated. Please switch to a different index type.")
219228
find_path(SPARSEHASH_INCLUDE_DIR google/sparsetable)
220229

221230
list(APPEND OSMIUM_EXTRA_FIND_VARS SPARSEHASH_INCLUDE_DIR)

contrib/libosmium/README.contrib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Source: https://github.com/osmcode/libosmium
2-
Revision: v2.17.0
2+
Revision: v2.17.2

contrib/libosmium/include/osmium/area/assembler_legacy.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,11 @@ namespace osmium {
336336
osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend());
337337
osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend());
338338
osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend());
339-
340-
if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin) || d != std::distance(area_fi_begin, area_fi_end)) {
339+
#ifdef __cpp_lib_robust_nonmodifying_seq_ops
340+
if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin, area_fi_end)) {
341+
#else
342+
if (d != std::distance(area_fi_begin, area_fi_end) || !std::equal(way_fi_begin, way_fi_end, area_fi_begin)) {
343+
#endif
341344
ways_that_should_be_areas.push_back(&way);
342345
} else {
343346
++stats().inner_with_same_tags;

contrib/libosmium/include/osmium/area/detail/basic_assembler.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace osmium {
196196
++m_stats.wrong_role;
197197
if (debug()) {
198198
std::cerr << " Segment " << *segment << " from way " << segment->way()->id() << " has role '" << segment->role_name()
199-
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
199+
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
200200
}
201201
if (m_config.problem_reporter) {
202202
if (ring.is_outer()) {
@@ -326,7 +326,7 @@ namespace osmium {
326326
const int64_t ay = a.y();
327327
const int64_t by = b.y();
328328
const int64_t ly = end_location.y();
329-
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
329+
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);
330330
if (debug()) {
331331
std::cerr << " Segment z=" << z << '\n';
332332
}
@@ -353,7 +353,7 @@ namespace osmium {
353353
const int64_t ay = a.y();
354354
const int64_t by = b.y();
355355
const int64_t ly = location.y();
356-
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
356+
const auto z = (bx - ax) * (ly - ay) - (by - ay) * (lx - ax);
357357

358358
if (z >= 0) {
359359
nesting += segment->is_reverse() ? -1 : 1;
@@ -593,7 +593,7 @@ namespace osmium {
593593
}
594594
++m_stats.open_rings;
595595
} else {
596-
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location )) {
596+
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location)) {
597597
m_split_locations.push_back(previous_location);
598598
}
599599
++it;
@@ -696,7 +696,7 @@ namespace osmium {
696696
}
697697

698698
bool there_are_open_rings() const noexcept {
699-
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
699+
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
700700
return !ring.closed();
701701
});
702702
}
@@ -907,11 +907,11 @@ namespace osmium {
907907
auto count_remaining = m_segment_list.size();
908908
for (const osmium::Location& location : m_split_locations) {
909909
const auto locs = make_range(std::equal_range(m_locations.begin(),
910-
m_locations.end(),
911-
slocation{},
912-
[this, &location](const slocation& lhs, const slocation& rhs) {
913-
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
914-
}));
910+
m_locations.end(),
911+
slocation{},
912+
[this, &location](const slocation& lhs, const slocation& rhs) {
913+
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
914+
}));
915915
for (auto& loc : locs) {
916916
if (!m_segment_list[loc.item].is_done()) {
917917
count_remaining -= add_new_ring_complex(loc);
@@ -1152,7 +1152,7 @@ namespace osmium {
11521152
timer_roles.stop();
11531153
}
11541154

1155-
m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
1155+
m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
11561156
return ring.is_outer();
11571157
});
11581158
m_stats.inner_rings = m_rings.size() - m_stats.outer_rings;

contrib/libosmium/include/osmium/area/detail/basic_assembler_with_tags.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ namespace osmium {
5656
return false;
5757
}
5858
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;
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;
6666
}
6767

6868
static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {

contrib/libosmium/include/osmium/area/detail/node_ref_segment.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ namespace osmium {
192192
}
193193

194194
const char* role_name() const noexcept {
195-
static const std::array<const char*, 4> names = {{ "unknown", "outer", "inner", "empty" }};
195+
static const std::array<const char*, 4> names = {{"unknown", "outer", "inner", "empty"}};
196196
return names[int(m_role)];
197197
}
198198

@@ -219,7 +219,7 @@ namespace osmium {
219219
}
220220

221221
inline bool operator!=(const NodeRefSegment& lhs, const NodeRefSegment& rhs) noexcept {
222-
return ! (lhs == rhs);
222+
return !(lhs == rhs);
223223
}
224224

225225
/**
@@ -346,9 +346,9 @@ namespace osmium {
346346
};
347347

348348
std::array<seg_loc, 4> sl = {{
349-
{0, s1.first().location() },
349+
{0, s1.first().location()},
350350
{0, s1.second().location()},
351-
{1, s2.first().location() },
351+
{1, s2.first().location()},
352352
{1, s2.second().location()},
353353
}};
354354

contrib/libosmium/include/osmium/area/detail/segment_list.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ namespace osmium {
296296
}
297297
}
298298

299-
if (it+2 != m_segments.end() && *it == *(it+2)) {
299+
if (it + 2 != m_segments.end() && *it == *(it + 2)) {
300300
++overlapping_segments;
301301
if (problem_reporter) {
302302
problem_reporter->report_overlapping_segment(it->first(), it->second());
303303
}
304304
}
305305

306-
m_segments.erase(it, it+2);
306+
m_segments.erase(it, it + 2);
307307
}
308308
}
309309

@@ -323,7 +323,7 @@ namespace osmium {
323323

324324
for (auto it1 = m_segments.cbegin(); it1 != m_segments.cend() - 1; ++it1) {
325325
const NodeRefSegment& s1 = *it1;
326-
for (auto it2 = it1+1; it2 != m_segments.end(); ++it2) {
326+
for (auto it2 = it1 + 1; it2 != m_segments.end(); ++it2) {
327327
const NodeRefSegment& s2 = *it2;
328328

329329
assert(s1 != s2); // erase_duplicate_segments() should have made sure of that

contrib/libosmium/include/osmium/area/problem_reporter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace osmium {
8080
ProblemReporter(ProblemReporter&&) noexcept = default;
8181
ProblemReporter& operator=(ProblemReporter&&) noexcept = default;
8282

83-
virtual ~ProblemReporter() = default;
83+
virtual ~ProblemReporter() noexcept = default;
8484

8585
/**
8686
* Set the object the next problem reports will be on.

contrib/libosmium/include/osmium/area/problem_reporter_ogr.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,21 @@ namespace osmium {
117117
.add_field("nodes", OFTInteger, 8)
118118
.add_field("id1", OFTReal, 12, 1)
119119
.add_field("id2", OFTReal, 12, 1)
120-
.add_field("problem", OFTString, 30)
121-
;
120+
.add_field("problem", OFTString, 30);
122121

123122
m_layer_lerror
124123
.add_field("obj_type", OFTString, 1)
125124
.add_field("obj_id", OFTInteger, 10)
126125
.add_field("nodes", OFTInteger, 8)
127126
.add_field("id1", OFTReal, 12, 1)
128127
.add_field("id2", OFTReal, 12, 1)
129-
.add_field("problem", OFTString, 30)
130-
;
128+
.add_field("problem", OFTString, 30);
131129

132130
m_layer_ways
133131
.add_field("obj_type", OFTString, 1)
134132
.add_field("obj_id", OFTInteger, 10)
135133
.add_field("way_id", OFTInteger, 10)
136-
.add_field("nodes", OFTInteger, 8)
137-
;
134+
.add_field("nodes", OFTInteger, 8);
138135
}
139136

140137
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {

contrib/libosmium/include/osmium/builder/attr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ namespace osmium {
288288
}
289289

290290
member_type_string(char type, osmium::object_id_type ref, std::string&& role) noexcept :
291-
member_type_string(osmium::char_to_item_type(type), ref, std::forward<std::string>(role)) {
291+
member_type_string(osmium::char_to_item_type(type), ref, std::move(role)) {
292292
}
293293

294294
osmium::item_type type() const noexcept {

0 commit comments

Comments
 (0)