Changeset 35629 in osm for applications


Ignore:
Timestamp:
2020-10-29T00:14:23+01:00 (4 years ago)
Author:
simon04
Message:

EditLevel0LAction: support deleting tags

Location:
applications/editors/josm/plugins/comfort0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/EditLevel0LAction.java

    r35628 r35629  
    3030import org.openstreetmap.josm.data.osm.PrimitiveData;
    3131import org.openstreetmap.josm.data.osm.RelationData;
     32import org.openstreetmap.josm.data.osm.TagMap;
    3233import org.openstreetmap.josm.data.osm.WayData;
    3334import org.openstreetmap.josm.gui.MainApplication;
     
    137138            newInstance.load(fromLevel0L);
    138139
    139             final boolean equalKeys = Objects.equals(newInstance.getKeys(), fromDataSet.getKeys());
    140             if (!equalKeys) {
    141                 final ChangePropertyCommand command = new ChangePropertyCommand(Collections.singleton(fromDataSet), newInstance.getKeys());
     140            final TagMap newKeys = newInstance.getKeys();
     141            if (!Objects.equals(newKeys, fromDataSet.getKeys())) {
     142                fromDataSet.getKeys().keySet().forEach(key ->
     143                                newKeys.computeIfAbsent(key, k -> ""));
     144                final ChangePropertyCommand command = new ChangePropertyCommand(Collections.singleton(fromDataSet), newKeys);
    142145                commands.add(command);
    143146            }
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/EditLevel0LActionTest.java

    r35628 r35629  
    6969        node.put("fixme", "delete me!");
    7070        command = buildChangeCommand(dataSet, ChangePropertyCommand.class);
    71         assertThat(command.getTags(), is(new TagMap("name", "Neu Broderstorf", "traffic_sign", "city_limit")));
     71        assertThat(command.getTags(), is(new TagMap("name", "Neu Broderstorf", "traffic_sign", "city_limit", "fixme", "")));
    7272        node.remove("fixme");
    7373
Note: See TracChangeset for help on using the changeset viewer.