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();
|
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
tg.clearStartPoint(false);
|
tg.clearStartPoint(false);
|
||||||
Location finishLoc = ps.get(ps.size() - 1);
|
Location finishLoc = ps.get(ps.size() - 1);
|
||||||
PointDescription point = new PointDescription(PointDescription.POINT_TYPE_LOCATION, result.path, "");
|
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1);
|
||||||
point.setName(PointDescription.getSearchAddressStr(mapActivity));
|
|
||||||
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1, point);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,7 +536,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
editingCtx.getCommandManager().setMeasurementLayer(mapActivity.getMapLayers().getMeasurementToolLayer());
|
editingCtx.getCommandManager().setMeasurementLayer(mapActivity.getMapLayers().getMeasurementToolLayer());
|
||||||
enterMeasurementMode();
|
enterMeasurementMode();
|
||||||
updateSnapToRoadControls();
|
updateSnapToRoadControls();
|
||||||
if (gpxData != null) {
|
if (gpxData != null && addPoints) {
|
||||||
if (!isUndoMode()) {
|
if (!isUndoMode()) {
|
||||||
List<WptPt> points = gpxData.getGpxFile().getRoutePoints();
|
List<WptPt> points = gpxData.getGpxFile().getRoutePoints();
|
||||||
if (!points.isEmpty()) {
|
if (!points.isEmpty()) {
|
||||||
|
@ -546,7 +546,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addPoints) {
|
|
||||||
ActionType actionType = gpxData.getActionType();
|
ActionType actionType = gpxData.getActionType();
|
||||||
if (actionType == ActionType.ADD_ROUTE_POINTS) {
|
if (actionType == ActionType.ADD_ROUTE_POINTS) {
|
||||||
displayRoutePoints();
|
displayRoutePoints();
|
||||||
|
@ -554,7 +553,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
displaySegmentPoints();
|
displaySegmentPoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setMode(UNDO_MODE, false);
|
setMode(UNDO_MODE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -807,8 +805,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveChangesOnClick() {
|
public void saveChangesOnClick() {
|
||||||
|
if (isFollowTrackMode()) {
|
||||||
|
startTrackNavigation();
|
||||||
|
} else {
|
||||||
saveChanges(FinalSaveAction.SHOW_TOAST, true);
|
saveChanges(FinalSaveAction.SHOW_TOAST, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveAsNewTrackOnClick() {
|
public void saveAsNewTrackOnClick() {
|
||||||
|
|
|
@ -63,6 +63,7 @@ import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
import net.osmand.plus.views.layers.MapControlsLayer;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -185,8 +186,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
|
|
||||||
setupTracksCard();
|
setupTracksCard();
|
||||||
} else {
|
} else {
|
||||||
File file = new File(gpxFile.path);
|
String fileName = null;
|
||||||
GPXInfo gpxInfo = new GPXInfo(gpxFile.path, file.lastModified(), file.length());
|
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);
|
TrackEditCard importTrackCard = new TrackEditCard(mapActivity, gpxInfo);
|
||||||
importTrackCard.setListener(this);
|
importTrackCard.setListener(this);
|
||||||
cardsContainer.addView(importTrackCard.build(mapActivity));
|
cardsContainer.addView(importTrackCard.build(mapActivity));
|
||||||
|
@ -207,7 +218,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
reverseTrackCard.setListener(this);
|
reverseTrackCard.setListener(this);
|
||||||
cardsContainer.addView(reverseTrackCard.build(mapActivity));
|
cardsContainer.addView(reverseTrackCard.build(mapActivity));
|
||||||
}
|
}
|
||||||
if (!gpxFile.hasRtePt()) {
|
if (!gpxFile.hasRtePt() && !gpxFile.hasRoute()) {
|
||||||
cardsContainer.addView(buildDividerView(cardsContainer, true));
|
cardsContainer.addView(buildDividerView(cardsContainer, true));
|
||||||
|
|
||||||
AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity);
|
AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity);
|
||||||
|
|
|
@ -1760,8 +1760,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (routeParams != null) {
|
if (routeParams != null) {
|
||||||
TargetPoint target = app.getTargetPointsHelper().getPointToNavigate();
|
TargetPoint target = app.getTargetPointsHelper().getPointToNavigate();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
PointDescription pointDescription = target.getOriginalPointDescription();
|
List<Location> points = routeParams.getPoints(app);
|
||||||
return pointDescription != null && routeParams.getFile().path.equals(pointDescription.getTypeName());
|
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