Ticket #9887: PasteRelationsAction-associatedStreet.patch

File PasteRelationsAction-associatedStreet.patch, 1.4 KB (added by tyndare, 12 years ago)
  • plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java

     
    5555            boolean changed = false;
    5656            for( OsmPrimitive p : selection ) {
    5757                if( !r.getMemberPrimitives().contains(p) && !r.equals(p) ) {
    58                     r.addMember(new RelationMember(relations.get(rel), p));
     58                    String role = relations.get(rel);             
     59                    if ("associatedStreet".equals(r.get("type"))) {
     60                        if (p.get("highway") != null) {
     61                                role="street";
     62                                if ((p.get("name") == null) && (r.get("name") != null)) {
     63                                        commands.add(new ChangePropertyCommand(p, "name", r.get("name")));
     64                                }                       
     65                        } else if (p.get("addr:housenumber") != null) {
     66                                role="house";
     67                        }
     68                    }
     69                    r.addMember(new RelationMember(role, p));
    5970                    changed = true;
    6071                }
    6172            }