Change Measure distance -> Plan a route

This commit is contained in:
Dima-1 2020-07-16 13:42:08 +03:00
parent 10e5005e5a
commit b2563269ac
2 changed files with 15 additions and 7 deletions

View file

@ -378,7 +378,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
public void onMeasure(float distance, float bearing) {
String distStr = OsmAndFormatter.getFormattedDistance(distance, mapActivity.getMyApplication());
String azimuthStr = OsmAndFormatter.getFormattedAzimuth(bearing, getMyApplication());
distanceToCenterTv.setText(String.format(" %1$s • %2$s", distStr, azimuthStr));
distanceToCenterTv.setText(String.format("%1$s • %2$s", distStr, azimuthStr));
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
distanceToCenterTv, 12, 18, 2, TypedValue.COMPLEX_UNIT_SP
);

View file

@ -15,6 +15,7 @@ import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
@ -322,9 +323,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
pt.lon = l.getLongitude();
boolean allowed = editingCtx.getPointsCount() == 0 || !editingCtx.getPoints().get(editingCtx.getPointsCount() - 1).equals(pt);
if (allowed) {
String profileType = editingCtx.getSnapToRoadAppMode().getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
ApplicationMode applicationMode = editingCtx.getSnapToRoadAppMode();
if(applicationMode!=null) {
String profileType = applicationMode.getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
}
}
editingCtx.addPoint(pt);
return pt;
@ -342,9 +347,12 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
pressedPointLatLon = null;
boolean allowed = editingCtx.getPointsCount() == 0 || !editingCtx.getPoints().get(editingCtx.getPointsCount() - 1).equals(pt);
if (allowed) {
String profileType = editingCtx.getSnapToRoadAppMode().getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
ApplicationMode applicationMode = editingCtx.getSnapToRoadAppMode();
if(applicationMode!=null) {
String profileType = applicationMode.getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
}
}
editingCtx.addPoint(pt);
moveMapToLatLon(lat, lon);