Changeset 17579 in josm


Ignore:
Timestamp:
2021-03-17T15:10:20+01:00 (3 years ago)
Author:
Don-vip
Message:

fix #20598 - Add method to indicate that a temporary copy has been updated, fix broken tests (patch by taylor.smock)

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/ImageData.java

    r17577 r17579  
    6060            Collections.sort(data);
    6161            this.data = data;
     62            this.data.forEach(image -> image.setDataSet(this));
    6263        } else {
    6364            this.data = new ArrayList<>();
    6465        }
    6566        this.geoImages.addAll(this.data);
    66         data.forEach(image -> image.setDataSet(this));
    6767        selectedImagesIndex.add(-1);
    6868    }
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java

    r15502 r17579  
    241241                    curTmp.setGpsTime(new Date(curImg.getExifTime().getTime() - offset));
    242242                    curTmp.flagNewGpsData();
     243                    curImg.tmpUpdated();
     244
    243245                    ret++;
    244246                }
     
    265267                    curTmp.setGpsTime(new Date(curImg.getExifTime().getTime() - offset));
    266268                    curTmp.flagNewGpsData();
     269                    curImg.tmpUpdated();
    267270
    268271                    ret++;
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxImageEntry.java

    r17574 r17579  
    509509            tmp = null;
    510510        }
     511        tmpUpdated();
    511512    }
    512513
     
    517518    public void discardTmp() {
    518519        tmp = null;
     520        tmpUpdated();
    519521    }
    520522
     
    548550        isNewGpsData = true;
    549551   }
     552
     553    /**
     554     * Indicate that the temporary copy has been updated. Mostly used to prevent UI issues.
     555     * By default, this is a no-op. Override when needed in subclasses.
     556     * @since 17579
     557     */
     558    protected void tmpUpdated() {
     559        // No-op by default
     560    }
    550561
    551562    @Override
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

    r17577 r17579  
    3333        super(other);
    3434        thumbnail = other.thumbnail;
     35        dataSet = other.dataSet;
    3536    }
    3637
     
    7879
    7980    @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();
     81    protected void tmpUpdated() {
     82        super.tmpUpdated();
    9083        if (this.dataSet != null) {
    9184            this.dataSet.fireNodeMoved(this);
     
    123116            return false;
    124117        ImageEntry other = (ImageEntry) obj;
    125         return Objects.equals(thumbnail, other.thumbnail);
     118        return Objects.equals(thumbnail, other.thumbnail) && Objects.equals(dataSet, other.dataSet);
    126119    }
    127120}
Note: See TracChangeset for help on using the changeset viewer.