if( m.hasRole() && "inner".equals(m.getRole()) && m.isWay() && m.getWay().hasKeys() ) {
innerWays.add(m.getWay());
}
if( m.hasRole() && "outer".equals(m.getRole()) && m.isWay() && m.getWay().hasKeys() ) {
Way way = m.getWay();
outerWays.add(way);
for( String key : way.keySet() ) {
if( !values.containsKey(key) ) { //relation values take precedence
values.put(key, way.get(key));
} else if( !relation.hasKey(key) && !values.get(key).equals(way.get(key)) ) {
conflictingKeys.add(key);
}
}
}
}
// filter out empty key conflicts - we need second iteration
if( !Main.pref.getBoolean("multipoly.alltags", false) )
for( RelationMember m : relation.getMembers() )
if( m.hasRole() && "outer".equals(m.getRole()) && m.isWay() )
for( String key : values.keySet() )
if( !m.getWay().hasKey(key) && !relation.hasKey(key) )
conflictingKeys.add(key);
for( String key : conflictingKeys )
values.remove(key);
for( String linearTag : Main.pref.getCollection("multipoly.lineartagstokeep", DEFAULT_LINEAR_TAGS) )
values.remove(linearTag);
if ("coastline".equals(values.get("natural")))
values.remove("natural");
values.put("area", "yes");
List<Command> commands = new ArrayList<>();
boolean moveTags = Main.pref.getBoolean("multipoly.movetags", true);
for (Entry<String, String> entry : values.entrySet()) {
List<OsmPrimitive> affectedWays = new ArrayList<>();
String key = entry.getKey();
String value = entry.getValue();
for (Way way : innerWays) {
if (value.equals(way.get(key))) {
affectedWays.add(way);
}
}
if (moveTags) {
// remove duplicated tags from outer ways
for( Way way : outerWays ) {
if( way.hasKey(key) ) {
affectedWays.add(way);
}
}
}