Revert "Fixing bugs."

This reverts commit d5394a8425.
This commit is contained in:
GaidamakUA 2016-05-06 15:55:40 +03:00
parent 990eb82e4b
commit 501ec5c341
3 changed files with 16 additions and 35 deletions

View file

@ -387,13 +387,6 @@ public class RotatedTileBox {
(tileRB.y * 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() { private void checkTileRectangleCalculated() {
if(tileBounds == null){ if(tileBounds == null){

View file

@ -10,7 +10,6 @@ import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Vibrator; import android.os.Vibrator;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresPermission; import android.support.annotation.RequiresPermission;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.view.GestureDetector; import android.view.GestureDetector;
@ -60,8 +59,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
private final MoveMarkerBottomSheetHelper mMoveMarkerBottomSheetHelper; private final MoveMarkerBottomSheetHelper mMoveMarkerBottomSheetHelper;
private boolean mInChangeMarkerPositionMode; private boolean mInChangeMarkerPositionMode;
@Nullable
private LatLon mMarkerLocation;
public ContextMenuLayer(MapActivity activity) { public ContextMenuLayer(MapActivity activity) {
this.activity = 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); 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) { if (mInChangeMarkerPositionMode) {
int x = box.getCenterPixelX(); int x = box.getCenterPixelX();
int y = box.getCenterPixelY(); int y = box.getCenterPixelY();
@ -169,13 +154,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(VIBRATE_SHORT); vibrator.vibrate(VIBRATE_SHORT);
AnimateDraggingMapThread thread = activity.getMapView().getAnimatedDraggingThread(); mInChangeMarkerPositionMode = true;
mMarkerLocation = menu.getLatLon(); activity.getContextMenu().hide();
double lat = mMarkerLocation.getLatitude(); LatLon latLon = tileBox.getCenterLatLon();
double lon = mMarkerLocation.getLongitude(); mMoveMarkerBottomSheetHelper.show(latLon.getLatitude(), latLon.getLongitude());
int zoom = activity.getMapView().getZoom();
thread.startMoving(lat, lon, zoom, true);
return true; return true;
} }
@ -188,8 +170,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
if (!mInChangeMarkerPositionMode) { if (!mInChangeMarkerPositionMode) {
throw new IllegalStateException("Not in change marker position mode"); throw new IllegalStateException("Not in change marker position mode");
} }
RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox();
mInChangeMarkerPositionMode = false; mInChangeMarkerPositionMode = false;
RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox();
int newMarkerX = tileBox.getCenterPixelX(); int newMarkerX = tileBox.getCenterPixelX();
int newMarkerY = tileBox.getCenterPixelY(); int newMarkerY = tileBox.getCenterPixelY();
PointF newMarkerPosition = new PointF(newMarkerX, newMarkerY); PointF newMarkerPosition = new PointF(newMarkerX, newMarkerY);

View file

@ -389,14 +389,14 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
return currentViewport.isZoomAnimated(); return currentViewport.isZoomAnimated();
} }
/**
* Adds listener to control when map is dragging
*/
public void setMapLocationListener(IMapLocationListener l) { public void setMapLocationListener(IMapLocationListener l) {
locationListener = l; locationListener = l;
} }
public IMapLocationListener getMapLocationListener() { /**
* Adds listener to control when map is dragging
*/
public IMapLocationListener setMapLocationListener() {
return locationListener; return locationListener;
} }
@ -450,6 +450,12 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
final float x2 = calc.getPixXFromTile(rb.x, rb.y, cz); final float x2 = calc.getPixXFromTile(rb.x, rb.y, cz);
final float y1 = calc.getPixYFromTile(lt.x, lt.y, cz); final float y1 = calc.getPixYFromTile(lt.x, lt.y, cz);
final float y2 = calc.getPixYFromTile(rb.x, rb.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()) { if (!bufferBitmap.isRecycled()) {
RectF rct = new RectF(x1, y1, x2, y2); RectF rct = new RectF(x1, y1, x2, y2);
canvas.drawBitmap(bufferBitmap, null, rct, paintImg); canvas.drawBitmap(bufferBitmap, null, rct, paintImg);