Changeset 7175 in josm for trunk


Ignore:
Timestamp:
2014-05-24T14:04:15+02:00 (7 years ago)
Author:
bastiK
Message:

add imagery url panel: by default request the transparent version of layer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r7033 r7175  
    104104    public String buildGetMapUrl(Collection<LayerDetails> selectedLayers, String format) {
    105105        return buildRootUrl()
    106                 + "FORMAT=" + format + "&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS="
     106                + "FORMAT=" + format + (imageFormatHasTransparency(format) ? "&TRANSPARENT=TRUE" : "")
     107                + "&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS="
    107108                + Utils.join(",", Utils.transform(selectedLayers, new Utils.Function<LayerDetails, String>() {
    108109            @Override
     
    153154        }
    154155        String incomingData = ba.toString();
     156        Main.debug("Server response to Capabilities request:");
     157        Main.debug(incomingData);
    155158
    156159        try {
     
    221224                || format.startsWith("image/bmp") && ImageIO.getImageReadersBySuffix("bmp").hasNext();
    222225    }
     226   
     227    static boolean imageFormatHasTransparency(final String format) {
     228        return format.startsWith("image/png") || format.startsWith("image/gif")
     229                || format.startsWith("image/svg") || format.startsWith("image/tiff");
     230    }
    223231
    224232    public ImageryInfo toImageryInfo(String name, Collection<LayerDetails> selectedLayers) {
Note: See TracChangeset for help on using the changeset viewer.