Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop duplicate relation members in repair mode #90

Merged
merged 1 commit into from
Apr 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/osmium/multipolygon/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,17 +642,18 @@ namespace Osmium {
* and some extra flags.
*/
void assemble_ways(std::vector< shared_ptr<WayInfo> >& way_infos) {
std::map<osm_object_id_t, bool> added_ways;

BOOST_FOREACH(const shared_ptr<Osmium::OSM::Object const>& object, m_relation_info.members()) {
const shared_ptr<Osmium::OSM::Way const> way = static_pointer_cast<Osmium::OSM::Way const>(object);

// ignore members that are not ways and ways without nodes
if (way && !way->nodes().empty()) {
if (way && !way->nodes().empty() && (!m_attempt_repair || !added_ways[way->id()])) {
if (way->timestamp() > m_new_area->timestamp()) {
m_new_area->timestamp(way->timestamp());
}

added_ways[way->id()] = true;
way_infos.push_back(make_shared<WayInfo>(way));
// TODO drop duplicate ways automatically in repair mode?
// TODO maybe add INNER/OUTER instead of UNSET to enable later warnings on role mismatch
}
}
Expand Down