]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/gui/map/MapSourceLibrary.java
Version 19, May 2018
[GpsPrune.git] / tim / prune / gui / map / MapSourceLibrary.java
index 24833ce3e7be4ce8f7f288068768d155cf394ed6..5f44d5e64d4b757b012667cd2781c912cef325f9 100644 (file)
@@ -38,14 +38,21 @@ public abstract class MapSourceLibrary
         */
        private static void addFixedSources()
        {
-               _sourceList.add(new OsmMapSource("Mapnik", "http://tile.openstreetmap.org/"));
-               _sourceList.add(new OsmMapSource("Osma", "http://tah.openstreetmap.org/Tiles/tile/"));
-               _sourceList.add(new OsmMapSource("Cyclemap", "http://andy.sandbox.cloudmade.com/tiles/cycle/"));
-               _sourceList.add(new OsmMapSource("Reitkarte", "http://wanderreitkarte.de/hills/",
-                       "http://topo2.wanderreitkarte.de/topo/", 18));
-               _sourceList.add(new MffMapSource("Mapsforfree", "http://maps-for-free.com/layer/relief/", ".jpg",
-                       "http://maps-for-free.com/layer/water/", ".gif", 11));
-               _sourceList.add(new CloudmadeMapSource("Pale Dawn", "998", 18));
+               final String THUNDERFOREST_APIKEY = "c32212f10b13496786b98dc6c42e5c3c";
+               _sourceList.add(new OsmMapSource("Mapnik", "http://[abc].tile.openstreetmap.org/"));
+               OsmMapSource cycleSource = new OsmMapSource("OpenCycleMap", "http://[abc].tile.thunderforest.com/cycle/");
+               cycleSource.setApiKey(THUNDERFOREST_APIKEY);
+               _sourceList.add(cycleSource);
+               OsmMapSource outdoorsSource = new OsmMapSource("Outdoors", "http://[abc].tile.thunderforest.com/outdoors/");
+               outdoorsSource.setApiKey(THUNDERFOREST_APIKEY);
+               _sourceList.add(outdoorsSource);
+               _sourceList.add(new OsmMapSource("Reitkarte", "http://topo[234].wanderreitkarte.de/topo/"));
+               _sourceList.add(new MffMapSource("Mapsforfree", "http://maps-for-free.com/layer/relief/", "jpg",
+                       "http://maps-for-free.com/layer/water/", "gif", 11));
+               _sourceList.add(new OsmMapSource("Hikebikemap", "http://[abc].tiles.wmflabs.org/hikebike/",
+                       "http://[abc].tiles.wmflabs.org/hillshading/", 18));
+               _sourceList.add(new OsmMapSource("OpenSeaMap", "http://tile.openstreetmap.org/",
+                       "http://tiles.openseamap.org/seamark/", 18));
        }
 
        /**
@@ -62,7 +69,6 @@ public abstract class MapSourceLibrary
                        {
                                String sourceString = configString.substring(0, splitPos);
                                MapSource source = OsmMapSource.fromConfig(sourceString);
-                               if (source == null) {source = CloudmadeMapSource.fromConfig(sourceString);}
                                if (source != null) {
                                        _sourceList.add(source);
                                }
@@ -88,6 +94,23 @@ public abstract class MapSourceLibrary
                _sourceList.add(inSource);
        }
 
+       /**
+        * Edit the given MapSource object by replacing with a new one
+        * @param inOriginal existing MapSource object
+        * @param inNewSource new MapSource object
+        */
+       public static void editSource(MapSource inOriginal, MapSource inNewSource)
+       {
+               // Check whether original source is still there
+               int origPos = _sourceList.indexOf(inOriginal);
+               if (origPos < 0) {
+                       addSource(inNewSource);
+               }
+               else {
+                       _sourceList.set(origPos, inNewSource);
+               }
+       }
+
        /**
         * @param inIndex source index number
         * @return corresponding map source object