Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-04-29 14:44:39 +02:00
commit ab3d6eba90
3 changed files with 14 additions and 5 deletions

View file

@ -36,6 +36,13 @@ public class TileSourceManager {
public static final String RULE_YANDEX_TRAFFIC = "yandex_traffic"; public static final String RULE_YANDEX_TRAFFIC = "yandex_traffic";
private static final String RULE_WMS = "wms_tile"; 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 { public static class TileSourceTemplate implements ITileSource, Cloneable {
private int maxZoom; private int maxZoom;
private int minZoom; private int minZoom;
@ -413,20 +420,21 @@ public class TileSourceManager {
java.util.List<TileSourceTemplate> list = new ArrayList<TileSourceTemplate>(); java.util.List<TileSourceTemplate> list = new ArrayList<TileSourceTemplate>();
list.add(getMapnikSource()); list.add(getMapnikSource());
list.add(getCycleMapSource()); list.add(getCycleMapSource());
list.add(getMapillarySource());
return list; return list;
} }
public static TileSourceTemplate getMapnikSource(){ 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(){ 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() { 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<TileSourceTemplate> downloadTileSourceTemplates(String versionAsUrl) { public static List<TileSourceTemplate> downloadTileSourceTemplates(String versionAsUrl) {

View file

@ -84,7 +84,7 @@ public class MapillaryPlugin extends OsmandPlugin {
public void updateLayer(OsmandMapTileView mapView, MapTileLayer layer, float layerOrder) { public void updateLayer(OsmandMapTileView mapView, MapTileLayer layer, float layerOrder) {
ITileSource mapillarySource = null; ITileSource mapillarySource = null;
if (settings.SHOW_MAPILLARY.get()) { if (settings.SHOW_MAPILLARY.get()) {
mapillarySource = TileSourceManager.getMapillarySource(); mapillarySource = settings.getTileSourceByName(TileSourceManager.getMapillarySource().getName(), false);
} }
if (!Algorithms.objectEquals(mapillarySource, layer.getMap())) { if (!Algorithms.objectEquals(mapillarySource, layer.getMap())) {
if (mapillarySource == null) { if (mapillarySource == null) {

View file

@ -8,6 +8,7 @@ import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.mapillary.MapillaryPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.resources.ResourceManager;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
@ -148,7 +149,7 @@ public class MapTileLayer extends BaseMapLayer {
int width = (int) Math.ceil(tilesRect.right - left); int width = (int) Math.ceil(tilesRect.right - left);
int height = (int) Math.ceil(tilesRect.bottom + ellipticTileCorrection - top); 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(); settings.USE_INTERNET_TO_DOWNLOAD_TILES.get() && settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet();
int maxLevel = map.getMaximumZoomSupported(); int maxLevel = map.getMaximumZoomSupported();
int tileSize = map.getTileSize(); int tileSize = map.getTileSize();