Changeset 4861 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
23.01.2012 18:37:24 (4 months ago)
Author:
bastiK
Message:

remotecontrol: add 'type' parameter for /imagery request (this should be extended further)

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r4856 r4861  
    4040 
    4141        private String urlString; 
     42 
    4243        ImageryType(String urlString) { 
    4344            this.urlString = urlString; 
    4445        } 
     46 
    4547        public String getUrlString() { 
    4648            return urlString; 
     49        } 
     50         
     51        public static ImageryType fromUrlString(String s) { 
     52            for (ImageryType type : ImageryType.values()) { 
     53                if (type.getUrlString().equals(s)) { 
     54                    return type; 
     55                } 
     56            } 
     57            return null; 
    4758        } 
    4859    } 
     
    180191    } 
    181192 
     193    public ImageryInfo(String name, String url, String type, String eulaAcceptanceRequired, String cookies) { 
     194        this.name=name; 
     195        setExtendedUrl(url); 
     196        ImageryType t = ImageryType.fromUrlString(type); 
     197        this.cookies=cookies; 
     198        if (t != null) { 
     199            this.imageryType = t; 
     200        } 
     201    } 
     202 
    182203    public ImageryInfo(String name, String url, String cookies, double pixelPerDegree) { 
    183204        this.name=name; 
     
    194215        cookies = e.cookies; 
    195216        eulaAcceptanceRequired = e.eula; 
    196         for (ImageryType type : ImageryType.values()) { 
    197             if (type.getUrlString().equals(e.type)) { 
    198                 imageryType = type; 
    199                 break; 
    200             } 
    201         } 
     217        imageryType = ImageryType.fromUrlString(e.type); 
    202218        if (imageryType == null) throw new IllegalArgumentException("unknown type"); 
    203219        pixelPerDegree = e.pixel_per_eastnorth; 
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java

    r3715 r4861  
    3333     */ 
    3434    static final int protocolMajorVersion = 1; 
    35     static final int protocolMinorVersion = 2; 
     35    static final int protocolMinorVersion = 3; 
    3636 
    3737    /** 
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

    r4834 r4861  
    4444        String url = args.get("url"); 
    4545        String title = args.get("title"); 
     46        String type = args.get("type"); 
    4647        if((title == null) || (title.length() == 0)) 
    4748        { 
     
    4950        } 
    5051        String cookies = args.get("cookies"); 
    51         ImageryLayer imgLayer = ImageryLayer.create(new ImageryInfo(title, url, cookies)); 
     52        ImageryLayer imgLayer = ImageryLayer.create(new ImageryInfo(title, url, type, null, cookies)); 
    5253        Main.main.addLayer(imgLayer); 
    53  
    5454    } 
    5555 
Note: See TracChangeset for help on using the changeset viewer.