Skip to content

Commit

Permalink
Fix an issue where sequence downloads would reopen the image viewer w…
Browse files Browse the repository at this point in the history
…indow

This occurs since we want to update the node for the image in the
viewer. The image entry was previously immutable, but to avoid the image
viewer window reopening problem (and a flicker problem between high res
and low res images), it is no longer immutable.

Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Jul 9, 2024
1 parent aad66ec commit 59f0a65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class MapillaryImageEntry
private static final CacheAccess<Long, MapillaryImageEntry> CACHE = JCSCacheManager
.getCache("mapillary:mapillaryimageentry");
private static final String MESSAGE_SEPARATOR = " — ";
private final INode image;
private INode image;
private final List<ImageDetection<?>> imageDetections = new ArrayList<>();
private SoftReference<BufferedImageCacheEntry> originalImage;
private SoftReference<BufferedImage> layeredImage;
Expand Down Expand Up @@ -124,8 +124,7 @@ public static MapillaryImageEntry getCachedEntry(final INode image) {
MapillaryImageEntry entry = CACHE.get(id, () -> new MapillaryImageEntry(image));
if (entry.image.getNumKeys() <= image.getNumKeys()
|| image != entry.image /* Object reference equality */) {
CACHE.remove(id);
entry = CACHE.get(id, () -> new MapillaryImageEntry(image));
entry.image = image;
}
return entry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import org.openstreetmap.josm.data.vector.VectorDataSet;
import org.openstreetmap.josm.data.vector.VectorNode;
Expand Down Expand Up @@ -157,7 +156,7 @@ private synchronized MapillarySequence getCurrentSequence() {
tNode.setOsmId(n.getOsmId(), n.getVersion());
tNode.setKeys(n.getKeys());
return tNode;
}).collect(Collectors.toList()));
}).toList());
return seq;
}

Expand Down

0 comments on commit 59f0a65

Please sign in to comment.