Create tile map layer

This commit is contained in:
Victor Shcherb 2011-05-22 13:34:03 +02:00
parent be89dc00f5
commit f26b8a2728
17 changed files with 264 additions and 126 deletions

View file

@ -15,7 +15,6 @@ import android.graphics.RectF;
public class RendererLayer implements OsmandMapLayer {
private OsmandMapTileView view;
private final static int startZoom = 5;
private Rect pixRect = new Rect();
private RotatedTileBox rotatedTileBox = new RotatedTileBox(0, 0, 0, 0, 0, 0);
private ResourceManager resourceManager;
@ -51,9 +50,8 @@ public class RendererLayer implements OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
Integer zoom = view.getSettings().LEVEL_TO_SWITCH_VECTOR_RASTER.get();
if (view.getZoom() >= Math.max(zoom, startZoom) && view.isVectorDataVisible()) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (view.isVectorDataVisible()) {
if (!view.isZooming()){
pixRect.set(0, 0, view.getWidth(), view.getHeight());
updateRotatedTileBox();

View file

@ -93,7 +93,7 @@ public class ContextMenuLayer implements OsmandMapLayer {
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if(latLon != null){
int x = view.getMapXForPoint(latLon.getLongitude());
int y = view.getMapYForPoint(latLon.getLatitude());

View file

@ -87,7 +87,7 @@ public class FavoritesLayer implements OsmandMapLayer, ContextMenuLayer.IContext
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (view.getZoom() >= startZoom) {

View file

@ -50,7 +50,7 @@ public class GPXLayer implements OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if(points.isEmpty()){
return;
}

View file

@ -189,7 +189,7 @@ public class MapInfoLayer implements OsmandMapLayer {
}
@Override
public void onDraw(Canvas canvas, RectF latlonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latlonBounds, RectF tilesRect, boolean nightMode) {
// prepare data (left distance, speed)
if(map.getPointToNavigate() != null){
int d = 0;

View file

@ -0,0 +1,206 @@
package net.osmand.plus.views;
import net.osmand.map.ITileSource;
import net.osmand.osm.MapUtils;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ResourceManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.util.FloatMath;
public class MapTileLayer implements OsmandMapLayer {
protected final int emptyTileDivisor = 16;
public static final int OVERZOOM_IN = 2;
private ITileSource map = null;
Paint paintGrayFill;
Paint paintBlackFill;
Paint paintWhiteFill;
Paint paintBitmap;
protected RectF tilesRect = new RectF();
protected RectF latlonRect = new RectF();
protected RectF bitmapToDraw = new RectF();
protected Rect bitmapToZoom = new Rect();
private OsmandMapTileView view;
private ResourceManager resourceManager;
private OsmandSettings settings;
private boolean visible = true;
@Override
public boolean drawInScreenPixels() {
return false;
}
@Override
public void initLayer(OsmandMapTileView view) {
this.view = view;
settings = view.getSettings();
resourceManager = view.getApplication().getResourceManager();
paintGrayFill = new Paint();
paintGrayFill.setColor(Color.GRAY);
paintGrayFill.setStyle(Style.FILL);
// when map rotate
paintGrayFill.setAntiAlias(true);
paintBlackFill= new Paint();
paintBlackFill.setColor(Color.BLACK);
paintBlackFill.setStyle(Style.FILL);
// when map rotate
paintBlackFill.setAntiAlias(true);
paintWhiteFill = new Paint();
paintWhiteFill.setColor(Color.WHITE);
paintWhiteFill.setStyle(Style.FILL);
// when map rotate
paintWhiteFill.setAntiAlias(true);
paintBitmap = new Paint();
paintBitmap.setFilterBitmap(true);
}
@Override
public void onDraw(Canvas canvas, RectF latlonRect, RectF tilesRect, boolean nightMode) {
if (map == null || !visible) {
return;
}
ResourceManager mgr = resourceManager;
int nzoom = view.getZoom();
float tileX = view.getXTile();
float tileY = view.getYTile();
float w = view.getCenterPointX();
float h = view.getCenterPointY();
float ftileSize = view.getTileSize();
int left = (int) FloatMath.floor(tilesRect.left);
int top = (int) FloatMath.floor(tilesRect.top);
int width = (int) FloatMath.ceil(tilesRect.right - left);
int height = (int) FloatMath.ceil(tilesRect.bottom - top);
boolean useInternet = settings.USE_INTERNET_TO_DOWNLOAD_TILES.get()
&& settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet();
int maxLevel = Math.min(view.getSettings().MAX_LEVEL_TO_DOWNLOAD_TILE.get(), map.getMaximumZoomSupported());
int tileSize = map.getTileSize();
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int leftPlusI = (int) FloatMath.floor((float) MapUtils
.getTileNumberX(nzoom, MapUtils.getLongitudeFromTile(nzoom, left + i)));
int topPlusJ = (int) FloatMath.floor((float) MapUtils.getTileNumberY(nzoom, MapUtils.getLatitudeFromTile(nzoom, top + j)));
float x1 = (left + i - tileX) * ftileSize + w;
float y1 = (top + j - tileY) * ftileSize + h;
String ordImgTile = mgr.calculateTileId(map, leftPlusI, topPlusJ, nzoom);
// asking tile image async
boolean imgExist = mgr.tileExistOnFileSystem(ordImgTile, map, leftPlusI, topPlusJ, nzoom);
Bitmap bmp = null;
boolean originalBeLoaded = useInternet && nzoom <= maxLevel;
if (imgExist || originalBeLoaded) {
bmp = mgr.getTileImageForMapAsync(ordImgTile, map, leftPlusI, topPlusJ, nzoom, useInternet);
}
if (bmp == null) {
int div = 2;
// asking if there is small version of the map (in cache)
String imgTile2 = mgr.calculateTileId(map, leftPlusI / 2, topPlusJ / 2, nzoom - 1);
String imgTile4 = mgr.calculateTileId(map, leftPlusI / 4, topPlusJ / 4, nzoom - 2);
if (originalBeLoaded || imgExist) {
bmp = mgr.getTileImageFromCache(imgTile2);
div = 2;
if (bmp == null) {
bmp = mgr.getTileImageFromCache(imgTile4);
div = 4;
}
}
if (!originalBeLoaded && !imgExist) {
if (mgr.tileExistOnFileSystem(imgTile2, map, leftPlusI / 2, topPlusJ / 2, nzoom - 1)
|| (useInternet && nzoom - 1 <= maxLevel)) {
bmp = mgr.getTileImageForMapAsync(imgTile2, map, leftPlusI / 2, topPlusJ / 2, nzoom - 1, useInternet);
div = 2;
} else if (mgr.tileExistOnFileSystem(imgTile4, map, leftPlusI / 4, topPlusJ / 4, nzoom - 2)
|| (useInternet && nzoom - 2 <= maxLevel)) {
bmp = mgr.getTileImageForMapAsync(imgTile4, map, leftPlusI / 4, topPlusJ / 4, nzoom - 2, useInternet);
div = 4;
}
}
if (bmp != null) {
int xZoom = ((left + i) % div) * tileSize / div;
int yZoom = ((top + j) % div) * tileSize / div;
bitmapToZoom.set(xZoom, yZoom, xZoom + tileSize / div, yZoom + tileSize / div);
bitmapToDraw.set(x1, y1, x1 + ftileSize, y1 + ftileSize);
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
}
} else {
bitmapToZoom.set(0, 0, tileSize, tileSize);
bitmapToDraw.set(x1, y1, x1 + ftileSize, y1 + ftileSize);
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
}
}
}
}
public int getSourceTileSize() {
return map == null ? 256 : map.getTileSize();
}
public int getMaximumShownMapZoom(){
if(map == null){
return 20;
} else {
return map.getMaximumZoomSupported() + OVERZOOM_IN;
}
}
public int getMinimumShownMapZoom(){
if(map == null){
return 1;
} else {
return map.getMinimumZoomSupported();
}
}
@Override
public void destroyLayer() {
// TODO clear map cache
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
// TODO clear map cache
}
public ITileSource getMap() {
return map;
}
public void setMap(ITileSource map) {
this.map = map;
}
@Override
public boolean onLongPressEvent(PointF point) {
return false;
}
@Override
public boolean onTouchEvent(PointF point) {
return false;
}
}

View file

@ -117,7 +117,7 @@ public class OsmBugsLayer implements OsmandMapLayer, ContextMenuLayer.IContextMe
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (view.getZoom() >= startZoom) {
// request to load
requestToLoad(latLonBounds.top, latLonBounds.left, latLonBounds.bottom, latLonBounds.right, view.getZoom());

View file

@ -9,7 +9,7 @@ public interface OsmandMapLayer {
public void initLayer(OsmandMapTileView view);
public void onDraw(Canvas canvas, RectF latlonRect, boolean nightMode);
public void onDraw(Canvas canvas, RectF latlonRect, RectF tilesRect, boolean nightMode);
public void destroyLayer();

View file

@ -15,7 +15,6 @@ import net.osmand.map.ITileSource;
import net.osmand.osm.LatLon;
import net.osmand.osm.MapUtils;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.ResourceManager;
import net.osmand.plus.activities.OsmandApplication;
import net.osmand.plus.views.AnimateDraggingMapThread.AnimateDraggingCallback;
import net.osmand.plus.views.MultiTouchSupport.MultiTouchZoomListener;
@ -23,7 +22,6 @@ import net.osmand.plus.views.MultiTouchSupport.MultiTouchZoomListener;
import org.apache.commons.logging.Log;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@ -48,7 +46,6 @@ import android.view.SurfaceHolder.Callback;
public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCallback, Callback, AnimateDraggingCallback, OnGestureListener,
OnDoubleTapListener, MultiTouchZoomListener {
public static final int OVERZOOM_IN = 2;
protected final int emptyTileDivisor = 16;
@ -84,9 +81,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
private boolean showMapPosition = true;
// name of source map
private ITileSource map = null;
private boolean vectorData;
private IMapLocationListener locationListener;
@ -98,6 +92,9 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
private OnTrackBallListener trackBallDelegate;
private List<OsmandMapLayer> layers = new ArrayList<OsmandMapLayer>();
private MapTileLayer mainLayer = new MapTileLayer();
private Map<OsmandMapLayer, Float> zOrders = new HashMap<OsmandMapLayer, Float>();
// UI Part
@ -118,7 +115,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
Paint paintBlackFill;
Paint paintWhiteFill;
Paint paintCenter;
Paint paintBitmap;
private DisplayMetrics dm;
@ -126,14 +122,15 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
public OsmandMapTileView(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
application = (OsmandApplication) context.getApplicationContext();
initView();
}
public OsmandMapTileView(Context context) {
super(context);
initView();
application = (OsmandApplication) context.getApplicationContext();
initView();
}
// ///////////////////////////// INITIALIZING UI PART ///////////////////////////////////
@ -162,9 +159,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
paintCenter.setStrokeWidth(2);
paintCenter.setAntiAlias(true);
paintBitmap = new Paint();
paintBitmap.setFilterBitmap(true);
setClickable(true);
setLongClickable(true);
setFocusable(true);
@ -180,6 +174,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
WindowManager mgr = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
dm = new DisplayMetrics();
mgr.getDefaultDisplay().getMetrics(dm);
mainLayer.initLayer(this);
}
@Override
@ -242,7 +238,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
}
public int getSourceTileSize() {
return map == null || vectorData ? 256 : map.getTileSize();
return vectorData ? 256 : mainLayer.getSourceTileSize();
}
/**
@ -260,18 +256,18 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
}
public int getMaximumShownMapZoom(){
if(map == null || vectorData){
if(vectorData){
return 21;
} else {
return map.getMaximumZoomSupported() + OVERZOOM_IN;
return mainLayer.getMaximumShownMapZoom();
}
}
public int getMinimumShownMapZoom(){
if(map == null || vectorData){
if(vectorData){
return 1;
} else {
return map.getMinimumZoomSupported();
return mainLayer.getMinimumShownMapZoom();
}
}
@ -286,8 +282,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
// for internal usage
@Override
public void zoomTo(float zoom, boolean notify) {
if ((map == null && zoom < 23)
|| (map != null && (map.getMaximumZoomSupported() + OVERZOOM_IN) >= zoom && map.getMinimumZoomSupported() <= zoom)) {
if ((vectorData && zoom < 23)
|| (!vectorData && getMaximumShownMapZoom() >= zoom && getMinimumShownMapZoom() <= zoom)) {
this.zoom = zoom;
refreshMap();
if (notify && locationListener != null) {
@ -316,16 +312,16 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
}
public ITileSource getMap() {
return map;
return mainLayer.getMap();
}
public void setMap(ITileSource map) {
this.map = map;
if (map != null && map.getMaximumZoomSupported() + OVERZOOM_IN < this.zoom) {
zoom = map.getMaximumZoomSupported() + OVERZOOM_IN;
mainLayer.setMap(map);
if (mainLayer.getMaximumShownMapZoom() < this.zoom) {
zoom = mainLayer.getMaximumShownMapZoom();
}
if (map != null && map.getMinimumZoomSupported() > this.zoom) {
zoom = map.getMinimumZoomSupported();
if (mainLayer.getMinimumShownMapZoom() > this.zoom) {
zoom = mainLayer.getMinimumShownMapZoom();
}
refreshMap();
}
@ -408,19 +404,26 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
this.mapPosition = type;
}
private void drawOverMap(Canvas canvas, RectF latlonRect, boolean nightMode) {
private void drawOverMap(Canvas canvas, RectF latlonRect, RectF tilesRect, boolean nightMode) {
int w = getCenterPointX();
int h = getCenterPointY();
canvas.restore();
for (int i = 0; i < layers.size(); i++) {
for (int i = -1; i < layers.size(); i++) {
try {
OsmandMapLayer layer = layers.get(i);
OsmandMapLayer layer;
if (i == -1) {
layer = mainLayer;
mainLayer.setVisible(!isVectorDataVisible());
} else {
layer = layers.get(i);
}
canvas.save();
if (!layer.drawInScreenPixels()) {
canvas.rotate(rotate, w, h);
}
layer.onDraw(canvas, latlonRect, nightMode);
layer.onDraw(canvas, latlonRect, tilesRect, nightMode);
canvas.restore();
} catch (IndexOutOfBoundsException e) {
// skip it
@ -489,8 +492,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
MapTileDownloader.getInstance().refuseAllPreviousRequests();
}
float ftileSize = getTileSize();
int tileSize = getSourceTileSize();
SurfaceHolder holder = getHolder();
synchronized (holder) {
@ -503,99 +504,32 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
if (canvas != null) {
canvas.save();
boolean nightMode = false;
if(application != null){
if (application != null) {
Boolean dayNightRenderer = application.getDaynightHelper().getDayNightRenderer();
if(dayNightRenderer != null){
if (dayNightRenderer != null) {
nightMode = !dayNightRenderer.booleanValue();
}
}
boundsRect.set(0, 0, getWidth(), getHeight());
canvas.rotate(rotate, w, h);
try {
boundsRect.set(0, 0, getWidth(), getHeight());
calculateTileRectangle(boundsRect, w, h, tileX, tileY, tilesRect);
int left = (int) FloatMath.floor(tilesRect.left);
int top = (int) FloatMath.floor(tilesRect.top );
int top = (int) FloatMath.floor(tilesRect.top);
int width = (int) FloatMath.ceil(tilesRect.right - left);
int height = (int) FloatMath.ceil(tilesRect.bottom - top);
latlonRect.top = (float) MapUtils.getLatitudeFromTile(nzoom, tilesRect.top);
latlonRect.left = (float) MapUtils.getLongitudeFromTile(nzoom, tilesRect.left);
latlonRect.bottom = (float) MapUtils.getLatitudeFromTile(nzoom, tilesRect.bottom);
latlonRect.right = (float) MapUtils.getLongitudeFromTile(nzoom, tilesRect.right);
if (map != null && !isVectorDataVisible()) {
ResourceManager mgr = getApplication().getResourceManager();
useInternet = useInternet && settings.isInternetConnectionAvailable()
&& map.couldBeDownloadedFromInternet();
int maxLevel = Math.min(getSettings().MAX_LEVEL_TO_DOWNLOAD_TILE.get(), map.getMaximumZoomSupported());
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int leftPlusI = (int) FloatMath.floor((float)MapUtils.getTileNumberX(nzoom, MapUtils.getLongitudeFromTile(nzoom, left+i)));
int topPlusJ = (int) FloatMath.floor((float)MapUtils.getTileNumberY(nzoom, MapUtils.getLatitudeFromTile(nzoom, top + j)));
float x1 = (left + i - tileX) * ftileSize + w;
float y1 = (top + j - tileY) * ftileSize + h;
String ordImgTile = mgr.calculateTileId(map, leftPlusI, topPlusJ, nzoom);
// asking tile image async
boolean imgExist = mgr.tileExistOnFileSystem(ordImgTile, map, leftPlusI, topPlusJ, nzoom);
Bitmap bmp = null;
boolean originalBeLoaded = useInternet && nzoom <= maxLevel;
if (imgExist || originalBeLoaded) {
bmp = mgr.getTileImageForMapAsync(ordImgTile, map, leftPlusI, topPlusJ, nzoom, useInternet);
}
if (bmp == null) {
int div = 2;
// asking if there is small version of the map (in cache)
String imgTile2 = mgr.calculateTileId(map, leftPlusI / 2, topPlusJ / 2, nzoom - 1);
String imgTile4 = mgr.calculateTileId(map, leftPlusI / 4, topPlusJ / 4, nzoom - 2);
if (originalBeLoaded || imgExist) {
bmp = mgr.getTileImageFromCache(imgTile2);
div = 2;
if (bmp == null) {
bmp = mgr.getTileImageFromCache(imgTile4);
div = 4;
}
}
if (!originalBeLoaded && !imgExist) {
if (mgr.tileExistOnFileSystem(imgTile2, map, leftPlusI / 2, topPlusJ / 2, nzoom - 1)
|| (useInternet && nzoom - 1 <= maxLevel)) {
bmp = mgr.getTileImageForMapAsync(imgTile2, map, leftPlusI / 2, topPlusJ / 2, nzoom - 1,
useInternet);
div = 2;
} else if (mgr.tileExistOnFileSystem(imgTile4, map, leftPlusI / 4, topPlusJ / 4, nzoom - 2)
|| (useInternet && nzoom - 2 <= maxLevel)) {
bmp = mgr.getTileImageForMapAsync(imgTile4, map, leftPlusI / 4, topPlusJ / 4, nzoom - 2,
useInternet);
div = 4;
}
}
if (bmp == null) {
drawEmptyTile(canvas, x1, y1, ftileSize, nightMode);
} else {
int xZoom = ((left + i) % div) * tileSize / div;
int yZoom = ((top + j) % div) * tileSize / div;
bitmapToZoom.set(xZoom, yZoom, xZoom + tileSize / div, yZoom + tileSize / div);
bitmapToDraw.set(x1, y1, x1 + ftileSize, y1 + ftileSize);
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
}
} else {
bitmapToZoom.set(0, 0, map.getTileSize(), map.getTileSize());
bitmapToDraw.set(x1, y1, x1 + ftileSize, y1 + ftileSize);
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
}
}
}
} else {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
float x1 = (i + left - tileX) * ftileSize + w;
float y1 = (j + top - tileY) * ftileSize + h;
drawEmptyTile(canvas, x1, y1, ftileSize, nightMode);
}
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
float x1 = (i + left - tileX) * ftileSize + w;
float y1 = (j + top - tileY) * ftileSize + h;
drawEmptyTile(canvas, x1, y1, ftileSize, nightMode);
}
}
drawOverMap(canvas, latlonRect, nightMode);
drawOverMap(canvas, latlonRect, tilesRect, nightMode);
} finally {
holder.unlockCanvasAndPost(canvas);
}

View file

@ -154,7 +154,7 @@ public class POIMapLayer implements OsmandMapLayer, ContextMenuLayer.IContextMen
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (view.getZoom() >= startZoom) {
Map<String, Integer> icons = RenderingIcons.getIcons();

View file

@ -82,7 +82,7 @@ public class PointLocationLayer implements OsmandMapLayer {
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (isLocationVisible(lastKnownLocation)) {
int locationX = view.getMapXForPoint(lastKnownLocation.getLongitude());
int locationY = view.getMapYForPoint(lastKnownLocation.getLatitude());

View file

@ -47,7 +47,7 @@ public class PointNavigationLayer implements OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if(pointToNavigate == null){
return;
}

View file

@ -166,7 +166,7 @@ public class RouteInfoLayer implements OsmandMapLayer, IRouteInformationListener
public final int shiftCenter = 55;
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if(isVisible()){
border.set(layout.getLeft() - 10 * dm.density, layout.getTop() - 4 * dm.density,
layout.getRight() - (shiftCenter - 5) * dm.density, layout.getBottom() + 4 * dm.density);

View file

@ -58,7 +58,7 @@ public class RouteLayer implements OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
path.reset();
if (helper.hasPointsToShow()) {
long time = System.currentTimeMillis();

View file

@ -59,7 +59,7 @@ public class TransportInfoLayer implements OsmandMapLayer {
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if(routeHelper.routeIsCalculated() && visible){
List<RouteInfoLocation> list = routeHelper.getRoute();
for(RouteInfoLocation l : list){

View file

@ -122,7 +122,7 @@ public class TransportStopsLayer implements OsmandMapLayer, ContextMenuLayer.ICo
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (view.getZoom() >= startZoom) {
objects.clear();
view.getApplication().getResourceManager().searchTransportAsync(latLonBounds.top, latLonBounds.left, latLonBounds.bottom, latLonBounds.right, view.getZoom(), objects);

View file

@ -209,7 +209,7 @@ public class YandexTrafficLayer implements OsmandMapLayer {
}
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, boolean nightMode) {
if (visible) {
pixRect.set(0, 0, view.getWidth(), view.getHeight());
float tileY = (float) MapUtils.getTileEllipsoidNumberY(view.getZoom(), view.getLatitude());