Class ImageryLayerInfo


  • public class ImageryLayerInfo
    extends java.lang.Object
    Manages the list of imagery entries that are shown in the imagery menu.
    • Method Detail

      • getImageryLayersSites

        public static java.util.Collection<java.lang.String> getImageryLayersSites()
        Returns the list of imagery layers sites.
        Returns:
        the list of imagery layers sites
        Since:
        7434
      • clear

        public void clear()
        Clear the lists of layers.
      • load

        public void load​(boolean fastFail)
        Loads the custom as well as default imagery entries.
        Parameters:
        fastFail - whether opening HTTP connections should fail fast, see ImageryReader.setFastFail(boolean)
      • loadDefaults

        public void loadDefaults​(boolean clearCache,
                                 java.util.concurrent.ExecutorService worker,
                                 boolean fastFail)
        Loads the available imagery entries. The data is downloaded from the JOSM website (or loaded from cache). Entries marked as "default" are added to the user selection, if not already present.
        Parameters:
        clearCache - if true, clear the cache and start a fresh download.
        worker - executor service which will perform the loading. If null, it should be performed using a PleaseWaitRunnable in the background
        fastFail - whether opening HTTP connections should fail fast, see ImageryReader.setFastFail(boolean)
        Since:
        12634
      • buildIdMap

        private static void buildIdMap​(java.util.List<ImageryInfo> lst,
                                       java.util.Map<java.lang.String,​ImageryInfo> idMap)
        Build the mapping of unique ids to ImageryInfos.
        Parameters:
        lst - input list
        idMap - output map
      • updateEntriesFromDefaults

        public void updateEntriesFromDefaults​(boolean dropold)
        Update user entries according to the list of default entries.
        Parameters:
        dropold - if true old entries should be removed
        Since:
        11706
      • dropOldEntries

        public void dropOldEntries()
        Drop entries with Id which do no longer exist (removed from defaults).
        Since:
        11527
      • isSimilar

        private static boolean isSimilar​(java.lang.String a,
                                         java.lang.String b)
      • add

        public void add​(ImageryInfo info)
        Add a new imagery entry.
        Parameters:
        info - imagery entry to add
      • remove

        public void remove​(ImageryInfo info)
        Remove an imagery entry.
        Parameters:
        info - imagery entry to remove
      • save

        public void save()
        Save the list of imagery entries to preferences.
      • getLayers

        public java.util.List<ImageryInfogetLayers()
        List of usable layers
        Returns:
        unmodifiable list containing usable layers
      • getDefaultLayers

        public java.util.List<ImageryInfogetDefaultLayers()
        List of available default layers
        Returns:
        unmodifiable list containing available default layers
      • getAllDefaultLayers

        public java.util.List<ImageryInfogetAllDefaultLayers()
        List of all available default layers (including mirrors)
        Returns:
        unmodifiable list containing available default layers
        Since:
        11570
      • getUniqueId

        public java.lang.String getUniqueId​(ImageryInfo info)
        Get unique id for ImageryInfo. This takes care, that no id is used twice (due to a user error)
        Parameters:
        info - the ImageryInfo to look up
        Returns:
        null, if there is no id or the id is used twice, the corresponding id otherwise
      • getLayer

        public ImageryInfo getLayer​(java.lang.String id)
        Returns imagery layer info for the given id.
        Parameters:
        id - imagery layer id.
        Returns:
        imagery layer info for the given id, or null
        Since:
        13797