Improve GPX track follow
This commit is contained in:
parent
c5ed63022c
commit
d01ebd2d47
6 changed files with 51 additions and 25 deletions
|
@ -1001,12 +1001,12 @@
|
|||
<string name="filterpoi_activity">Créer un filtre des PI</string>
|
||||
<string name="map_widget_renderer">Styles de rendu</string>
|
||||
<string name="int_continuosly">En continu</string>
|
||||
<string name="tip_rotation_switching_t_v2">\tVous pouvez modifier l'orientation de la carte par un appui court sur l\'icône de la boussole
|
||||
<string name="tip_rotation_switching_t_v2">\tVous pouvez modifier l\'orientation de la carte par un appui court sur l\'icône de la boussole
|
||||
\n\tLes choix sont :
|
||||
\n\t\'Ne pas tourner (nord vers le haut)\' - La carte ne changera pas d\'orientation, le nord sera toujours vers le haut
|
||||
\n\t\'Direction du déplacement\' - La carte est continuellement alignée dans la direction du déplacement
|
||||
\n\t\'Boussole\' - La carte est continuellement alignée sur la valeur de la boussole</string>
|
||||
<string name="tip_day_night_mode_t_v2">"\tLe style de la carte peut, pour certaines cartes vectorielles, être modifié selon qu'il fait jour (plus clair) ou nuit (plus sombre)
|
||||
<string name="tip_day_night_mode_t_v2">"\tLe style de la carte peut, pour certaines cartes vectorielles, être modifié selon qu\'il fait jour (plus clair) ou nuit (plus sombre)
|
||||
\n\tLes couleurs de nuit sont plus sûres pour la conduite nocturne
|
||||
\n\tVous pouvez configurer la politique de bascule jour/nuit dans \'Navigation\'->\'Mode jour/nuit\'
|
||||
\n\tLes choix sont:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="use_displayed_track_for_navigation">Do you want to use displayed track for navigation?</string>
|
||||
<string name="keep_and_add_destination_point">Add as destination point</string>
|
||||
<string name="select_gpx">Select GPX …</string>
|
||||
<string name="route_descr_select_destination">Select Destination</string>
|
||||
|
|
|
@ -41,6 +41,7 @@ import net.osmand.plus.activities.actions.StartGPSStatus;
|
|||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||
import net.osmand.plus.views.BaseMapLayer;
|
||||
import net.osmand.plus.views.MapTileLayer;
|
||||
|
@ -448,11 +449,56 @@ public class MapActivityActions implements DialogProvider {
|
|||
builder.create().show();
|
||||
}
|
||||
|
||||
public void enterRoutePlanningMode(LatLon from, String fromName) {
|
||||
public void setGPXRouteParams(GPXFile result) {
|
||||
GPXRouteParamsBuilder params = new GPXRouteParamsBuilder(result, mapActivity.getMyApplication().getSettings());
|
||||
params.setAnnounceWaypoints(settings.SPEAK_GPX_WPT.get());
|
||||
params.setCalculateOsmAndRoute(settings.CALC_GPX_ROUTE.get());
|
||||
List<Location> ps = params.getPoints();
|
||||
|
||||
if(!ps.isEmpty()) {
|
||||
Location loc = ps.get(ps.size() -1);
|
||||
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, -1);
|
||||
if(tg.getPointToStart() == null) {
|
||||
loc = ps.get(0);
|
||||
tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null);
|
||||
}
|
||||
tg.updateRoutingHelper();
|
||||
}
|
||||
mapActivity.getRoutingHelper().setGpxParams(params);
|
||||
settings.FOLLOW_THE_GPX_ROUTE.set(result.path);
|
||||
}
|
||||
|
||||
public void enterRoutePlanningMode(final LatLon from, final String fromName) {
|
||||
final GPXFile gpxFile = mapActivity.getMyApplication().getGpxFileToDisplay();
|
||||
if(gpxFile != null) {
|
||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||
bld.setMessage(R.string.use_displayed_track_for_navigation);
|
||||
bld.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setGPXRouteParams(gpxFile);
|
||||
enterRoutePlanningModeImpl(from, fromName);
|
||||
}
|
||||
});
|
||||
bld.setPositiveButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
enterRoutePlanningModeImpl(from, fromName);
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
} else {
|
||||
enterRoutePlanningModeImpl(from, fromName);
|
||||
}
|
||||
}
|
||||
|
||||
private void enterRoutePlanningModeImpl(LatLon from, String fromName) {
|
||||
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
|
||||
if(mode == ApplicationMode.DEFAULT) {
|
||||
mode = ApplicationMode.CAR;
|
||||
}
|
||||
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
app.getSettings().APPLICATION_MODE.set(mode);
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.commons.logging.Log;
|
|||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.location.Location;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||
|
|
|
@ -273,7 +273,6 @@ public class GeoIntentActivity extends OsmandListActivity {
|
|||
}
|
||||
|
||||
public MapObject checkGeoPoint() {
|
||||
// TODO Auto-generated method stub
|
||||
double lat = Double.NaN;
|
||||
double lon = Double.NaN;
|
||||
for(String e : elements) {
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
|
@ -16,7 +14,6 @@ import net.osmand.plus.GPXUtilities.GPXFile;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||
|
@ -306,23 +303,7 @@ public class MapRoutePreferencesControl extends MapControls {
|
|||
|
||||
@Override
|
||||
public boolean processResult(GPXFile result) {
|
||||
GPXRouteParamsBuilder params = new GPXRouteParamsBuilder(result, mapActivity.getMyApplication().getSettings());
|
||||
params.setAnnounceWaypoints(settings.SPEAK_GPX_WPT.get());
|
||||
params.setCalculateOsmAndRoute(settings.CALC_GPX_ROUTE.get());
|
||||
List<Location> ps = params.getPoints();
|
||||
|
||||
if(!ps.isEmpty()) {
|
||||
Location loc = ps.get(ps.size() -1);
|
||||
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, -1);
|
||||
if(tg.getPointToStart() == null) {
|
||||
loc = ps.get(0);
|
||||
tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null);
|
||||
}
|
||||
tg.updateRoutingHelper();
|
||||
}
|
||||
mapActivity.getRoutingHelper().setGpxParams(params);
|
||||
settings.FOLLOW_THE_GPX_ROUTE.set(result.path);
|
||||
mapActivity.getMapActions().setGPXRouteParams(result);
|
||||
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
||||
updateSpinnerItems(gpxSpinner);
|
||||
updateParameters();
|
||||
|
|
Loading…
Reference in a new issue