Fix in New Zealand, green map coverage overlay sometimes doesn't match map #1749

This commit is contained in:
Victor Shcherb 2015-09-30 01:05:52 +02:00
parent 868c39ff55
commit f8d99c4623

View file

@ -5,6 +5,8 @@ import net.osmand.core.android.TileSourceProxyProvider;
import net.osmand.core.jni.MapLayerConfiguration; import net.osmand.core.jni.MapLayerConfiguration;
import net.osmand.core.jni.PointI; import net.osmand.core.jni.PointI;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.QuadPointDouble;
import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.map.ITileSource; import net.osmand.map.ITileSource;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
@ -174,19 +176,19 @@ public class MapVectorLayer extends BaseMapLayer {
canvas.rotate(rot, currentViewport.getCenterPixelX(), currentViewport.getCenterPixelY()); canvas.rotate(rot, currentViewport.getCenterPixelX(), currentViewport.getCenterPixelY());
final RotatedTileBox calc = currentViewport.copy(); final RotatedTileBox calc = currentViewport.copy();
calc.setRotate(bmpLoc.getRotate()); calc.setRotate(bmpLoc.getRotate());
// int cz = currentViewport.getZoom(); QuadPointDouble lt = calc.getLeftTopTile(bmpLoc.getZoom());
// QuadPointDouble lt = bmpLoc.getLeftTopTile(cz); QuadPointDouble rb = calc.getRightBottomTile(bmpLoc.getZoom());
// QuadPointDouble rb = bmpLoc.getRightBottomTile(cz); final float x1 = calc.getPixXFromTile(lt.x, lt.y, bmpLoc.getZoom());
// final float x1 = calc.getPixXFromTile(lt.x, lt.y, cz); final float x2 = calc.getPixXFromTile(lt.x, lt.y, bmpLoc.getZoom());
// final float x2 = calc.getPixXFromTile(rb.x, rb.y, cz); final float y1 = calc.getPixYFromTile(rb.x, rb.y, bmpLoc.getZoom());
// final float y1 = calc.getPixYFromTile(lt.x, lt.y, cz); final float y2 = calc.getPixYFromTile(rb.x, rb.y, bmpLoc.getZoom());
// final float y2 = calc.getPixYFromTile(rb.x, rb.y, cz);
LatLon lt = bmpLoc.getLeftTopLatLon(); // LatLon lt = bmpLoc.getLeftTopLatLon();
LatLon rb = bmpLoc.getRightBottomLatLon(); // LatLon rb = bmpLoc.getRightBottomLatLon();
final float x1 = calc.getPixXFromLatLon(lt.getLatitude(), lt.getLongitude()); // final float x1 = calc.getPixXFromLatLon(lt.getLatitude(), lt.getLongitude());
final float x2 = calc.getPixXFromLatLon(rb.getLatitude(), rb.getLongitude()); // final float x2 = calc.getPixXFromLatLon(rb.getLatitude(), rb.getLongitude());
final float y1 = calc.getPixYFromLatLon(lt.getLatitude(), lt.getLongitude()); // final float y1 = calc.getPixYFromLatLon(lt.getLatitude(), lt.getLongitude());
final float y2 = calc.getPixYFromLatLon(rb.getLatitude(), rb.getLongitude()); // final float y2 = calc.getPixYFromLatLon(rb.getLatitude(), rb.getLongitude());
destImage.set(x1, y1, x2, y2); destImage.set(x1, y1, x2, y2);
if (!bmp.isRecycled()) { if (!bmp.isRecycled()) {
canvas.drawBitmap(bmp, null, destImage, paintImg); canvas.drawBitmap(bmp, null, destImage, paintImg);