Ticket #10020: 10020.patch

File 10020.patch, 1.9 KB (added by GerdP, 6 years ago)
  • src/reverter/ChangesetReverter.java

     
    7373    private final OsmDataLayer layer; // data layer associated with reverter
    7474    private final DataSet ds; // DataSet associated with reverter
    7575    private final ChangesetDataSet cds; // Current changeset data
     76        private final DataSet ods; // original DataSet, used if a new layer is requested
    7677    private DataSet nds; // Dataset that contains new objects downloaded by reverter
    7778
    7879    private final HashSet<PrimitiveId> missing = new HashSet<>();
     
    8283    private final HashSet<HistoryOsmPrimitive> deleted = new HashSet<>();
    8384    private final HashMap<PrimitiveId, Integer> earliestVersions = new HashMap<>();
    8485
     86
    8587    //// Handling missing objects
    8688    ////////////////////////////////////////
    8789    private void addIfMissing(PrimitiveId id) {
     
    117119                entry.getModificationType() == ChangesetModificationType.DELETED) {
    118120            return true;
    119121        }
    120         OsmPrimitive p = ds.getPrimitiveById(entry.getPrimitive().getPrimitiveId());
     122        OsmPrimitive p = ods.getPrimitiveById(entry.getPrimitive().getPrimitiveId());
    121123        if (p == null) return false;
    122124        return p.isSelected();
    123125    }
     
    141143            this.layer = MainApplication.getLayerManager().getEditLayer();
    142144            this.ds = layer.data;
    143145        }
     146        if (revertType == RevertType.SELECTION || revertType == RevertType.SELECTION_WITH_UNDELETE)
     147                this.ods = MainApplication.getLayerManager().getEditLayer().data;
     148        else
     149                this.ods = this.ds;
    144150        this.revertType = revertType;
    145151
    146152        OsmServerChangesetReader csr = new OsmServerChangesetReader(true);