Ignore:
Timestamp:
2011-10-07T18:52:05+02:00 (13 years ago)
Author:
bastiK
Message:

more options to configure imagery attribution (logo-url & terms-of-use-text) (see [o26793])

File:
1 edited

Legend:

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

    r4464 r4492  
    7676    private List<String> serverProjections;
    7777    private String attributionText;
     78    private String attributionLinkURL;
    7879    private String attributionImage;
    79     private String attributionLinkURL;
     80    private String attributionImageURL;
     81    private String termsOfUseText;
    8082    private String termsOfUseURL;
    8183    private String countryCode = "";
     
    9193        @pref String attribution_url;
    9294        @pref String logo_image;
     95        @pref String logo_url;
     96        @pref String terms_of_use_text;
    9397        @pref String terms_of_use_url;
    9498        @pref String country_code = "";
     
    112116            attribution_url = i.attributionLinkURL;
    113117            logo_image = i.attributionImage;
     118            logo_url = i.attributionImageURL;
     119            terms_of_use_text = i.termsOfUseText;
    114120            terms_of_use_url = i.termsOfUseURL;
    115121            country_code = i.countryCode;
     
    204210        }
    205211        attributionText = e.attribution_text;
     212        attributionLinkURL = e.attribution_url;
    206213        attributionImage = e.logo_image;
    207         attributionLinkURL = e.attribution_url;
     214        attributionImageURL = e.logo_url;
     215        termsOfUseText = e.terms_of_use_text;
    208216        termsOfUseURL = e.terms_of_use_url;
    209217        countryCode = e.country_code;
     
    267275        this.eulaAcceptanceRequired = null;
    268276        this.bounds = i.bounds;
     277        this.attributionText = i.attributionText;
     278        this.attributionLinkURL = i.attributionLinkURL;
    269279        this.attributionImage = i.attributionImage;
    270         this.attributionLinkURL = i.attributionLinkURL;
    271         this.attributionText = i.attributionText;
     280        this.attributionImageURL = i.attributionImageURL;
     281        this.termsOfUseText = i.termsOfUseText;
    272282        this.termsOfUseURL = i.termsOfUseURL;
    273283        this.serverProjections = i.serverProjections;
     
    327337    }
    328338
     339    public void setAttributionImageURL(String text) {
     340        attributionImageURL = text;
     341    }
     342
    329343    public String getAttributionLinkURL() {
    330344        return attributionLinkURL;
     
    333347    public void setAttributionLinkURL(String text) {
    334348        attributionLinkURL = text;
     349    }
     350
     351    public void setTermsOfUseText(String text) {
     352        termsOfUseText = text;
    335353    }
    336354
     
    514532    {
    515533        this.attributionImage = i.attributionImage;
     534        this.attributionImageURL = i.attributionImageURL;
     535        this.attributionText = i.attributionText;
    516536        this.attributionLinkURL = i.attributionLinkURL;
    517         this.attributionText = i.attributionText;
     537        this.termsOfUseText = i.termsOfUseText;
    518538        this.termsOfUseURL = i.termsOfUseURL;
    519539    }
    520540
    521     public void setAttribution(TMSTileSource s)
    522     {
    523         if(attributionLinkURL != null) {
    524             if(attributionLinkURL.equals("osm"))
     541    /**
     542     * Applies the attribution from this object to a TMSTileSource.
     543     */
     544    public void setAttribution(TMSTileSource s) {
     545        if (attributionText != null) {
     546            if (attributionText.equals("osm")) {
     547                s.setAttributionText(new Mapnik().getAttributionText(0, null, null));
     548            } else {
     549                s.setAttributionText(attributionText);
     550            }
     551        }
     552        if (attributionLinkURL != null) {
     553            if (attributionLinkURL.equals("osm")) {
    525554                s.setAttributionLinkURL(new Mapnik().getAttributionLinkURL());
    526             else
     555            } else {
    527556                s.setAttributionLinkURL(attributionLinkURL);
    528         }
    529         if(attributionText != null) {
    530             if(attributionText.equals("osm"))
    531                 s.setAttributionText(new Mapnik().getAttributionText(0, null, null));
    532             else
    533                 s.setAttributionText(attributionText);
    534         }
    535         if(attributionImage != null) {
     557            }
     558        }
     559        if (attributionImage != null) {
    536560            ImageIcon i = ImageProvider.getIfAvailable(null, attributionImage);
    537             if(i != null)
     561            if (i != null) {
    538562                s.setAttributionImage(i.getImage());
    539         }
    540         if(termsOfUseURL != null) {
    541             if(termsOfUseURL.equals("osm"))
     563            }
     564        }
     565        if (attributionImageURL != null) {
     566            s.setAttributionImageURL(attributionImageURL);
     567        }
     568        if (termsOfUseText != null) {
     569            s.setTermsOfUseText(termsOfUseText);
     570        }
     571        if (termsOfUseURL != null) {
     572            if (termsOfUseURL.equals("osm")) {
    542573                s.setTermsOfUseURL(new Mapnik().getTermsOfUseURL());
    543             else
     574            } else {
    544575                s.setTermsOfUseURL(termsOfUseURL);
     576            }
    545577        }
    546578    }
Note: See TracChangeset for help on using the changeset viewer.