Changeset 4492 in josm


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])

Location:
trunk/src/org/openstreetmap/josm
Files:
5 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    }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r4489 r4492  
    7171        @Override public String getTileUrl(int zoom, int tilex, int tiley) throws IOException { return source.getTileUrl(zoom, tilex, tiley); }
    7272
     73        @Override public boolean requiresAttribution() { return source.requiresAttribution(); }
     74
     75        @Override public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { return source.getAttributionText(zoom, topLeft, botRight); }
     76
     77        @Override public String getAttributionLinkURL() { return source.getAttributionLinkURL(); }
     78
    7379        @Override public Image getAttributionImage() { return source.getAttributionImage(); }
    7480
    75         @Override public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { return source.getAttributionText(zoom, topLeft, botRight); }
    76 
    77         @Override public boolean requiresAttribution() { return source.requiresAttribution(); }
    78 
    79         @Override public String getAttributionLinkURL() { return source.getAttributionLinkURL(); }
     81        @Override public String getAttributionImageURL() { return source.getAttributionImageURL(); }
     82
     83        @Override public String getTermsOfUseText() { return source.getTermsOfUseText(); }
    8084
    8185        @Override public String getTermsOfUseURL() { return source.getTermsOfUseURL(); }
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r4489 r4492  
    11711171        int otherZooms[] = { -1, 1, -2, 2, -3, -4, -5};
    11721172        for (int zoomOffset : otherZooms) {
    1173             if (!autoZoom)
     1173            if (!autoZoom) {
    11741174                break;
     1175            }
    11751176            int newzoom = displayZoomLevel + zoomOffset;
    1176             if (newzoom < MIN_ZOOM)
     1177            if (newzoom < MIN_ZOOM) {
    11771178                continue;
     1179            }
    11781180            if (missedTiles.size() <= 0) {
    11791181                break;
     
    12371239            myDrawString(g, tr("Best zoom: {0}", Math.log(getScaleFactor(1))/Math.log(2)/2+1), 50, 185);
    12381240        }*/
    1239     }// end of paint method
     1241    }
    12401242
    12411243    /**
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r4432 r4492  
    302302    }
    303303
    304 
    305304    /**
    306305     *
     
    312311        return new EastNorth((xIndex * imageSize) / info.getPixelPerDegree(), (yIndex * imageSize) / info.getPixelPerDegree());
    313312    }
    314 
    315313
    316314    protected void downloadAndPaintVisible(Graphics g, final MapView mv, boolean real){
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r4439 r4492  
    253253                        entry.setAttributionImage(accumulator.toString());
    254254                    } else if (qName.equals("logo-url")) {
    255                         // TODO: it should be possible to specify the link for the logo
     255                        entry.setAttributionImageURL(accumulator.toString());
    256256                    } else if (qName.equals("terms-of-use-text")) {
    257                         // TODO: it should be possible to configure the terms of use display text
     257                        entry.setTermsOfUseText(accumulator.toString());
    258258                    } else if (qName.equals("terms-of-use-url")) {
    259259                        entry.setTermsOfUseURL(accumulator.toString());
Note: See TracChangeset for help on using the changeset viewer.