Ignore:
Timestamp:
03.02.2010 09:48:51 (2 years ago)
Author:
bastiK
Message:

cleanup for geoimage code (mainly getters and setters)

File:
1 edited

Legend:

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

    r2904 r2931  
    1818 
    1919final public class ImageEntry implements Comparable<ImageEntry>, Cloneable { 
    20     File file; 
    21     Date time; 
    22     LatLon exifCoor; 
     20    private File file; 
     21    private LatLon exifCoor; 
     22    private Date exifTime; 
     23    Image thumbnail; 
    2324 
     25    /** The following values are computed from the correlation with the gpx track */ 
    2426    private CachedLatLon pos; 
    2527    /** Speed in kilometer per second */ 
     
    2729    /** Elevation (altitude) in meters */ 
    2830    private Double elevation; 
    29  
    30     Image thumbnail; 
     31    /** The time after correlation with a gpx track */ 
     32    private Date gpsTime; 
    3133 
    3234    /** 
     
    4042    ImageEntry tmp; 
    4143 
     44    /** 
     45     * getter methods that refer to the temporary value 
     46     */ 
    4247    public CachedLatLon getPos() { 
    4348        if (tmp != null) 
     
    5560        return elevation; 
    5661    } 
     62    public Date getGpsTime() { 
     63        if (tmp != null) 
     64            return tmp.gpsTime; 
     65        return gpsTime; 
     66    } 
     67 
     68    /** 
     69     * other getter methods 
     70     */ 
     71    public File getFile() { 
     72        return file; 
     73    } 
     74    public Date getExifTime() { 
     75        return exifTime; 
     76    } 
     77    LatLon getExifCoor() { 
     78        return exifCoor; 
     79    } 
     80    /** 
     81     * setter methods 
     82     */ 
    5783    public void setPos(CachedLatLon pos) { 
    5884        this.pos = pos; 
     85    } 
     86    public void setPos(LatLon pos) { 
     87        this.pos = new CachedLatLon(pos); 
    5988    } 
    6089    public void setSpeed(Double speed) { 
     
    6493        this.elevation = elevation; 
    6594    } 
    66      
    67     public File getFile() { 
    68         return file; 
     95    void setFile(File file) { 
     96        this.file = file; 
     97    } 
     98    void setExifTime(Date exifTime) { 
     99        this.exifTime = exifTime; 
     100    } 
     101    void setGpsTime(Date gpsTime) { 
     102        this.gpsTime = gpsTime; 
     103    } 
     104    void setExifCoor(LatLon exifCoor) { 
     105        this.exifCoor = exifCoor; 
    69106    } 
    70107 
     
    80117    } 
    81118 
    82     public void setCoor(LatLon latlon) 
    83     { 
    84         pos = new CachedLatLon(latlon); 
    85     } 
    86  
    87119    public int compareTo(ImageEntry image) { 
    88         if (time != null && image.time != null) 
    89             return time.compareTo(image.time); 
    90         else if (time == null && image.time == null) 
     120        if (exifTime != null && image.exifTime != null) 
     121            return exifTime.compareTo(image.exifTime); 
     122        else if (exifTime == null && image.exifTime == null) 
    91123            return 0; 
    92         else if (time == null) 
     124        else if (exifTime == null) 
    93125            return -1; 
    94126        else 
     
    96128    } 
    97129 
    98     public void applyTmp() { 
    99         if (tmp != null) { 
    100             pos = tmp.pos; 
    101             speed = tmp.speed; 
    102             elevation = tmp.elevation; 
    103             tmp = null; 
    104         } 
    105     } 
     130    /** 
     131     * Make a fresh copy and save it in the temporary variable. 
     132     */ 
    106133    public void cleanTmp() { 
    107134        tmp = clone(); 
     
    110137    } 
    111138 
     139    /** 
     140     * Copy the values from the temporary variable to the main instance. 
     141     */ 
     142    public void applyTmp() { 
     143        if (tmp != null) { 
     144            pos = tmp.pos; 
     145            speed = tmp.speed; 
     146            elevation = tmp.elevation; 
     147            gpsTime = tmp.gpsTime; 
     148            tmp = null; 
     149        } 
     150    } 
     151 
     152    /** 
     153     * If it has been tagged i.e. matched to a gpx track or retrieved lat/lon from exif 
     154     */ 
    112155    public boolean isTagged() { 
    113156        return pos != null; 
     
    115158 
    116159    /** 
    117      * only partial info 
     160     * String representation. (only partial info) 
    118161     */ 
    119162    @Override 
Note: See TracChangeset for help on using the changeset viewer.