Class ImageryLayerInfo
java.lang.Object
org.openstreetmap.josm.data.imagery.ImageryLayerInfo
Manages the list of imagery entries that are shown in the imagery menu.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classLoader/updater of the available imagery entries -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final List<ImageryInfo>List of all available default layers (including mirrors)private static final String[](package private) static final Map<String,ImageryInfo> List of all layer ids of available default layers (including mirrors)(package private) static final List<ImageryInfo>List of all available default layersstatic final ImageryLayerInfoUnique instanceprivate final Map<String,ImageryInfo> List of layer ids of all usable layersprivate final List<ImageryInfo>List of all usable layers -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructs a newImageryLayerInfofrom an existing one. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ImageryInfo info) Add a new imagery entry.static voidaddLayer(ImageryInfo info) static voidaddLayers(Collection<ImageryInfo> infos) private static voidbuildIdMap(List<ImageryInfo> lst, Map<String, ImageryInfo> idMap) Build the mapping of unique ids toImageryInfos.voidclear()Clear the lists of layers.voidDrop entries with Id which do no longer exist (removed from defaults).List of all available default layers (including mirrors)List of available default layersstatic Collection<String>Returns the list of imagery layers sites.Returns imagery layer info for the given id.List of usable layersgetUniqueId(ImageryInfo info) Get unique id for ImageryInfo.private static booleanprivate static booleanisSimilar(ImageryInfo iiA, ImageryInfo iiB) voidload(boolean fastFail) Loads the custom as well as default imagery entries.voidloadDefaults(boolean clearCache, ExecutorService worker, boolean fastFail) Loads the available imagery entries.voidremove(ImageryInfo info) Remove an imagery entry.voidsave()Save the list of imagery entries to preferences.voidupdateEntriesFromDefaults(boolean dropold) Update user entries according to the list of default entries.
-
Field Details
-
instance
Unique instance -
layers
List of all usable layers -
layerIds
List of layer ids of all usable layers -
defaultLayers
List of all available default layers -
allDefaultLayers
List of all available default layers (including mirrors) -
defaultLayerIds
List of all layer ids of available default layers (including mirrors) -
DEFAULT_LAYER_SITES
-
-
Constructor Details
-
ImageryLayerInfo
private ImageryLayerInfo() -
ImageryLayerInfo
Constructs a newImageryLayerInfofrom an existing one.- Parameters:
info- info to copy
-
-
Method Details
-
getImageryLayersSites
Returns the list of imagery layers sites.- Returns:
- the list of imagery layers sites
- Since:
- 7434
-
clear
Clear the lists of layers. -
load
Loads the custom as well as default imagery entries.- Parameters:
fastFail- whether opening HTTP connections should fail fast, seeImageryReader.setFastFail(boolean)
-
loadDefaults
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 aPleaseWaitRunnablein the backgroundfastFail- whether opening HTTP connections should fail fast, seeImageryReader.setFastFail(boolean)- Since:
- 12634
-
buildIdMap
Build the mapping of unique ids toImageryInfos.- Parameters:
lst- input listidMap- output map
-
updateEntriesFromDefaults
Update user entries according to the list of default entries.- Parameters:
dropold- iftrueold entries should be removed- Since:
- 11706
-
dropOldEntries
Drop entries with Id which do no longer exist (removed from defaults).- Since:
- 11527
-
isSimilar
-
isSimilar
-
add
Add a new imagery entry.- Parameters:
info- imagery entry to add
-
remove
Remove an imagery entry.- Parameters:
info- imagery entry to remove
-
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
-
addLayers
-
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
-