Skip to content

Commit ede49f5

Browse files
committed
update libosmium to v2.15.2
1 parent ccbe25c commit ede49f5

Some content is hidden

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

51 files changed

+349
-146
lines changed

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.15.1
2+
Revision: v2.15.2

contrib/libosmium/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A fast and flexible C++ library for working with OpenStreetMap data.
77
Libosmium works on Linux, Mac OSX and Windows.
88

99
[![Travis Build Status](https://secure.travis-ci.org/osmcode/libosmium.svg)](https://travis-ci.org/osmcode/libosmium)
10-
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/ep07l3x5rk3hd8sp/branch/master?svg=true)](https://ci.appveyor.com/project/lonvia/libosmium/branch/master)
10+
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/yy099a4vxcb604rn/branch/master?svg=true)](https://ci.appveyor.com/project/lonvia/libosmium-eq41p/branch/master)
1111
[![Coverage Status](https://codecov.io/gh/osmcode/libosmium/branch/master/graph/badge.svg)](https://codecov.io/gh/osmcode/libosmium)
1212
[![Packaging status](https://repology.org/badge/tiny-repos/libosmium.svg)](https://repology.org/metapackage/libosmium)
1313

contrib/libosmium/osmium/area/assembler_legacy.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ namespace osmium {
7272
*/
7373
class AssemblerLegacy : public detail::BasicAssemblerWithTags {
7474

75-
void add_tags_to_area(osmium::builder::AreaBuilder& builder, const osmium::Way& way) const {
76-
builder.add_item(way.tags());
77-
}
78-
7975
void add_common_tags(osmium::builder::TagListBuilder& tl_builder, std::set<const osmium::Way*>& ways) const {
8076
std::map<std::string, std::size_t> counter;
8177
for (const osmium::Way* way : ways) {
@@ -166,7 +162,7 @@ namespace osmium {
166162

167163
const bool area_okay = create_rings();
168164
if (area_okay || config().create_empty_areas) {
169-
add_tags_to_area(builder, way);
165+
builder.add_item(way.tags());
170166
}
171167
if (area_okay) {
172168
add_rings_to_area(builder);

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ namespace osmium {
103103
*/
104104
class BasicAssembler {
105105

106+
static constexpr const std::size_t max_split_locations = 100ULL;
107+
106108
struct slocation {
107109

108110
enum {
109-
invalid_item = 1u << 30u
111+
invalid_item = 1U << 30U
110112
};
111113

112114
uint32_t item : 31;
@@ -271,7 +273,7 @@ namespace osmium {
271273

272274
using rings_stack = std::vector<rings_stack_element>;
273275

274-
void remove_duplicates(rings_stack& outer_rings) {
276+
static void remove_duplicates(rings_stack& outer_rings) {
275277
while (true) {
276278
const auto it = std::adjacent_find(outer_rings.begin(), outer_rings.end());
277279
if (it == outer_rings.end()) {
@@ -352,7 +354,8 @@ namespace osmium {
352354
std::cerr << " Segment is below (nesting=" << nesting << ")\n";
353355
}
354356
if (segment->ring()->is_outer()) {
355-
const double y = ay + (by - ay) * (lx - ax) / double(bx - ax);
357+
const double y = static_cast<double>(ay) +
358+
static_cast<double>((by - ay) * (lx - ax)) / static_cast<double>(bx - ax);
356359
if (debug()) {
357360
std::cerr << " Segment belongs to outer ring (y=" << y << " ring=" << *segment->ring() << ")\n";
358361
}
@@ -502,7 +505,12 @@ namespace osmium {
502505
void create_locations_list() {
503506
m_locations.reserve(m_segment_list.size() * 2);
504507

505-
for (uint32_t n = 0; n < m_segment_list.size(); ++n) {
508+
// static_cast is okay here: The 32bit limit is way past
509+
// anything that makes sense here and even if there are
510+
// 2^32 segments here, it would simply not go through
511+
// all of them not building the multipolygon correctly.
512+
assert(m_segment_list.size() < std::numeric_limits<uint32_t>::max());
513+
for (uint32_t n = 0; n < static_cast<uint32_t>(m_segment_list.size()); ++n) {
506514
m_locations.emplace_back(n, false);
507515
m_locations.emplace_back(n, true);
508516
}
@@ -1079,6 +1087,15 @@ namespace osmium {
10791087
timer_simple_case.start();
10801088
create_rings_simple_case();
10811089
timer_simple_case.stop();
1090+
} else if (m_split_locations.size() > max_split_locations) {
1091+
if (debug()) {
1092+
std::cerr << " Ignoring polygon with "
1093+
<< m_split_locations.size()
1094+
<< " split locations (>"
1095+
<< max_split_locations
1096+
<< ")\n";
1097+
}
1098+
return false;
10821099
} else {
10831100
if (debug()) {
10841101
std::cerr << " Found split locations -> using complex algorithm\n";

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ DEALINGS IN THE SOFTWARE.
3838
#include <osmium/osm/node_ref.hpp>
3939

4040
#include <algorithm>
41+
#include <array>
4142
#include <cassert>
4243
#include <cstdint>
4344
#include <iosfwd>
@@ -195,7 +196,7 @@ namespace osmium {
195196
}
196197

197198
const char* role_name() const noexcept {
198-
static const char* names[] = { "unknown", "outer", "inner", "empty" };
199+
static const std::array<const char*, 4> names = {{ "unknown", "outer", "inner", "empty" }};
199200
return names[int(m_role)];
200201
}
201202

@@ -348,14 +349,14 @@ namespace osmium {
348349
osmium::Location location;
349350
};
350351

351-
seg_loc sl[4] = {
352+
std::array<seg_loc, 4> sl = {{
352353
{0, s1.first().location() },
353354
{0, s1.second().location()},
354355
{1, s2.first().location() },
355356
{1, s2.second().location()},
356-
};
357+
}};
357358

358-
std::sort(sl, sl+4, [](const seg_loc& lhs, const seg_loc& rhs) {
359+
std::sort(sl.begin(), sl.end(), [](const seg_loc& lhs, const seg_loc& rhs) {
359360
return lhs.location < rhs.location;
360361
});
361362

contrib/libosmium/osmium/area/multipolygon_collector.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ namespace osmium {
8686
area_stats m_stats;
8787

8888
enum {
89-
initial_output_buffer_size = 1024ul * 1024ul
89+
initial_output_buffer_size = 1024UL * 1024UL
9090
};
9191

9292
enum {
93-
max_buffer_size_for_flush = 100ul * 1024ul
93+
max_buffer_size_for_flush = 100UL * 1024UL
9494
};
9595

9696
void flush_output_buffer() {

contrib/libosmium/osmium/area/multipolygon_manager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ namespace osmium {
6363
/**
6464
* This class collects all data needed for creating areas from
6565
* relations tagged with type=multipolygon or type=boundary.
66-
* Most of its functionality is derived from the parent class
67-
* osmium::relations::Collector.
66+
* Most of its functionality is derived from the parent template class
67+
* osmium::relations::RelationsManager.
6868
*
6969
* The actual assembling of the areas is done by the assembler
7070
* class given as template argument.

contrib/libosmium/osmium/geom/mercator_projection.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace osmium {
4949
constexpr double earth_radius_for_epsg3857 = 6378137.0;
5050
constexpr double max_coordinate_epsg3857 = 20037508.34;
5151

52-
constexpr inline double lon_to_x(double lon) {
52+
constexpr inline double lon_to_x(double lon) noexcept {
5353
return earth_radius_for_epsg3857 * deg_to_rad(lon);
5454
}
5555

@@ -116,6 +116,9 @@ namespace osmium {
116116
* Convert the coordinates from WGS84 lon/lat to web mercator.
117117
*
118118
* @pre @code c.valid() @endcode
119+
* @pre Coordinates must be in valid range, longitude between
120+
* -180 and +180 degree, latitude between -MERCATOR_MAX_LAT
121+
* and MERCATOR_MAX_LAT.
119122
*/
120123
inline Coordinates lonlat_to_mercator(const Coordinates& c) {
121124
return Coordinates{detail::lon_to_x(c.x), detail::lat_to_y(c.y)};
@@ -125,6 +128,8 @@ namespace osmium {
125128
* Convert the coordinates from web mercator to WGS84 lon/lat.
126129
*
127130
* @pre @code c.valid() @endcode
131+
* @pre Coordinates must be in valid range (longitude and
132+
* latidude between -/+20037508.34).
128133
*/
129134
inline Coordinates mercator_to_lonlat(const Coordinates& c) {
130135
return Coordinates{detail::x_to_lon(c.x), detail::y_to_lat(c.y)};
@@ -145,6 +150,13 @@ namespace osmium {
145150
MercatorProjection() { // NOLINT(hicpp-use-equals-default, modernize-use-equals-default)
146151
}
147152

153+
/**
154+
* Do coordinate transformation.
155+
*
156+
* @pre Coordinates must be in valid range, longitude between
157+
* -180 and +180 degree, latitude between -MERCATOR_MAX_LAT
158+
* and MERCATOR_MAX_LAT.
159+
*/
148160
Coordinates operator()(osmium::Location location) const {
149161
return Coordinates{detail::lon_to_x(location.lon()), detail::lat_to_y(location.lat())};
150162
}

contrib/libosmium/osmium/geom/projection.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ DEALINGS IN THE SOFTWARE.
4747
#include <osmium/geom/util.hpp>
4848
#include <osmium/osm/location.hpp>
4949

50-
#include <proj_api.h>
50+
#ifdef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
51+
# include <proj_api.h>
52+
#else
53+
# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
54+
# include <proj_api.h>
55+
# undef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
56+
#endif
5157

5258
#include <memory>
5359
#include <string>
@@ -158,6 +164,12 @@ namespace osmium {
158164
m_crs_user(epsg) {
159165
}
160166

167+
/**
168+
* Do coordinate transformation.
169+
*
170+
* @pre Location must be in valid range (depends on projection
171+
* used).
172+
*/
161173
Coordinates operator()(osmium::Location location) const {
162174
if (m_epsg == 4326) {
163175
return Coordinates{location.lon(), location.lat()};

contrib/libosmium/osmium/geom/tile.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace osmium {
5858
* level.
5959
*/
6060
inline constexpr uint32_t num_tiles_in_zoom(uint32_t zoom) noexcept {
61-
return 1u << zoom;
61+
return 1U << zoom;
6262
}
6363

6464
/**
@@ -99,7 +99,7 @@ namespace osmium {
9999
struct Tile {
100100

101101
enum {
102-
max_zoom = 30u
102+
max_zoom = 30U
103103
};
104104

105105
/// x coordinate

0 commit comments

Comments
 (0)