use 'max zoom level' from TileSource
This commit is contained in:
parent
923019a34a
commit
e24bba1e57
@ -35,7 +35,7 @@ public class BitmapTileLayer extends TileLayer<TileLoader> {
|
|||||||
final TileSource mTileSource;
|
final TileSource mTileSource;
|
||||||
|
|
||||||
public BitmapTileLayer(MapView mapView, TileSource tileSource) {
|
public BitmapTileLayer(MapView mapView, TileSource tileSource) {
|
||||||
super(mapView);
|
super(mapView, tileSource.getZoomLevelMax());
|
||||||
mTileSource = tileSource;
|
mTileSource = tileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import org.oscim.view.MapView;
|
|||||||
|
|
||||||
public abstract class TileLayer<T extends TileLoader> extends Layer {
|
public abstract class TileLayer<T extends TileLoader> extends Layer {
|
||||||
//private final static String TAG = TileLayer.class.getName();
|
//private final static String TAG = TileLayer.class.getName();
|
||||||
|
private final static int MAX_ZOOMLEVEL = 17;
|
||||||
|
|
||||||
private boolean mClearMap = true;
|
private boolean mClearMap = true;
|
||||||
|
|
||||||
@ -33,11 +34,15 @@ public abstract class TileLayer<T extends TileLoader> extends Layer {
|
|||||||
protected final ArrayList<T> mTileLoader;
|
protected final ArrayList<T> mTileLoader;
|
||||||
|
|
||||||
public TileLayer(MapView mapView) {
|
public TileLayer(MapView mapView) {
|
||||||
|
this(mapView, MAX_ZOOMLEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileLayer(MapView mapView, int maxZoom) {
|
||||||
super(mapView);
|
super(mapView);
|
||||||
|
|
||||||
// TileManager responsible for adding visible tiles
|
// TileManager responsible for adding visible tiles
|
||||||
// to load queue and managing in-memory tile cache.
|
// to load queue and managing in-memory tile cache.
|
||||||
mTileManager = new TileManager(mapView, this);
|
mTileManager = new TileManager(mapView, this, maxZoom);
|
||||||
|
|
||||||
mJobQueue = new JobQueue();
|
mJobQueue = new JobQueue();
|
||||||
|
|
||||||
|
|||||||
@ -46,9 +46,10 @@ public class TileManager {
|
|||||||
private static final int CACHE_TILES_MAX = 250;
|
private static final int CACHE_TILES_MAX = 250;
|
||||||
|
|
||||||
static final String TAG = TileManager.class.getSimpleName();
|
static final String TAG = TileManager.class.getSimpleName();
|
||||||
private final static int MAX_ZOOMLEVEL = 17;
|
|
||||||
private final static int MIN_ZOOMLEVEL = 2;
|
private final static int MIN_ZOOMLEVEL = 2;
|
||||||
|
|
||||||
|
private final int mMaxZoom;
|
||||||
|
|
||||||
// limit number tiles with new data not uploaded to GL
|
// limit number tiles with new data not uploaded to GL
|
||||||
// TODO this should depend on the number of tiles displayed
|
// TODO this should depend on the number of tiles displayed
|
||||||
private static final int MAX_TILES_IN_QUEUE = 40;
|
private static final int MAX_TILES_IN_QUEUE = 40;
|
||||||
@ -116,10 +117,11 @@ public class TileManager {
|
|||||||
private final float[] mBoxCoords = new float[8];
|
private final float[] mBoxCoords = new float[8];
|
||||||
private final TileLayer<?> mTileLayer;
|
private final TileLayer<?> mTileLayer;
|
||||||
|
|
||||||
public TileManager(MapView mapView, TileLayer<?> tileLayer) {
|
|
||||||
|
public TileManager(MapView mapView, TileLayer<?> tileLayer, int maxZoom) {
|
||||||
mMapView = mapView;
|
mMapView = mapView;
|
||||||
mTileLayer = tileLayer;
|
mTileLayer = tileLayer;
|
||||||
|
mMaxZoom = maxZoom;
|
||||||
mMapViewPosition = mapView.getMapViewPosition();
|
mMapViewPosition = mapView.getMapViewPosition();
|
||||||
mJobs = new ArrayList<MapTile>();
|
mJobs = new ArrayList<MapTile>();
|
||||||
mTiles = new MapTile[CACHE_TILES_MAX];
|
mTiles = new MapTile[CACHE_TILES_MAX];
|
||||||
@ -202,7 +204,7 @@ public class TileManager {
|
|||||||
// load some tiles more than currently visible (* 0.75)
|
// load some tiles more than currently visible (* 0.75)
|
||||||
double scale = pos.scale * 0.9f;
|
double scale = pos.scale * 0.9f;
|
||||||
|
|
||||||
int tileZoom = FastMath.clamp(pos.zoomLevel, MIN_ZOOMLEVEL, MAX_ZOOMLEVEL);
|
int tileZoom = FastMath.clamp(pos.zoomLevel, MIN_ZOOMLEVEL, mMaxZoom);
|
||||||
|
|
||||||
mMapViewPosition.getMapViewProjection(mBoxCoords);
|
mMapViewPosition.getMapViewProjection(mBoxCoords);
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class MapQuestAerial extends AbstractTileSource {
|
|||||||
public static final MapQuestAerial INSTANCE = new MapQuestAerial("otile1.mqcdn.com", 80);
|
public static final MapQuestAerial INSTANCE = new MapQuestAerial("otile1.mqcdn.com", 80);
|
||||||
private static final int PARALLEL_REQUESTS_LIMIT = 8;
|
private static final int PARALLEL_REQUESTS_LIMIT = 8;
|
||||||
private static final String PROTOCOL = "http";
|
private static final String PROTOCOL = "http";
|
||||||
private static final int ZOOM_LEVEL_MAX = 18;
|
private static final int ZOOM_LEVEL_MAX = 8;
|
||||||
private static final int ZOOM_LEVEL_MIN = 0;
|
private static final int ZOOM_LEVEL_MIN = 0;
|
||||||
|
|
||||||
public MapQuestAerial(String hostName, int port) {
|
public MapQuestAerial(String hostName, int port) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user