This commit is contained in:
madwasp79 2019-03-19 09:58:18 +02:00
parent 5bf210883d
commit 4edd8a4976
2 changed files with 4 additions and 4 deletions

View file

@ -206,8 +206,10 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
if (editingCtx.getPointsCount() > 0) {
WptPt lastPoint = editingCtx.getPoints().get(editingCtx.getPointsCount() - 1);
LatLon centerLatLon = tb.getCenterLatLon();
distance = (float) MapUtils.getDistance(lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
bearing = getLocationFromLL(lastPoint.lat, lastPoint.lon).bearingTo(getLocationFromLL(centerLatLon.getLatitude(), centerLatLon.getLongitude()));
distance = (float) MapUtils.getDistance(
lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
bearing = getLocationFromLL(lastPoint.lat, lastPoint.lon)
.bearingTo(getLocationFromLL(centerLatLon.getLatitude(), centerLatLon.getLongitude()));
}
measureDistanceToCenterListener.onMeasure(distance, bearing);
}

View file

@ -95,8 +95,6 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
Location l2;
if (pos < 1) {
text = mapActivity.getString(R.string.shared_string_control_start);
mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null) {
l1 = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
l2 = getLocationFromLL(points.get(0).lat, points.get(0).lon);