Ignore:
Timestamp:
2017-02-16T22:21:43+01:00 (9 years ago)
Author:
stoecker
Message:

add date field to imagery definition, allow to select mirror layers in settings

File:
1 edited

Legend:

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

    r11527 r11570  
    188188    /** country code of the imagery (for country specific imagery) */
    189189    private String countryCode = "";
     190    /**
     191      * creation date of the imagery (in the form YYYY-MM-DD;YYYY-MM-DD, where
     192      * DD and MM as well as a second date are optional)
     193      * @since 11570
     194      */
     195    private String date;
    190196    /** mirrors of different type for this entry */
    191197    private List<ImageryInfo> mirrors;
     
    204210    public static class ImageryPreferenceEntry {
    205211        @pref String name;
     212        @pref String d;
    206213        @pref String id;
    207214        @pref String type;
     
    216223        @pref String terms_of_use_url;
    217224        @pref String country_code = "";
     225        @pref String date;
    218226        @pref int max_zoom;
    219227        @pref int min_zoom;
     
    253261            attribution_text = i.attributionText;
    254262            attribution_url = i.attributionLinkURL;
     263            date = i.date;
    255264            logo_image = i.attributionImage;
    256265            logo_url = i.attributionImageURL;
     
    408417        attributionImage = e.logo_image;
    409418        attributionImageURL = e.logo_url;
     419        date = e.date;
    410420        termsOfUseText = e.terms_of_use_text;
    411421        termsOfUseURL = e.terms_of_use_url;
     
    448458        this.termsOfUseURL = i.termsOfUseURL;
    449459        this.countryCode = i.countryCode;
     460        this.date = i.date;
    450461        this.icon = i.icon;
    451462        this.description = i.description;
     
    495506                Objects.equals(this.termsOfUseURL, other.termsOfUseURL) &&
    496507                Objects.equals(this.countryCode, other.countryCode) &&
     508                Objects.equals(this.date, other.date) &&
    497509                Objects.equals(this.icon, other.icon) &&
    498510                Objects.equals(this.description, other.description) &&
     
    831843     */
    832844    public String getToolTipText() {
     845        String res = getName();
     846        boolean html = false;
     847        String date = getDate();
     848        if (date != null && !date.isEmpty()) {
     849            res += "<br>" + tr("Date of imagery: {0}", date);
     850            html = true;
     851        }
    833852        String desc = getDescription();
    834853        if (desc != null && !desc.isEmpty()) {
    835             return "<html>" + getName() + "<br>" + desc + "</html>";
    836         }
    837         return getName();
     854            res += "<br>" + desc;
     855            html = true;
     856        }
     857        if (html) {
     858            res = "<html>" + res + "</html>";
     859        }
     860        return res;
    838861    }
    839862
     
    868891    public void setCountryCode(String countryCode) {
    869892        this.countryCode = countryCode;
     893    }
     894
     895    /**
     896     * Returns the date information.
     897     * @return The date (in the form YYYY-MM-DD;YYYY-MM-DD, where
     898     * DD and MM as well as a second date are optional)
     899     * @since 11570
     900     */
     901    public String getDate() {
     902        return date;
     903    }
     904
     905    /**
     906     * Sets the date information.
     907     * @param date The date information
     908     * @since 11570
     909     */
     910    public void setDate(String date) {
     911        this.date = date;
    870912    }
    871913
     
    11351177       List<ImageryInfo> l = new ArrayList<>();
    11361178       if (mirrors != null) {
     1179           int num = 1;
    11371180           for (ImageryInfo i : mirrors) {
    11381181               ImageryInfo n = new ImageryInfo(this);
     
    11491192                   n.setTileSize(i.getTileSize());
    11501193               }
     1194               if(n.id != null) {
     1195                   n.id = n.id + "_mirror"+num;
     1196               }
     1197               if(num > 1) {
     1198                   n.name = tr("{0} mirror server {1}", n.name, num);
     1199                   n.origName += " mirror server " + num;
     1200               } else {
     1201                   n.name = tr("{0} mirror server", n.name);
     1202                   n.origName += " mirror server";
     1203               }
    11511204               l.add(n);
     1205               ++num;
    11521206           }
    11531207       }
Note: See TracChangeset for help on using the changeset viewer.