Ignore:
Timestamp:
2015-07-06T20:12:05+02:00 (5 years ago)
Author:
wiktorn
Message:

wms_endpoint now forwards information about available projection to ImageryInfo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r8510 r8576  
    1010import java.io.IOException;
    1111import java.net.MalformedURLException;
     12import java.util.HashSet;
     13import java.util.Set;
    1214
    1315import javax.swing.JComboBox;
     
    2527import org.openstreetmap.josm.gui.util.GuiHelper;
    2628import org.openstreetmap.josm.io.imagery.WMSImagery;
     29import org.openstreetmap.josm.io.imagery.WMSImagery.LayerDetails;
    2730import org.openstreetmap.josm.tools.GBC;
    2831import org.openstreetmap.josm.tools.ImageProvider;
     
    118121            final String url = wms.buildGetMapUrl(
    119122                    tree.getSelectedLayers(), (String) formats.getSelectedItem());
    120             return new ImageryInfo(info.getName(), url, "wms", info.getEulaAcceptanceRequired(), info.getCookies());
     123            Set<String> supportedCrs = new HashSet<>();
     124            {
     125                boolean first = true;
     126                for(LayerDetails layer: tree.getSelectedLayers()) {
     127                    if (first) {
     128                        supportedCrs.addAll(layer.getProjections());
     129                        first = false;
     130                    }
     131                    supportedCrs.retainAll(layer.getProjections());
     132                }
     133            }
     134            ImageryInfo ret = new ImageryInfo(info.getName(), url, "wms", info.getEulaAcceptanceRequired(), info.getCookies());
     135            ret.setServerProjections(supportedCrs);
     136            return ret;
    121137        } catch (MalformedURLException ex) {
    122138            JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."),
Note: See TracChangeset for help on using the changeset viewer.