Changeset 5445 in josm for trunk


Ignore:
Timestamp:
2012-08-15T15:06:01+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7963 - remotecontrol v1.4 : Add min_zoom and max_zoom parameters for /imagery command

Location:
trunk/src/org/openstreetmap/josm/io/remotecontrol
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControl.java

    r5009 r5445  
    2525     */
    2626    static final int protocolMajorVersion = 1;
    27     static final int protocolMinorVersion = 3;
     27    static final int protocolMinorVersion = 4;
    2828
    2929    /**
    30      * Returns an array of int values with major and minor API version
    31      * and major and minor HTTP protocol version.
    32      *
    33      * The function returns an int[4] instead of an object with fields
    34      * to avoid ClassNotFound errors with old versions of remotecontrol.
    35      *
    36      * @return array of integer version numbers:
    37      *    apiMajorVersion (obsolete), apiMinorVersion (obsolete), protocolMajorVersion, protocolMajorVersion
    38      */
    39     @Deprecated
    40     public int[] getVersion()
    41     {
    42         int versions[] = {1, 0, protocolMajorVersion, protocolMajorVersion};
    43         return versions;
    44     }
    45 
    46     /**
    47      * Start the remote control server
     30     * Starts the remote control server
    4831     */
    4932    public static void start() {
     
    5235
    5336    /**
    54      * Add external external request handler.
     37     * Adds external request handler.
    5538     * Can be used by plugins that want to use remote control.
    56      *
    57      * @param handler The additional request handler.
     39     *
     40     * @param command The command name.
     41     * @param handlerClass The additional request handler.
    5842     */
    5943    public void addRequestHandler(String command, Class<? extends RequestHandler> handlerClass)
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

    r5444 r5445  
    4949        String title = args.get("title");
    5050        String type = args.get("type");
    51         if ((title == null) || (title.length() == 0)) {
     51        if ((title == null) || (title.isEmpty())) {
    5252            title = tr("Remote imagery");
    5353        }
    5454        String cookies = args.get("cookies");
    55         ImageryLayer imgLayer = ImageryLayer.create(new ImageryInfo(title, url, type, null, cookies));
    56         Main.main.addLayer(imgLayer);
     55        ImageryInfo imgInfo = new ImageryInfo(title, url, type, null, cookies);
     56        String min_zoom = args.get("min_zoom");
     57        if (min_zoom != null && !min_zoom.isEmpty()) {
     58            try {
     59                imgInfo.setDefaultMinZoom(Integer.parseInt(min_zoom));
     60            } catch (NumberFormatException e) {
     61                System.err.println(e.getMessage());
     62            }
     63        }
     64        String max_zoom = args.get("max_zoom");
     65        if (max_zoom != null && !max_zoom.isEmpty()) {
     66            try {
     67                imgInfo.setDefaultMaxZoom(Integer.parseInt(max_zoom));
     68            } catch (NumberFormatException e) {
     69                System.err.println(e.getMessage());
     70            }
     71        }
     72        Main.main.addLayer(ImageryLayer.create(imgInfo));
    5773    }
    5874
Note: See TracChangeset for help on using the changeset viewer.