Class ImageryLayerInfo

java.lang.Object
org.openstreetmap.josm.data.imagery.ImageryLayerInfo

public class ImageryLayerInfo extends Object
Manages the list of imagery entries that are shown in the imagery menu.
  • Field Details

  • Constructor Details

  • Method Details

    • 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, 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(List<ImageryInfo> lst, Map<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(ImageryInfo iiA, ImageryInfo iiB)
    • isSimilar

      private static boolean isSimilar(String a, 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

      List of usable layers
      Returns:
      unmodifiable list containing usable layers
    • getDefaultLayers

      List of available default layers
      Returns:
      unmodifiable list containing available default layers
    • getAllDefaultLayers

      List of all available default layers (including mirrors)
      Returns:
      unmodifiable list containing available default layers
      Since:
      11570
    • addLayer

      public static void addLayer(ImageryInfo info)
    • addLayers

      public static void addLayers(Collection<ImageryInfo> infos)
    • getUniqueId

      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

      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