Merge pull request #9872 from osmandapp/fixes_plan_route
Minor fixes in plan route and follow track
This commit is contained in:
commit
b31bdf22ff
4 changed files with 33 additions and 17 deletions
|
@ -525,9 +525,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
tg.clearStartPoint(false);
|
||||
Location finishLoc = ps.get(ps.size() - 1);
|
||||
PointDescription point = new PointDescription(PointDescription.POINT_TYPE_LOCATION, result.path, "");
|
||||
point.setName(PointDescription.getSearchAddressStr(mapActivity));
|
||||
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1, point);
|
||||
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
|||
editingCtx.getCommandManager().setMeasurementLayer(mapActivity.getMapLayers().getMeasurementToolLayer());
|
||||
enterMeasurementMode();
|
||||
updateSnapToRoadControls();
|
||||
if (gpxData != null) {
|
||||
if (gpxData != null && addPoints) {
|
||||
if (!isUndoMode()) {
|
||||
List<WptPt> points = gpxData.getGpxFile().getRoutePoints();
|
||||
if (!points.isEmpty()) {
|
||||
|
@ -546,7 +546,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
|||
}
|
||||
}
|
||||
}
|
||||
if (addPoints) {
|
||||
ActionType actionType = gpxData.getActionType();
|
||||
if (actionType == ActionType.ADD_ROUTE_POINTS) {
|
||||
displayRoutePoints();
|
||||
|
@ -554,7 +553,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
|||
displaySegmentPoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
setMode(UNDO_MODE, false);
|
||||
}
|
||||
}
|
||||
|
@ -807,8 +805,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
|||
|
||||
@Override
|
||||
public void saveChangesOnClick() {
|
||||
if (isFollowTrackMode()) {
|
||||
startTrackNavigation();
|
||||
} else {
|
||||
saveChanges(FinalSaveAction.SHOW_TOAST, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAsNewTrackOnClick() {
|
||||
|
|
|
@ -63,6 +63,7 @@ import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -185,8 +186,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
|
||||
setupTracksCard();
|
||||
} else {
|
||||
File file = new File(gpxFile.path);
|
||||
GPXInfo gpxInfo = new GPXInfo(gpxFile.path, file.lastModified(), file.length());
|
||||
String fileName = null;
|
||||
File file = null;
|
||||
if (!Algorithms.isEmpty(gpxFile.path)) {
|
||||
file = new File(gpxFile.path);
|
||||
fileName = file.getName();
|
||||
} else if (!Algorithms.isEmpty(gpxFile.tracks)) {
|
||||
fileName = gpxFile.tracks.get(0).name;
|
||||
}
|
||||
if (Algorithms.isEmpty(fileName)) {
|
||||
fileName = app.getString(R.string.shared_string_gpx_track);
|
||||
}
|
||||
GPXInfo gpxInfo = new GPXInfo(fileName, file != null ? file.lastModified() : 0, file != null ? file.length() : 0);
|
||||
TrackEditCard importTrackCard = new TrackEditCard(mapActivity, gpxInfo);
|
||||
importTrackCard.setListener(this);
|
||||
cardsContainer.addView(importTrackCard.build(mapActivity));
|
||||
|
@ -207,7 +218,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
reverseTrackCard.setListener(this);
|
||||
cardsContainer.addView(reverseTrackCard.build(mapActivity));
|
||||
}
|
||||
if (!gpxFile.hasRtePt()) {
|
||||
if (!gpxFile.hasRtePt() && !gpxFile.hasRoute()) {
|
||||
cardsContainer.addView(buildDividerView(cardsContainer, true));
|
||||
|
||||
AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity);
|
||||
|
|
|
@ -1760,8 +1760,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (routeParams != null) {
|
||||
TargetPoint target = app.getTargetPointsHelper().getPointToNavigate();
|
||||
if (target != null) {
|
||||
PointDescription pointDescription = target.getOriginalPointDescription();
|
||||
return pointDescription != null && routeParams.getFile().path.equals(pointDescription.getTypeName());
|
||||
List<Location> points = routeParams.getPoints(app);
|
||||
if (!Algorithms.isEmpty(points)) {
|
||||
Location loc = points.get(points.size() - 1);
|
||||
LatLon latLon = new LatLon(loc.getLatitude(), loc.getLongitude());
|
||||
LatLon targetLatLon = new LatLon(target.getLatitude(), target.getLongitude());
|
||||
return latLon.equals(targetLatLon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue