Merge commit '788bc67faa7738cf7c6b2a192ecf3e3567d1c20e' into develop
This commit is contained in:
+9
-9
@@ -171,7 +171,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
void add_tags_to_area(osmium::builder::AreaBuilder& builder, const osmium::Relation& relation) const {
|
||||
auto count = std::count_if(relation.tags().begin(), relation.tags().end(), filter());
|
||||
const auto count = std::count_if(relation.tags().begin(), relation.tags().end(), filter());
|
||||
|
||||
if (debug()) {
|
||||
std::cerr << " found " << count << " tags on relation (without ignored ones)\n";
|
||||
@@ -331,7 +331,7 @@ namespace osmium {
|
||||
if (debug()) {
|
||||
std::cerr << " has_closed_subring_back()\n";
|
||||
}
|
||||
auto end = ring.segments().end();
|
||||
const auto end = ring.segments().end();
|
||||
for (auto it = ring.segments().begin() + 1; it != end - 1; ++it) {
|
||||
if (has_same_location(nr, it->first())) {
|
||||
split_off_subring(ring, it, it, end);
|
||||
@@ -348,7 +348,7 @@ namespace osmium {
|
||||
if (debug()) {
|
||||
std::cerr << " has_closed_subring_front()\n";
|
||||
}
|
||||
auto end = ring.segments().end();
|
||||
const auto end = ring.segments().end();
|
||||
for (auto it = ring.segments().begin() + 1; it != end - 1; ++it) {
|
||||
if (has_same_location(nr, it->second())) {
|
||||
split_off_subring(ring, it, ring.segments().begin(), it+1);
|
||||
@@ -366,22 +366,22 @@ namespace osmium {
|
||||
osmium::area::detail::ProtoRing::segments_type segments(ring.segments().size());
|
||||
std::copy(ring.segments().begin(), ring.segments().end(), segments.begin());
|
||||
std::sort(segments.begin(), segments.end());
|
||||
auto it = std::adjacent_find(segments.begin(), segments.end(), [this](const osmium::area::detail::NodeRefSegment& s1, const osmium::area::detail::NodeRefSegment& s2) {
|
||||
const auto it = std::adjacent_find(segments.begin(), segments.end(), [this](const osmium::area::detail::NodeRefSegment& s1, const osmium::area::detail::NodeRefSegment& s2) {
|
||||
return has_same_location(s1.first(), s2.first());
|
||||
});
|
||||
if (it == segments.end()) {
|
||||
return false;
|
||||
}
|
||||
auto r1 = std::find_first_of(ring.segments().begin(), ring.segments().end(), it, it+1);
|
||||
const auto r1 = std::find_first_of(ring.segments().begin(), ring.segments().end(), it, it+1);
|
||||
assert(r1 != ring.segments().end());
|
||||
auto r2 = std::find_first_of(ring.segments().begin(), ring.segments().end(), it+1, it+2);
|
||||
const auto r2 = std::find_first_of(ring.segments().begin(), ring.segments().end(), it+1, it+2);
|
||||
assert(r2 != ring.segments().end());
|
||||
|
||||
if (debug()) {
|
||||
std::cerr << " found subring in ring " << ring << " at " << it->first() << "\n";
|
||||
}
|
||||
|
||||
auto m = std::minmax(r1, r2);
|
||||
const auto m = std::minmax(r1, r2);
|
||||
|
||||
ProtoRing new_ring(m.first, m.second);
|
||||
ring.remove_segments(m.first, m.second);
|
||||
@@ -537,7 +537,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
for (const auto ringptr : m_outer_rings) {
|
||||
for (const auto segment : ringptr->segments()) {
|
||||
for (const auto& segment : ringptr->segments()) {
|
||||
if (!segment.role_outer()) {
|
||||
++m_inner_outer_mismatches;
|
||||
if (debug()) {
|
||||
@@ -550,7 +550,7 @@ namespace osmium {
|
||||
}
|
||||
}
|
||||
for (const auto ringptr : m_inner_rings) {
|
||||
for (const auto segment : ringptr->segments()) {
|
||||
for (const auto& segment : ringptr->segments()) {
|
||||
if (!segment.role_inner()) {
|
||||
++m_inner_outer_mismatches;
|
||||
if (debug()) {
|
||||
|
||||
@@ -41,6 +41,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <osmium/memory/buffer.hpp>
|
||||
#include <osmium/osm/item_type.hpp>
|
||||
#include <osmium/osm/location.hpp>
|
||||
#include <osmium/osm/node_ref.hpp>
|
||||
#include <osmium/osm/relation.hpp>
|
||||
#include <osmium/osm/tag.hpp>
|
||||
#include <osmium/osm/way.hpp>
|
||||
@@ -49,8 +51,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
namespace osmium {
|
||||
|
||||
struct invalid_location;
|
||||
|
||||
namespace relations {
|
||||
class RelationMeta;
|
||||
}
|
||||
@@ -107,8 +107,8 @@ namespace osmium {
|
||||
}
|
||||
|
||||
/**
|
||||
* We are interested in all relations tagged with type=multipolygon or
|
||||
* type=boundary.
|
||||
* We are interested in all relations tagged with type=multipolygon
|
||||
* or type=boundary.
|
||||
*
|
||||
* Overwritten from the base class.
|
||||
*/
|
||||
@@ -142,15 +142,22 @@ namespace osmium {
|
||||
* Overwritten from the base class.
|
||||
*/
|
||||
void way_not_in_any_relation(const osmium::Way& way) {
|
||||
if (way.nodes().size() > 3 && way.ends_have_same_location()) {
|
||||
// way is closed and has enough nodes, build simple multipolygon
|
||||
try {
|
||||
// you need at least 4 nodes to make up a polygon
|
||||
if (way.nodes().size() <= 3) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!way.nodes().front().location() || !way.nodes().back().location()) {
|
||||
throw osmium::invalid_location("invalid location");
|
||||
}
|
||||
if (way.ends_have_same_location()) {
|
||||
// way is closed and has enough nodes, build simple multipolygon
|
||||
TAssembler assembler(m_assembler_config);
|
||||
assembler(way, m_output_buffer);
|
||||
possibly_flush_output_buffer();
|
||||
} catch (osmium::invalid_location&) {
|
||||
// XXX ignore
|
||||
}
|
||||
} catch (osmium::invalid_location&) {
|
||||
// XXX ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user