Ticket #20598: 20598.1.patch

File 20598.1.patch, 3.1 KB (added by taylor.smock, 4 years ago)

Update the bucket with the new bbox

  • src/org/openstreetmap/josm/data/ImageData.java

     
    6363            this.data = new ArrayList<>();
    6464        }
    6565        this.geoImages.addAll(this.data);
     66        data.forEach(image -> image.setDataSet(this));
    6667        selectedImagesIndex.add(-1);
    6768    }
    6869
     
    217218    }
    218219
    219220    /**
     221     * Indicate that a entry has changed
     222     * @param gpxImageEntry The entry to update
     223     * @since xxx
     224     */
     225    public void fireNodeMoved(ImageEntry gpxImageEntry) {
     226        this.geoImages.remove(gpxImageEntry);
     227        this.geoImages.add(gpxImageEntry);
     228    }
     229
     230    /**
    220231     * Remove the image from the list of selected images
    221232     * @param image {@link ImageEntry} the image to remove
    222233     * @since 15333
  • src/org/openstreetmap/josm/data/gpx/GpxImageEntry.java

     
    551551    @Override
    552552    public BBox getBBox() {
    553553        // new BBox(LatLon) is null safe.
    554         // Use `getPos` instead of `getExifCoor` since the image may be coorelated against a GPX track
     554        // Use `getPos` instead of `getExifCoor` since the image may be correlated against a GPX track
    555555        return new BBox(this.getPos());
    556556    }
    557557
  • src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

     
    66import java.util.Collections;
    77import java.util.Objects;
    88
     9import org.openstreetmap.josm.data.ImageData;
    910import org.openstreetmap.josm.data.gpx.GpxImageEntry;
    1011
    1112/**
     
    1516public final class ImageEntry extends GpxImageEntry {
    1617
    1718    private Image thumbnail;
     19    private ImageData dataSet;
    1820
    1921    /**
    2022     * Constructs a new {@code ImageEntry}.
     
    7577    }
    7678
    7779    @Override
     80    public void applyTmp() {
     81        super.applyTmp();
     82        if (this.dataSet != null) {
     83            this.dataSet.fireNodeMoved(this);
     84        }
     85    }
     86
     87    @Override
     88    public void discardTmp() {
     89        super.discardTmp();
     90        if (this.dataSet != null) {
     91            this.dataSet.fireNodeMoved(this);
     92        }
     93    }
     94
     95    /**
     96     * Set the dataset for this image
     97     * @param imageData The dataset
     98     * @since xxx
     99     */
     100    public void setDataSet(ImageData imageData) {
     101        this.dataSet = imageData;
     102    }
     103
     104    /**
     105     * Get the dataset for this image
     106     * @return The dataset
     107     * @since xxx
     108     */
     109    public ImageData getDataSet() {
     110        return this.dataSet;
     111    }
     112
     113
     114    @Override
    78115    public int hashCode() {
    79116        return Objects.hash(super.hashCode(), thumbnail);
    80117    }