From 501ec5c341ee5a28c8f53a3f99f9662f6398507b Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Fri, 6 May 2016 15:55:40 +0300 Subject: [PATCH] Revert "Fixing bugs." This reverts commit d5394a8425aaaa1f3add1adae5939a18cf5e5a23. --- .../src/net/osmand/data/RotatedTileBox.java | 9 +----- .../osmand/plus/views/ContextMenuLayer.java | 28 ++++--------------- .../osmand/plus/views/OsmandMapTileView.java | 14 +++++++--- 3 files changed, 16 insertions(+), 35 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java index 5504b9c4cf..178c214ef6 100644 --- a/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java +++ b/OsmAnd-java/src/net/osmand/data/RotatedTileBox.java @@ -386,14 +386,7 @@ public class RotatedTileBox { return new QuadPointDouble((tileRB.x * MapUtils.getPowZoom(zoom - this.zoom)), (tileRB.y * MapUtils.getPowZoom(zoom - this.zoom))); } - - public float getRatioX() { - return pixWidth / cx; - } - - public float getRatioY() { - return pixHeight / cy; - } + private void checkTileRectangleCalculated() { if(tileBounds == null){ diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 4c29631774..18e2fbcb7a 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -10,7 +10,6 @@ import android.graphics.PointF; import android.graphics.Rect; import android.os.Vibrator; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.annotation.RequiresPermission; import android.support.v4.content.ContextCompat; import android.view.GestureDetector; @@ -60,8 +59,6 @@ public class ContextMenuLayer extends OsmandMapLayer { private final MoveMarkerBottomSheetHelper mMoveMarkerBottomSheetHelper; private boolean mInChangeMarkerPositionMode; - @Nullable - private LatLon mMarkerLocation; public ContextMenuLayer(MapActivity activity) { this.activity = activity; @@ -110,18 +107,6 @@ public class ContextMenuLayer extends OsmandMapLayer { canvas.drawBitmap(pressedBitmap, x - pressedBitmap.getWidth() / 2, y - pressedBitmap.getHeight() / 2, paint); } - if (mMarkerLocation != null - && mMarkerLocation.equals(menu.getLatLon()) - && mMarkerLocation.equals(box.getCenterLatLon())) { - mInChangeMarkerPositionMode = true; - double latitude = mMarkerLocation.getLatitude(); - double longitude = mMarkerLocation.getLongitude(); - mMoveMarkerBottomSheetHelper.show(latitude, longitude); - - activity.getContextMenu().hide(); - mMarkerLocation = null; - box.getPixHeight(); - } if (mInChangeMarkerPositionMode) { int x = box.getCenterPixelX(); int y = box.getCenterPixelY(); @@ -169,13 +154,10 @@ public class ContextMenuLayer extends OsmandMapLayer { Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(VIBRATE_SHORT); - AnimateDraggingMapThread thread = activity.getMapView().getAnimatedDraggingThread(); - mMarkerLocation = menu.getLatLon(); - double lat = mMarkerLocation.getLatitude(); - double lon = mMarkerLocation.getLongitude(); - int zoom = activity.getMapView().getZoom(); - thread.startMoving(lat, lon, zoom, true); - + mInChangeMarkerPositionMode = true; + activity.getContextMenu().hide(); + LatLon latLon = tileBox.getCenterLatLon(); + mMoveMarkerBottomSheetHelper.show(latLon.getLatitude(), latLon.getLongitude()); return true; } @@ -188,8 +170,8 @@ public class ContextMenuLayer extends OsmandMapLayer { if (!mInChangeMarkerPositionMode) { throw new IllegalStateException("Not in change marker position mode"); } - RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox(); mInChangeMarkerPositionMode = false; + RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox(); int newMarkerX = tileBox.getCenterPixelX(); int newMarkerY = tileBox.getCenterPixelY(); PointF newMarkerPosition = new PointF(newMarkerX, newMarkerY); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 13f98256fe..e224109dbf 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -389,14 +389,14 @@ public class OsmandMapTileView implements IMapDownloaderCallback { return currentViewport.isZoomAnimated(); } - /** - * Adds listener to control when map is dragging - */ public void setMapLocationListener(IMapLocationListener l) { locationListener = l; } - public IMapLocationListener getMapLocationListener() { + /** + * Adds listener to control when map is dragging + */ + public IMapLocationListener setMapLocationListener() { return locationListener; } @@ -450,6 +450,12 @@ public class OsmandMapTileView implements IMapDownloaderCallback { final float x2 = calc.getPixXFromTile(rb.x, rb.y, cz); final float y1 = calc.getPixYFromTile(lt.x, lt.y, cz); final float y2 = calc.getPixYFromTile(rb.x, rb.y, cz); +// LatLon lt = bufferImgLoc.getLeftTopLatLon(); +// LatLon rb = bufferImgLoc.getRightBottomLatLon(); +// final float x1 = calc.getPixXFromLatLon(lt.getLatitude(), lt.getLongitude()); +// final float x2 = calc.getPixXFromLatLon(rb.getLatitude(), rb.getLongitude()); +// final float y1 = calc.getPixYFromLatLon(lt.getLatitude(), lt.getLongitude()); +// final float y2 = calc.getPixYFromLatLon(rb.getLatitude(), rb.getLongitude()); if (!bufferBitmap.isRecycled()) { RectF rct = new RectF(x1, y1, x2, y2); canvas.drawBitmap(bufferBitmap, null, rct, paintImg);