Changeset 13879 in josm
- Timestamp:
- 2018-05-31T10:02:31+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r13872 r13879 11 11 import java.io.IOException; 12 12 import java.net.MalformedURLException; 13 import java.util.ArrayList;14 13 import java.util.Collection; 14 import java.util.Collections; 15 15 import java.util.List; 16 16 import java.util.stream.Collectors; … … 104 104 // specify which layer to use 105 105 if (info.getDefaultLayers() == null || info.getDefaultLayers().isEmpty()) { 106 DefaultLayer layerId = new WMTSTileSource(info).userSelectLayer(); 106 WMTSTileSource tileSource = new WMTSTileSource(info); 107 DefaultLayer layerId = tileSource.userSelectLayer(); 107 108 if (layerId != null) { 108 109 ImageryInfo copy = new ImageryInfo(info); 109 List<DefaultLayer> defaultLayers = new ArrayList<>(1); 110 defaultLayers.add(layerId); 111 copy.setDefaultLayers(defaultLayers); 110 copy.setDefaultLayers(Collections.singletonList(layerId)); 111 String layerName = tileSource.getLayers().stream() 112 .filter(x -> x.getIdentifier().equals(layerId.getLayerName())) 113 .map(x -> x.getUserTitle()) 114 .findFirst() 115 .orElse(""); 116 copy.setName(copy.getName() + ": " + layerName); 112 117 return copy; 113 118 } -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r13828 r13879 1108 1108 return tileProjection != null ? tileProjection.toCode() : null; 1109 1109 } 1110 1111 /** 1112 * Layers that can be used with this tile source 1113 * @return unmodifiable collection of layers available in this tile source 1114 * @since 13879 1115 */ 1116 public Collection<Layer> getLayers() { 1117 return Collections.unmodifiableCollection(layers); 1118 } 1110 1119 }
Note:
See TracChangeset
for help on using the changeset viewer.