diff --git a/OsmAnd-java/src/net/osmand/map/TileSourceManager.java b/OsmAnd-java/src/net/osmand/map/TileSourceManager.java index ae4f8adc2a..41fb30dbd1 100644 --- a/OsmAnd-java/src/net/osmand/map/TileSourceManager.java +++ b/OsmAnd-java/src/net/osmand/map/TileSourceManager.java @@ -36,6 +36,13 @@ public class TileSourceManager { public static final String RULE_YANDEX_TRAFFIC = "yandex_traffic"; private static final String RULE_WMS = "wms_tile"; + private static final TileSourceTemplate MAPNIK_SOURCE = + new TileSourceTemplate("OsmAnd (online tiles)", "http://tile.osmand.net/hd/{0}/{1}/{2}.png", ".png", 19, 1, 512, 8, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + private static final TileSourceTemplate CYCLE_MAP_SOURCE = + new TileSourceTemplate("CycleMap", "http://b.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", ".png", 16, 1, 256, 32, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + private static final TileSourceTemplate MAPILLARY_SOURCE = + new TileSourceTemplate("Mapillary (raster tiles)", "https://d6a1v2w10ny40.cloudfront.net/v0.1/{0}/{1}/{2}.png", ".png", 17, 0, 256, 16, 32000); + public static class TileSourceTemplate implements ITileSource, Cloneable { private int maxZoom; private int minZoom; @@ -413,20 +420,21 @@ public class TileSourceManager { java.util.List list = new ArrayList(); list.add(getMapnikSource()); list.add(getCycleMapSource()); + list.add(getMapillarySource()); return list; } public static TileSourceTemplate getMapnikSource(){ - return new TileSourceTemplate("OsmAnd (online tiles)", "http://tile.osmand.net/hd/{0}/{1}/{2}.png", ".png", 19, 1, 512, 8, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + return MAPNIK_SOURCE; } public static TileSourceTemplate getCycleMapSource(){ - return new TileSourceTemplate("CycleMap", "http://b.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", ".png", 16, 1, 256, 32, 18000); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + return CYCLE_MAP_SOURCE; } public static TileSourceTemplate getMapillarySource() { - return new TileSourceTemplate("Mapillary (raster tiles)", "https://d6a1v2w10ny40.cloudfront.net/v0.1/{0}/{1}/{2}.png", ".png", 17, 0, 256, 16, 32000); + return MAPILLARY_SOURCE; } public static List downloadTileSourceTemplates(String versionAsUrl) { diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java index d48c231afa..3c199999c8 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java @@ -84,7 +84,7 @@ public class MapillaryPlugin extends OsmandPlugin { public void updateLayer(OsmandMapTileView mapView, MapTileLayer layer, float layerOrder) { ITileSource mapillarySource = null; if (settings.SHOW_MAPILLARY.get()) { - mapillarySource = TileSourceManager.getMapillarySource(); + mapillarySource = settings.getTileSourceByName(TileSourceManager.getMapillarySource().getName(), false); } if (!Algorithms.objectEquals(mapillarySource, layer.getMap())) { if (mapillarySource == null) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java index 437037f882..eebe9ba458 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java @@ -8,6 +8,7 @@ import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; +import net.osmand.plus.mapillary.MapillaryPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.resources.ResourceManager; import net.osmand.util.MapUtils; @@ -148,7 +149,7 @@ public class MapTileLayer extends BaseMapLayer { int width = (int) Math.ceil(tilesRect.right - left); int height = (int) Math.ceil(tilesRect.bottom + ellipticTileCorrection - top); - boolean useInternet = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null && + boolean useInternet = (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null || OsmandPlugin.getEnabledPlugin(MapillaryPlugin.class) != null) && settings.USE_INTERNET_TO_DOWNLOAD_TILES.get() && settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet(); int maxLevel = map.getMaximumZoomSupported(); int tileSize = map.getTileSize();