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

@ -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){

View file

@ -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);

View file

@ -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);