Ignore:
Timestamp:
2012-12-07T13:29:50+01:00 (12 years ago)
Author:
donvip
Message:

[josm_terracer] don't put addr:street tag if associatedStreet relation exists

File:
1 edited

Legend:

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

    r29047 r29050  
    399399                }
    400400
    401                 addressBuilding(terr, street, streetName, number, additionalKeys);
     401                addressBuilding(terr, street, streetName, number, additionalKeys, associatedStreet);
    402402
    403403                ways.add(terr);
     
    429429                }
    430430            }
    431             addressBuilding(outline, street, streetName, number, null);
     431            addressBuilding(outline, street, streetName, number, null, associatedStreet);
    432432            ways.add(outline);
    433433        }
     
    487487     * @param number The house number
    488488     * @param additionalKeys More keys to be copied onto the new outline
     489     * @param associatedStreet The associated street. Used to determine if addr:street should be set or not.
    489490     */
    490491    private void addressBuilding(Way outline, Way street, String streetName,
    491             String number, Set<Entry<String, String>> additionalKeys) {
     492            String number, Set<Entry<String, String>> additionalKeys, Relation associatedStreet) {
    492493        if (number != null) {
    493494            // only, if the user has specified house numbers
     
    507508            this.commands.add(new ChangePropertyCommand(outline, "building", "yes"));
    508509        }
    509         if (street != null) {
    510             this.commands.add(new ChangePropertyCommand(outline, "addr:street", street.get("name")));
    511         } else if (streetName != null && !streetName.trim().isEmpty()) {
    512             this.commands.add(new ChangePropertyCommand(outline, "addr:street", streetName.trim()));
     510        // Only put addr:street if no relation exists or if it has no name
     511        if (associatedStreet == null || !associatedStreet.hasKey("name")) {
     512            if (street != null) {
     513                this.commands.add(new ChangePropertyCommand(outline, "addr:street", street.get("name")));
     514            } else if (streetName != null && !streetName.trim().isEmpty()) {
     515                this.commands.add(new ChangePropertyCommand(outline, "addr:street", streetName.trim()));
     516            }
    513517        }
    514518    }
Note: See TracChangeset for help on using the changeset viewer.