Ignore:
Timestamp:
2011-07-14T12:48:27+02:00 (15 years ago)
Author:
bastiK
Message:

see #6532 - add support for xml imagery source format

(todo: the specified server projections aren't used properly in WMSGrabber)

File:
1 edited

Legend:

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

    r4198 r4240  
    44import java.util.ArrayList;
    55import java.util.Collection;
     6import java.util.Collections;
     7import java.util.List;
    68import java.util.regex.Matcher;
    79import java.util.regex.Pattern;
     
    4244    private String name;
    4345    private String url = null;
     46    private boolean defaultEntry = false;
    4447    private String cookies = null;
    4548    private String eulaAcceptanceRequired= null;
     
    5053    private int defaultMinZoom = 0;
    5154    private Bounds bounds = null;
     55    private List<String> serverProjections;
    5256    private String attributionText;
    5357    private String attributionImage;
     
    5559    private String termsOfUseURL;
    5660
     61    public ImageryInfo() {
     62    }
     63
    5764    public ImageryInfo(String name) {
    5865        this.name=name;
     
    6168    public ImageryInfo(String name, String url) {
    6269        this.name=name;
    63         setUrl(url);
     70        setExtendedUrl(url);
    6471    }
    6572
    6673    public ImageryInfo(String name, String url, String eulaAcceptanceRequired) {
    6774        this.name=name;
    68         setUrl(url);
     75        setExtendedUrl(url);
    6976        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
    7077    }
     
    7279    public ImageryInfo(String name, String url, String eulaAcceptanceRequired, String cookies) {
    7380        this.name=name;
    74         setUrl(url);
     81        setExtendedUrl(url);
    7582        this.cookies=cookies;
    7683        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
     
    7986    public ImageryInfo(String name, String url, String cookies, double pixelPerDegree) {
    8087        this.name=name;
    81         setUrl(url);
     88        setExtendedUrl(url);
    8289        this.cookies=cookies;
    8390        this.pixelPerDegree=pixelPerDegree;
     
    8794        ArrayList<String> res = new ArrayList<String>();
    8895        res.add(name);
    89         res.add((url != null && !url.isEmpty()) ? getFullUrl() : null);
     96        res.add((url != null && !url.isEmpty()) ? getExtendedUrl() : null);
    9097        res.add(cookies);
    9198        if(imageryType == ImageryType.WMS || imageryType == ImageryType.HTML) {
     
    106113        this.name=array.get(0);
    107114        if(array.size() >= 2 && !array.get(1).isEmpty()) {
    108             setUrl(array.get(1));
     115            setExtendedUrl(array.get(1));
    109116        }
    110117        if(array.size() >= 3 && !array.get(2).isEmpty()) {
     
    178185    }
    179186
     187    public void setDefaultMaxZoom(int defaultMaxZoom) {
     188        this.defaultMaxZoom = defaultMaxZoom;
     189    }
     190
     191    public void setDefaultMinZoom(int defaultMinZoom) {
     192        this.defaultMinZoom = defaultMinZoom;
     193    }
     194   
    180195    public void setMaxZoom(int maxZoom) {
    181196        this.maxZoom = maxZoom;
     
    206221    }
    207222
    208     public void setUrl(String url) {
     223    public void setExtendedUrl(String url) {
    209224        CheckParameterUtil.ensureParameterNotNull(url);
    210225       
     
    244259    }
    245260
     261    public void setUrl(String url) {
     262        this.url = url;
     263    }
     264
     265    public boolean isDefaultEntry() {
     266        return defaultEntry;
     267    }
     268
     269    public void setDefaultEntry(boolean defaultEntry) {
     270        this.defaultEntry = defaultEntry;
     271    }
     272
    246273    public String getCookies() {
    247274        return this.cookies;
     
    264291    }
    265292
    266     public String getFullUrl() {
     293    public void setEulaAcceptanceRequired(String eulaAcceptanceRequired) {
     294        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
     295    }
     296
     297    /**
     298     * Get the projections supported by the server. Only relevant for
     299     * WMS-type ImageryInfo at the moment.
     300     * @return null, if no projections have been specified; the list
     301     * of supported projections otherwise.
     302     */
     303    public List<String> getServerProjections() {
     304        if (serverProjections == null) return null;
     305        return Collections.unmodifiableList(serverProjections);
     306    }
     307
     308    public void setServerProjections(Collection<String> serverProjections) {
     309        this.serverProjections = new ArrayList<String>(serverProjections);
     310    }
     311
     312    public String getExtendedUrl() {
    267313        return imageryType.getUrlString() + (defaultMaxZoom != 0
    268314            ? "["+(defaultMinZoom != 0 ? defaultMinZoom+",":"")+defaultMaxZoom+"]" : "") + ":" + url;
     
    331377    public ImageryType getImageryType() {
    332378        return imageryType;
     379    }
     380
     381    public void setImageryType(ImageryType imageryType) {
     382        this.imageryType = imageryType;
    333383    }
    334384
Note: See TracChangeset for help on using the changeset viewer.