Fix finding point to move
This commit is contained in:
parent
5251bb1bb7
commit
2b7f5f6f4e
1 changed files with 11 additions and 8 deletions
|
@ -133,7 +133,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
double pressedPointLat = tileBox.getLatFromPixel(point.x, point.y);
|
double pressedPointLat = tileBox.getLatFromPixel(point.x, point.y);
|
||||||
double pressedPointLon = tileBox.getLonFromPixel(point.x, point.y);
|
double pressedPointLon = tileBox.getLonFromPixel(point.x, point.y);
|
||||||
getPointToMove(pressedPointLat, pressedPointLon);
|
getPointToMove(pressedPointLat, pressedPointLon);
|
||||||
if (movePointPos != -1) {
|
if (pointBeforeMovement != null && movePointPos != -1) {
|
||||||
enterMovingPointMode();
|
enterMovingPointMode();
|
||||||
if (inMeasurementMode && inMovePointMode && enterMovePointModeListener != null) {
|
if (inMeasurementMode && inMovePointMode && enterMovePointModeListener != null) {
|
||||||
enterMovePointModeListener.onEnterMovePointMode();
|
enterMovePointModeListener.onEnterMovePointMode();
|
||||||
|
@ -148,9 +148,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPointToMove(double lat, double lon) {
|
private void getPointToMove(double lat, double lon) {
|
||||||
|
RotatedTileBox tb = view.getCurrentRotatedTileBox();
|
||||||
double lowestDistance = Double.MAX_VALUE;
|
double lowestDistance = Double.MAX_VALUE;
|
||||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
WptPt pt = measurementPoints.get(i);
|
WptPt pt = measurementPoints.get(i);
|
||||||
|
if (tb.containsLatLon(pt.getLatitude(), pt.getLongitude())) {
|
||||||
double latDiff = pt.getLatitude() - lat;
|
double latDiff = pt.getLatitude() - lat;
|
||||||
double lonDiff = pt.getLongitude() - lon;
|
double lonDiff = pt.getLongitude() - lon;
|
||||||
double distToPoint = Math.sqrt(Math.pow(latDiff, 2) + Math.pow(lonDiff, 2));
|
double distToPoint = Math.sqrt(Math.pow(latDiff, 2) + Math.pow(lonDiff, 2));
|
||||||
|
@ -161,6 +163,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
||||||
|
|
Loading…
Reference in a new issue