Changeset 18621 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2022-12-28T19:38:17+01:00 (23 months ago)
Author:
taylor.smock
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r18613 r18621  
    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    }
     
    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
Note: See TracChangeset for help on using the changeset viewer.