Skip to content

Commit 12581f9

Browse files
author
taylor.smock
committed
Fix #22606: Images with no exif position or no set position were treated as if they had no position
This is incorrect behavior, since the paint code only cares about the return value of IImageEntry#getPos, and invalid geoimages should be those that can not be shown in the mapview. This also fixes an issue where, when the layer has no images with positions, the first image would be displayed, but not selected in the data. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18621 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent 1c25f53 commit 12581f9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ public GeoImageLayer(final List<ImageEntry> data, GpxData gpxData, final String
198198
}
199199
}
200200
if (getInvalidGeoImages().size() == data.size()) {
201-
ImageViewerDialog.getInstance().displayImages(Collections.singletonList(this.data.getFirstImage()));
201+
this.data.setSelectedImage(this.data.getFirstImage());
202+
// We do have to wrap the EDT call in a worker call, since layers may be created in the EDT.
203+
// And the layer must be added to the layer list in order for the dialog to work properly.
204+
MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> {
205+
ImageViewerDialog.getInstance().displayImages(this.getSelection());
206+
}));
202207
}
203208
}
204209

@@ -301,8 +306,7 @@ public List<ImageEntry> getSelection() {
301306

302307
@Override
303308
public List<IImageEntry<?>> getInvalidGeoImages() {
304-
return this.getImageData().getImages().stream().filter(entry -> entry.getPos() == null || entry.getExifCoor() == null
305-
|| !entry.getExifCoor().isValid() || !entry.getPos().isValid()).collect(toList());
309+
return this.getImageData().getImages().stream().filter(entry -> entry.getPos() == null || !entry.getPos().isValid()).collect(toList());
306310
}
307311

308312
@Override

0 commit comments

Comments
 (0)