Use ThunderForest tiles only to level 19 because of licence to reduce tile requests

This commit is contained in:
jannis 2020-01-05 17:01:49 +01:00
parent 5e5203848d
commit dfdb2dbac3
3 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de> * Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
* *
* This file is part of FitoTrack * This file is part of FitoTrack
* *
@ -19,7 +19,6 @@
package de.tadris.fitness.map; package de.tadris.fitness.map;
import org.mapsforge.core.model.LatLong;
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; import org.mapsforge.map.android.graphics.AndroidGraphicFactory;
import org.mapsforge.map.android.util.AndroidUtil; import org.mapsforge.map.android.util.AndroidUtil;
import org.mapsforge.map.android.view.MapView; import org.mapsforge.map.android.view.MapView;
@ -42,7 +41,9 @@ public class MapManager {
switch (chosenTileLayer){ switch (chosenTileLayer){
case "osm.humanitarian": tileSource= HumanitarianTileSource.INSTANCE; break; case "osm.humanitarian": tileSource= HumanitarianTileSource.INSTANCE; break;
case "thunderforest.outdoors": tileSource= ThunderforestTileSource.OUTDOORS; break; case "thunderforest.outdoors": tileSource= ThunderforestTileSource.OUTDOORS; break;
case "thunderforest.cycle": tileSource= ThunderforestTileSource.CYLE_MAP; break; case "thunderforest.cycle":
tileSource = ThunderforestTileSource.CYCLE_MAP;
break;
default: tileSource= MapnikTileSource.INSTANCE; break; // Inclusive "osm.mapnik" default: tileSource= MapnikTileSource.INSTANCE; break; // Inclusive "osm.mapnik"
} }
tileSource.setUserAgent("mapsforge-android"); tileSource.setUserAgent("mapsforge-android");

View File

@ -29,10 +29,10 @@ public class ThunderforestTileSource extends FitoTrackTileSource{
private static final String API_KEY = "87b07337e42c405db6d8d39b1c0c179e"; private static final String API_KEY = "87b07337e42c405db6d8d39b1c0c179e";
public static final ThunderforestTileSource OUTDOORS = new ThunderforestTileSource("outdoors", "Outdoor"); public static final ThunderforestTileSource OUTDOORS = new ThunderforestTileSource("outdoors", "Outdoor");
public static final ThunderforestTileSource CYLE_MAP = new ThunderforestTileSource("cycle", "Cycle Map"); public static final ThunderforestTileSource CYCLE_MAP = new ThunderforestTileSource("cycle", "Cycle Map");
private static final int PARALLEL_REQUESTS_LIMIT = 8; private static final int PARALLEL_REQUESTS_LIMIT = 8;
private static final String PROTOCOL = "https"; private static final String PROTOCOL = "https";
private static final int ZOOM_LEVEL_MAX = 22; private static final int ZOOM_LEVEL_MAX = 19;
private static final int ZOOM_LEVEL_MIN = 0; private static final int ZOOM_LEVEL_MIN = 0;
private final String mapName; private final String mapName;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 Jannis Scheibe <jannis@tadris.de> * Copyright (c) 2020 Jannis Scheibe <jannis@tadris.de>
* *
* This file is part of FitoTrack * This file is part of FitoTrack
* *
@ -23,7 +23,7 @@ package de.tadris.fitness.map.tilesource;
public class TileSources { public class TileSources {
public static FitoTrackTileSource[] tileSources= new FitoTrackTileSource[]{ public static FitoTrackTileSource[] tileSources= new FitoTrackTileSource[]{
MapnikTileSource.INSTANCE, HumanitarianTileSource.INSTANCE, ThunderforestTileSource.OUTDOORS, ThunderforestTileSource.CYLE_MAP MapnikTileSource.INSTANCE, HumanitarianTileSource.INSTANCE, ThunderforestTileSource.OUTDOORS, ThunderforestTileSource.CYCLE_MAP
}; };
public enum Purpose{ public enum Purpose{