Changeset 35381 in osm
- Timestamp:
- 2020-03-19T17:10:04+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/src/reverter/DataSetCommandMerger.java
r35084 r35381 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.HashMap; 8 9 import java.util.LinkedHashSet; 9 10 import java.util.LinkedList; 10 11 import java.util.List; 12 import java.util.Map; 11 13 12 14 import org.openstreetmap.josm.command.ChangeCommand; … … 14 16 import org.openstreetmap.josm.data.conflict.Conflict; 15 17 import org.openstreetmap.josm.data.conflict.ConflictCollection; 18 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 16 19 import org.openstreetmap.josm.data.osm.DataSet; 17 20 import org.openstreetmap.josm.data.osm.Node; … … 50 53 51 54 private void addChangeCommandIfNotEquals(OsmPrimitive target, OsmPrimitive newTarget, boolean nominal) { 52 if (!target.hasEqualSemanticAttributes(newTarget) || target.isDeleted() != newTarget.isDeleted() || target.isVisible() != newTarget.isVisible()) { 53 cmds.add(new ChangeCommand(target, newTarget)); 54 if (nominal) { 55 nominalRevertedPrimitives.add(target); 56 } 57 Logging.debug("Reverting "+target+" to "+newTarget); 58 } 55 if (target.isIncomplete() != newTarget.isIncomplete() || target.isDeleted() != newTarget.isDeleted() 56 || target.isVisible() != newTarget.isVisible() 57 || !getNonDiscardableTags(target).equals(getNonDiscardableTags(newTarget))) { 58 cmds.add(new ChangeCommand(target, newTarget)); 59 if (nominal) { 60 nominalRevertedPrimitives.add(target); 61 } 62 Logging.debug("Reverting " + target + " to " + newTarget); 63 } 64 } 65 66 private static Map<String, String> getNonDiscardableTags(OsmPrimitive p) { 67 Map<String, String> result = new HashMap<>(); 68 for (Map.Entry<String, String> e : p.getKeys().entrySet()) { 69 if (!AbstractPrimitive.getDiscardableKeys().contains(e.getKey())) 70 result.put(e.getKey(), e.getValue()); 71 } 72 return result; 59 73 } 60 74
Note:
See TracChangeset
for help on using the changeset viewer.