Ignore:
Timestamp:
2013-11-18T03:05:56+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #9274 - GeoImageLayer functionality enhancements (patch by holgerosm)

File:
1 edited

Legend:

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

    r6296 r6392  
    1818    private Double exifImgDir;
    1919    private Date exifTime;
     20    /**
     21     * Flag isNewGpsData indicates that the GPS data of the image is new or has changed.
     22     * GPS data includes the position, speed, elevation, time (e.g. as extracted from the GPS track).
     23     * The flag can used to decide for which image file the EXIF GPS data is (re-)written.
     24     */
     25    private boolean isNewGpsData = false;
     26    /** Temporary source of GPS time if not correlated with GPX track. */
     27    private Date exifGpsTime = null;
    2028    Image thumbnail;
    2129
    22     /** The following values are computed from the correlation with the gpx track */
     30    /**
     31     * The following values are computed from the correlation with the gpx track
     32     * or extracted from the image EXIF data.
     33     */
    2334    private CachedLatLon pos;
    2435    /** Speed in kilometer per second */
     
    7586        return exifTime;
    7687    }
     88   
     89    /**
     90     * Returns the EXIF GPS time.
     91     * @return the EXIF GPS time
     92     * @since 6392
     93     */
     94    public final Date getExifGpsTime() {
     95        return exifGpsTime;
     96    }
     97   
    7798    public LatLon getExifCoor() {
    7899        return exifCoor;
     
    110131        this.exifTime = exifTime;
    111132    }
     133   
     134    /**
     135     * Sets the EXIF GPS time.
     136     * @param exifGpsTime the EXIF GPS time
     137     * @since 6392
     138     */
     139    public final void setExifGpsTime(Date exifGpsTime) {
     140        this.exifGpsTime = exifGpsTime;
     141    }
     142   
    112143    public void setGpsTime(Date gpsTime) {
    113144        this.gpsTime = gpsTime;
     
    184215        return result;
    185216    }
     217
     218    /**
     219     * Indicates that the image has new GPS data.
     220     * That flag is used e.g. by the photo_geotagging plugin to decide for which image
     221     * file the EXIF GPS data needs to be (re-)written.
     222     * @since 6392
     223     */
     224    public void flagNewGpsData() {
     225        isNewGpsData = true;
     226        // We need to set the GPS time to tell the system (mainly the photo_geotagging plug-in)
     227        // that the GPS data has changed. Check for existing GPS time and take EXIF time otherwise.
     228        // This can be removed once isNewGpsData is used instead of the GPS time.
     229        if (gpsTime == null) {
     230            Date gpsTime = getExifGpsTime();
     231            if (gpsTime == null) {
     232                gpsTime = getExifTime();
     233                if (gpsTime == null) {
     234                    // Time still not set, take the current time.
     235                    gpsTime = new Date();
     236                }
     237            }
     238            setGpsTime(gpsTime);
     239        }
     240        if (tmp != null && tmp.getGpsTime() == null) {
     241            // tmp.gpsTime overrides gpsTime, so we set it too.
     242            tmp.setGpsTime(getGpsTime());
     243        }
     244    }
     245
     246    /**
     247     * Queries whether the GPS data changed.
     248     * @return {@code true} if GPS data changed, {@code false} otherwise
     249     * @since 6392
     250     */
     251    public boolean hasNewGpsData() {
     252        return isNewGpsData;
     253    }
    186254}
Note: See TracChangeset for help on using the changeset viewer.