Changeset 13890 in josm for trunk/src/org


Ignore:
Timestamp:
2018-06-04T20:27:55+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16357 - use English imagery names in changeset source tag

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r13828 r13890  
    1414import java.util.Map;
    1515import java.util.Objects;
     16import java.util.Optional;
    1617import java.util.Set;
    1718import java.util.TreeSet;
     
    15511552
    15521553    /**
     1554     * Determines if this imagery should be transparent.
    15531555     * @return should this imagery be transparent
    15541556     */
     
    15581560
    15591561    /**
    1560      *
     1562     * Sets whether imagery should be transparent.
    15611563     * @param transparent set to true if imagery should be transparent
    15621564     */
     
    15661568
    15671569    /**
     1570     * Returns minimum tile expiration in seconds.
    15681571     * @return minimum tile expiration in seconds
    15691572     */
     
    15731576
    15741577    /**
    1575      * Sets minimum tile expiration in seconds
     1578     * Sets minimum tile expiration in seconds.
    15761579     * @param minimumTileExpire minimum tile expiration in seconds
    15771580     */
    15781581    public void setMinimumTileExpire(int minimumTileExpire) {
    15791582        this.minimumTileExpire = minimumTileExpire;
    1580 
     1583    }
     1584
     1585    /**
     1586     * Get a string representation of this imagery info suitable for the {@code source} changeset tag.
     1587     * @return English name, if known
     1588     * @since 13890
     1589     */
     1590    public String getSourceName() {
     1591        if (ImageryType.BING.equals(getImageryType())) {
     1592            return "Bing";
     1593        } else {
     1594            if (id != null) {
     1595                // Retrieve english name, unfortunately not saved in preferences
     1596                Optional<ImageryInfo> infoEn = ImageryLayerInfo.allDefaultLayers.stream().filter(x -> id.equals(x.getId())).findAny();
     1597                if (infoEn.isPresent()) {
     1598                    return infoEn.get().getOriginalName();
     1599                }
     1600            }
     1601            return getOriginalName();
     1602        }
    15811603    }
    15821604}
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r13797 r13890  
    4343    private final Map<String, ImageryInfo> layerIds = new HashMap<>();
    4444    /** List of all available default layers */
    45     private static final List<ImageryInfo> defaultLayers = new ArrayList<>();
     45    static final List<ImageryInfo> defaultLayers = new ArrayList<>();
    4646    /** List of all available default layers (including mirrors) */
    47     private static final List<ImageryInfo> allDefaultLayers = new ArrayList<>();
     47    static final List<ImageryInfo> allDefaultLayers = new ArrayList<>();
    4848    /** List of all layer ids of available default layers (including mirrors) */
    49     private static final Map<String, ImageryInfo> defaultLayerIds = new HashMap<>();
     49    static final Map<String, ImageryInfo> defaultLayerIds = new HashMap<>();
    5050
    5151    private static final String[] DEFAULT_LAYER_SITES = {
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r13652 r13890  
    4343import org.openstreetmap.josm.data.ViewportData;
    4444import org.openstreetmap.josm.data.coor.EastNorth;
    45 import org.openstreetmap.josm.data.imagery.ImageryInfo;
    4645import org.openstreetmap.josm.data.osm.DataSelectionListener;
    4746import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
     
    828827        for (final ImageryLayer i : layerManager.getLayersOfType(ImageryLayer.class)) {
    829828            if (i.isVisible()) {
    830                 layerInfo.add(ImageryInfo.ImageryType.BING.equals(i.getInfo().getImageryType()) ? "Bing" : i.getName());
     829                layerInfo.add(i.getInfo().getSourceName());
    831830            }
    832831        }
Note: See TracChangeset for help on using the changeset viewer.