Changeset 15228 in josm for trunk/src/org


Ignore:
Timestamp:
2019-07-07T22:13:12+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #17801 - use selected image format when building WMS URL

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java

    r15209 r15228  
    185185            if (wms != null && wms.buildRootUrl() != null) {
    186186                // TODO: ask user about transparency
    187                 info = wms.toImageryInfo(getImageryName(), tree.getSelectedLayers(), (List<String>) null, true);
     187                info = wms.toImageryInfo(
     188                        getImageryName(), tree.getSelectedLayers(), (List<String>) null, (String) formats.getSelectedItem(), true);
    188189            } else {
    189190                info = new ImageryInfo(getImageryName(), getWmsUrl());
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r15209 r15228  
    311311     */
    312312    public String buildGetMapUrl(List<LayerDetails> selectedLayers, List<String> selectedStyles, boolean transparent) {
     313        return buildGetMapUrl(selectedLayers, selectedStyles, getPreferredFormat(), transparent);
     314    }
     315
     316    /**
     317     * @param selectedLayers selected layers as subset of the tree returned by {@link #getLayers()}
     318     * @param selectedStyles selected styles for all selectedLayers
     319     * @param format format of the response - one of {@link #getFormats()}
     320     * @param transparent whether returned images should contain transparent pixels (if supported by format)
     321     * @return URL template for GetMap service
     322     * @see #buildGetMapUrl(List, boolean)
     323     * @since 15228
     324     */
     325    public String buildGetMapUrl(List<LayerDetails> selectedLayers, List<String> selectedStyles, String format, boolean transparent) {
    313326        return buildGetMapUrl(
    314327                selectedLayers.stream().map(LayerDetails::getName).collect(Collectors.toList()),
    315328                selectedStyles,
    316                 getPreferredFormat(),
     329                format,
    317330                transparent);
    318331    }
     
    662675     * @param selectedLayers layers which are to be used by this imagery layer
    663676     * @param selectedStyles styles that should be used for selectedLayers
     677     * @param format format of the response - one of {@link #getFormats()}
    664678     * @param transparent if layer should be transparent
    665679     * @return ImageryInfo object
    666      */
    667     public ImageryInfo toImageryInfo(String name, List<LayerDetails> selectedLayers, List<String> selectedStyles, boolean transparent) {
    668         ImageryInfo i = new ImageryInfo(name, buildGetMapUrl(selectedLayers, selectedStyles, transparent));
     680     * @since 15228
     681     */
     682    public ImageryInfo toImageryInfo(
     683            String name, List<LayerDetails> selectedLayers, List<String> selectedStyles, String format, boolean transparent) {
     684        ImageryInfo i = new ImageryInfo(name, buildGetMapUrl(selectedLayers, selectedStyles, format, transparent));
    669685        if (selectedLayers != null && !selectedLayers.isEmpty()) {
    670686            i.setServerProjections(getServerProjections(selectedLayers));
Note: See TracChangeset for help on using the changeset viewer.