Fix mapillary layer setting

This commit is contained in:
Alexey Kulish 2017-04-29 15:44:02 +03:00
parent d9589f286d
commit 16292f6c8f
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";
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<TileSourceTemplate> list = new ArrayList<TileSourceTemplate>();
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<TileSourceTemplate> downloadTileSourceTemplates(String versionAsUrl) {

View file

@ -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) {

View file

@ -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();