Ignore:
Timestamp:
2012-12-05T00:36:21+01:00 (12 years ago)
Author:
donvip
Message:

[josm_terracer] fix #josm6172 - Reuse associatedStreet relation when only a building is selected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java

    r29035 r29037  
    174174        }
    175175
     176        Relation associatedStreet = null;
     177
     178        // Try to find an associatedStreet relation that could be reused from outline.
     179        for (OsmPrimitive p : outline.getReferrers()) {
     180            if (p instanceof Relation) {
     181                Relation rel = (Relation) p;
     182                if ("associatedStreet".equals(rel.get("type"))) {
     183                    associatedStreet = rel;
     184                    break;
     185                }
     186            }
     187        }
     188       
    176189        // If we have a street, try to find an associatedStreet relation that could be reused.
    177         Relation associatedStreet = null;
    178         if (street != null) {
     190        if (associatedStreet == null && street != null) {
    179191            outer:for (OsmPrimitive osm : Main.main.getCurrentDataSet().allNonDeletedPrimitives()) {
    180192                if (!(osm instanceof Relation)) continue;
     
    438450                    newAssociatedStreet.addMember(new RelationMember("house", w));
    439451                }
     452                if (deleteOutline) {
     453                    newAssociatedStreet.removeMembersFor(outline);
     454                }
    440455                this.commands.add(new ChangeCommand(associatedStreet, newAssociatedStreet));
    441456            }
Note: See TracChangeset for help on using the changeset viewer.