aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/MapProviderFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/maps/MapProviderFactory.java')
-rw-r--r--main/src/cgeo/geocaching/maps/MapProviderFactory.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
index 84c9329..a03fc47 100644
--- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java
+++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
@@ -69,6 +69,12 @@ public class MapProviderFactory {
parentMenu.setGroupCheckable(R.id.menu_group_map_sources, true, true);
}
+ /**
+ * Return a map source by id.
+ *
+ * @param id the map source id
+ * @return the map source, or <tt>null</tt> if <tt>id</tt> does not correspond to a registered map source
+ */
public static MapSource getMapSource(int id) {
for (MapSource mapSource : mapSources) {
if (mapSource.getNumericalId() == id) {
@@ -78,6 +84,15 @@ public class MapProviderFactory {
return null;
}
+ /**
+ * Return a map source if there is at least one.
+ *
+ * @return the first map source in the collection, or <tt>null</tt> if there are none registered
+ */
+ public static MapSource getAnyMapSource() {
+ return mapSources.isEmpty() ? null : mapSources.get(0);
+ }
+
public static void registerMapSource(final MapSource mapSource) {
mapSources.add(mapSource);
}