Changeset 7760 in josm for trunk/src


Ignore:
Timestamp:
2014-12-01T21:14:03+01:00 (9 years ago)
Author:
Don-vip
Message:

see #10798 - remote control: special handling of Bing (default title and layer icon) for imagery handler

File:
1 edited

Legend:

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

    r7251 r7760  
    99import org.openstreetmap.josm.Main;
    1010import org.openstreetmap.josm.data.imagery.ImageryInfo;
     11import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     12import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
    1113import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1214import org.openstreetmap.josm.gui.util.GuiHelper;
     
    4648    }
    4749
     50    protected static ImageryInfo findBingEntry() {
     51        for (ImageryInfo i : ImageryLayerInfo.instance.getDefaultLayers()) {
     52            if (ImageryType.BING.equals(i.getImageryType())) {
     53                return i;
     54            }
     55        }
     56        return null;
     57    }
     58
    4859    @Override
    4960    protected void handleRequest() throws RequestHandlerErrorException {
     
    5162        String title = args.get("title");
    5263        String type = args.get("type");
    53         if ((title == null) || (title.isEmpty())) {
     64        final ImageryInfo bing = ImageryType.BING.getTypeString().equals(type) ? findBingEntry() : null;
     65        if ((title == null || title.isEmpty()) && bing != null) {
     66            title = bing.getName();
     67        }
     68        if (title == null || title.isEmpty()) {
    5469            title = tr("Remote imagery");
    5570        }
    5671        String cookies = args.get("cookies");
    5772        final ImageryInfo imgInfo = new ImageryInfo(title, url, type, null, cookies);
     73        if (bing != null) {
     74            imgInfo.setIcon(bing.getIcon());
     75        }
    5876        String min_zoom = args.get("min_zoom");
    5977        if (min_zoom != null && !min_zoom.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.