Ticket #19594: 19594.patch

File 19594.patch, 2.2 KB (added by GerdP, 5 years ago)
  • src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

     
    395395        }
    396396    }
    397397
    398     private static final List<String> DEFAULT_LINEAR_TAGS = Arrays.asList("barrier", "fence_type", "source");
     398    private static final List<String> DEFAULT_LINEAR_TAGS = Arrays.asList("barrier", "fence_type", "highway", "source");
    399399
    400400    /**
    401401     * This method removes tags/value pairs from inner and outer ways and put them on relation if necessary.
     
    445445            }
    446446        }
    447447
     448        int origValuesSize = values.size();
     449
    448450        for (String key : conflictingKeys) {
    449451            values.remove(key);
    450452        }
     
    456458        if ("coastline".equals(values.get("natural")))
    457459            values.remove("natural");
    458460
     461        boolean moveTags = Config.getPref().getBoolean("multipoly.movetags", true);
     462        boolean badMove = moveTags && Config.getPref().getBoolean("multipoly.no-movetag-on-conflict", true)
     463                && (!conflictingKeys.isEmpty() || origValuesSize > values.size());
     464        List<Command> commands = new ArrayList<>();
     465
    459466        values.put("area", OsmUtils.TRUE_VALUE);
    460467
    461         List<Command> commands = new ArrayList<>();
    462         boolean moveTags = Config.getPref().getBoolean("multipoly.movetags", true);
    463 
    464468        for (Entry<String, String> entry : values.entrySet()) {
    465469            String key = entry.getKey();
    466470            String value = entry.getValue();
     
    482486        }
    483487
    484488        values.remove("area");
     489        if (badMove && !commands.isEmpty()) {
     490            commands.clear();
     491            moveTags = false;
     492        }
    485493        if (moveTags && !values.isEmpty()) {
    486494            // add those tag values to the relation
    487495            Map<String, String> tagsToAdd = new HashMap<>();
     
    498506                commands.add(new ChangePropertyCommand(Collections.singleton(relation), tagsToAdd));
    499507            }
    500508        }
    501 
    502509        return commands;
    503510    }
    504511}