Changeset 17749 in josm for trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
- Timestamp:
- 2021-04-11T21:56:50+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
r16453 r17749 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.time.Instant; 6 7 import java.util.Arrays; 7 8 import java.util.Date; … … 112 113 // A changeset does not contain all referred primitives, this is the map of incomplete ones 113 114 // For each incomplete primitive, we'll have to get its state at date it was referred 114 Map<OsmPrimitive, Date> toLoad = new HashMap<>();115 Map<OsmPrimitive, Instant> toLoad = new HashMap<>(); 115 116 for (OsmPrimitive p : downloadedData.allNonDeletedPrimitives()) { 116 117 if (p.isIncomplete()) { 117 Datetimestamp = p.getReferrers().stream()118 Instant timestamp = p.getReferrers().stream() 118 119 .filter(ref -> !ref.isTimestampEmpty()) 119 120 .findFirst() 120 .map(AbstractPrimitive::get Timestamp)121 .map(AbstractPrimitive::getInstant) 121 122 .orElse(null); 122 123 toLoad.put(p, timestamp); … … 138 139 private static final class HistoryLoaderAndListener extends HistoryLoadTask implements HistoryDataSetListener { 139 140 140 private final Map<OsmPrimitive, Date> toLoad;141 142 private HistoryLoaderAndListener(Map<OsmPrimitive, Date> toLoad) {141 private final Map<OsmPrimitive, Instant> toLoad; 142 143 private HistoryLoaderAndListener(Map<OsmPrimitive, Instant> toLoad) { 143 144 this.toLoad = toLoad; 144 145 this.setChangesetDataNeeded(false); … … 150 151 @Override 151 152 public void historyUpdated(HistoryDataSet source, PrimitiveId id) { 152 Map<OsmPrimitive, Date> toLoadNext = new HashMap<>();153 for (Iterator<Entry<OsmPrimitive, Date>> it = toLoad.entrySet().iterator(); it.hasNext();) {154 Entry<OsmPrimitive, Date> entry = it.next();153 Map<OsmPrimitive, Instant> toLoadNext = new HashMap<>(); 154 for (Iterator<Entry<OsmPrimitive, Instant>> it = toLoad.entrySet().iterator(); it.hasNext();) { 155 Entry<OsmPrimitive, Instant> entry = it.next(); 155 156 OsmPrimitive p = entry.getKey(); 156 157 History history = source.getHistory(p.getPrimitiveId()); 157 Datedate = entry.getValue();158 Instant date = entry.getValue(); 158 159 // If the history has been loaded and a timestamp is known 159 160 if (history != null && date != null) { 160 161 // Lookup for the primitive version at the specified timestamp 161 HistoryOsmPrimitive hp = history.getByDate( date);162 HistoryOsmPrimitive hp = history.getByDate(Date.from(date)); 162 163 if (hp != null) { 163 164 PrimitiveData data;
Note:
See TracChangeset
for help on using the changeset viewer.