diff --git a/OsmAnd-java/src/net/osmand/data/FavouritePoint.java b/OsmAnd-java/src/net/osmand/data/FavouritePoint.java
index 5eb38e8c58..fb151c4d57 100644
--- a/OsmAnd-java/src/net/osmand/data/FavouritePoint.java
+++ b/OsmAnd-java/src/net/osmand/data/FavouritePoint.java
@@ -2,7 +2,7 @@ package net.osmand.data;
import java.io.Serializable;
-public class FavouritePoint implements Serializable {
+public class FavouritePoint implements Serializable, LocationPoint {
private static final long serialVersionUID = 729654300829771466L;
private String name;
private String category = "";
@@ -16,6 +16,8 @@ public class FavouritePoint implements Serializable {
public FavouritePoint(){
}
+
+
public FavouritePoint(double latitude, double longitude, String name, String category) {
this.latitude = latitude;
this.longitude = longitude;
diff --git a/OsmAnd-java/src/net/osmand/data/LocationPoint.java b/OsmAnd-java/src/net/osmand/data/LocationPoint.java
new file mode 100644
index 0000000000..f09512a055
--- /dev/null
+++ b/OsmAnd-java/src/net/osmand/data/LocationPoint.java
@@ -0,0 +1,16 @@
+package net.osmand.data;
+
+/**
+ * Created by Натали on 01.08.2014.
+ */
+public interface LocationPoint {
+
+ public double getLatitude();
+
+ public double getLongitude();
+
+ public String getName();
+
+ public int getColor();
+
+}
diff --git a/OsmAnd/project.properties b/OsmAnd/project.properties
index da75a72a89..8e1b6c02d0 100644
--- a/OsmAnd/project.properties
+++ b/OsmAnd/project.properties
@@ -11,5 +11,4 @@
split.density=false
# Project target.
target=android-19
-android.library.reference.1=../SherlockBar
dex.force.jumbo=true
diff --git a/OsmAnd/res/drawable-hdpi/ic_action_core_overflow_dark.png b/OsmAnd/res/drawable-hdpi/ic_action_core_overflow_dark.png
new file mode 100644
index 0000000000..a074c10d05
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_action_core_overflow_dark.png differ
diff --git a/OsmAnd/res/drawable-mdpi/ic_action_core_overflow_dark.png b/OsmAnd/res/drawable-mdpi/ic_action_core_overflow_dark.png
new file mode 100644
index 0000000000..b6d614fcaf
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_action_core_overflow_dark.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_core_overflow_dark.png b/OsmAnd/res/drawable-xhdpi/ic_action_core_overflow_dark.png
new file mode 100644
index 0000000000..7be3c2a4f1
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_action_core_overflow_dark.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_core_overflow_dark.png b/OsmAnd/res/drawable-xxhdpi/ic_action_core_overflow_dark.png
new file mode 100644
index 0000000000..a0cb8a4182
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_action_core_overflow_dark.png differ
diff --git a/OsmAnd/res/layout/waypoint_reached.xml b/OsmAnd/res/layout/waypoint_reached.xml
new file mode 100644
index 0000000000..0613ff603e
--- /dev/null
+++ b/OsmAnd/res/layout/waypoint_reached.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values/sherpafy.xml b/OsmAnd/res/values/sherpafy.xml
index 281ea9d08f..3b53dcc85d 100644
--- a/OsmAnd/res/values/sherpafy.xml
+++ b/OsmAnd/res/values/sherpafy.xml
@@ -42,4 +42,5 @@
Start tour
Download tour
Sherpafy
+ See waypoint information
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 1a59dc27b6..522f1b08bf 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -1941,4 +1941,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Play sound on photo shot
Choose whether to play a sound when shooting photos
Invalid format: %s
+ Remove all
diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java
index b82e5d2457..dd0717287d 100644
--- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java
@@ -29,6 +29,7 @@ import java.util.TimeZone;
import net.osmand.Location;
import net.osmand.PlatformUtil;
+import net.osmand.data.LocationPoint;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@@ -81,7 +82,7 @@ public class GPXUtilities {
}
- public static class WptPt extends GPXExtensions {
+ public static class WptPt extends GPXExtensions implements LocationPoint {
public double lat;
public double lon;
public String name = null;
@@ -95,7 +96,26 @@ public class GPXUtilities {
public WptPt() {
}
-
+
+ @Override
+ public int getColor() {
+ return getColor(0);
+ }
+
+ @Override
+ public double getLatitude() {
+ return lat;
+ }
+
+ @Override
+ public double getLongitude() {
+ return lon;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
public WptPt(double lat, double lon, long time, double ele, double speed, double hdop) {
this.lat = lat;
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index dfeb05a2b3..0ad4ab0c07 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -19,6 +19,7 @@ import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.access.AccessibleToast;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.activities.DayNightHelper;
+import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.api.SQLiteAPI;
@@ -77,7 +78,7 @@ public class OsmandApplication extends Application {
public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class);
-
+
ResourceManager resourceManager = null;
PoiFiltersHelper poiFilters = null;
RoutingHelper routingHelper = null;
@@ -104,10 +105,11 @@ public class OsmandApplication extends Application {
private boolean applicationInitializing = false;
private Locale preferredLocale = null;
-
+
SQLiteAPI sqliteAPI;
BRouterServiceConnection bRouterServiceConnection;
+ MapActivity mapActivity;
@Override
public void onCreate() {
long timeToStart = System.currentTimeMillis();
@@ -838,4 +840,12 @@ public class OsmandApplication extends Application {
getNavigationService().addUsageIntent(intent);
}
}
+
+ public MapActivity getMapActivity() {
+ return mapActivity;
+ }
+
+ public void setMapActivity(MapActivity mapActivity) {
+ this.mapActivity = mapActivity;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
index 910120c03f..c1f6d688ea 100644
--- a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java
@@ -2,11 +2,15 @@ package net.osmand.plus;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import net.osmand.Location;
import net.osmand.StateChangedListener;
import net.osmand.data.LatLon;
+import net.osmand.data.LocationPoint;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RouteProvider.RouteService;
import net.osmand.util.MapUtils;
@@ -21,7 +25,9 @@ public class TargetPointsHelper {
private RoutingHelper routingHelper;
private List> listeners = new ArrayList>();
private OsmandApplication ctx;
-
+ private List visibleLocationPoints = new CopyOnWriteArrayList();
+ private long locationPointsModified;
+
public TargetPointsHelper(OsmandApplication ctx){
this.ctx = ctx;
this.settings = ctx.getSettings();
@@ -62,7 +68,50 @@ public class TargetPointsHelper {
public List getIntermediatePoints() {
return intermediatePoints;
}
-
+
+ public List getVisibleLocationPoints() {
+ return visibleLocationPoints;
+ }
+
+ public void addVisibleLocationPoint(LocationPoint lp) {
+ this.visibleLocationPoints.add(lp);
+ this.locationPointsModified = System.currentTimeMillis();
+ sortVisibleLocationPoints();
+ }
+
+ public void removeAllVisiblePoints() {
+ this.locationPointsModified = System.currentTimeMillis();
+ visibleLocationPoints.clear();
+ }
+
+
+ public void sortVisibleLocationPoints() {
+ final Location lastLocation = ctx.getLocationProvider().getLastKnownLocation();
+ if(lastLocation != null) {
+ Collections.sort(this.visibleLocationPoints, new Comparator() {
+ @Override
+ public int compare(LocationPoint locationPoint, LocationPoint locationPoint2) {
+ double d1 = MapUtils.getDistance(lastLocation.getLatitude(), lastLocation.getLongitude(),
+ locationPoint.getLatitude(), locationPoint.getLongitude());
+ double d2 = MapUtils.getDistance(lastLocation.getLatitude(), lastLocation.getLongitude(),
+ locationPoint2.getLatitude(), locationPoint2.getLongitude());
+ return Double.compare(d1, d2);
+ }
+ });
+ this.locationPointsModified = System.currentTimeMillis();
+ }
+ }
+
+ public long getLocationPointsModified() {
+ return locationPointsModified;
+ }
+
+ public void removeVisibleLocationPoint(LocationPoint lp) {
+ this.visibleLocationPoints.remove(lp);
+ this.locationPointsModified = System.currentTimeMillis();
+ }
+
+
public List getIntermediatePointsWithTarget() {
List res = new ArrayList();
res.addAll(intermediatePoints);
@@ -71,7 +120,7 @@ public class TargetPointsHelper {
}
return res;
}
-
+
public List getIntermediatePointNamesWithTarget() {
List res = new ArrayList();
res.addAll(intermediatePointNames);
@@ -87,7 +136,7 @@ public class TargetPointsHelper {
}
return null;
}
-
+
/**
* Clear the local and persistent waypoints list and destination.
*/
@@ -108,8 +157,8 @@ public class TargetPointsHelper {
*/
public void makeWayPointDestination(boolean updateRoute, int index){
pointToNavigate = intermediatePoints.remove(index);
- settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
- intermediatePointNames.remove(index));
+ settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
+ intermediatePointNames.remove(index));
settings.deleteIntermediatePoint(index);
updateRouteAndReferesh(updateRoute);
}
@@ -122,13 +171,13 @@ public class TargetPointsHelper {
if(sz > 0) {
settings.deleteIntermediatePoint(sz- 1);
pointToNavigate = intermediatePoints.remove(sz - 1);
- settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
+ settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
intermediatePointNames.remove(sz - 1));
}
} else {
settings.deleteIntermediatePoint(index);
intermediatePoints.remove(index);
- intermediatePointNames.remove(index);
+ intermediatePointNames.remove(index);
}
updateRouteAndReferesh(updateRoute);
}
@@ -153,7 +202,7 @@ public class TargetPointsHelper {
settings.getIntermediatePoints(), loc);
}
}
-
+
private Location wrap(LatLon l) {
if(l == null) {
@@ -164,12 +213,12 @@ public class TargetPointsHelper {
loc.setLongitude(l.getLongitude());
return loc;
}
-
+
public void addListener(StateChangedListener l) {
listeners.add(l);
}
-
-
+
+
private void updateListeners() {
for(StateChangedListener l : listeners) {
l.stateChanged(null);
@@ -184,15 +233,15 @@ public class TargetPointsHelper {
readFromSettings(settings);
updateRouteAndReferesh(updateRoute);
}
-
+
public void clearStartPoint(boolean updateRoute) {
settings.clearPointToStart();
readFromSettings(settings);
updateRouteAndReferesh(updateRoute);
}
-
-
- public void reorderAllTargetPoints(List point,
+
+
+ public void reorderAllTargetPoints(List point,
List names, boolean updateRoute){
settings.clearPointToNavigate();
if (point.size() > 0) {
@@ -206,8 +255,8 @@ public class TargetPointsHelper {
readFromSettings(settings);
updateRouteAndReferesh(updateRoute);
}
-
-
+
+
public boolean hasTooLongDistanceToNavigate() {
if(settings.ROUTER_SERVICE.get() != RouteService.OSMAND) {
return false;
@@ -227,24 +276,24 @@ public class TargetPointsHelper {
}
return false;
}
-
+
public void navigateToPoint(LatLon point, boolean updateRoute, int intermediate){
navigateToPoint(point, updateRoute, intermediate, null);
}
-
+
public void navigateToPoint(LatLon point, boolean updateRoute, int intermediate, String historyName){
if(point != null){
if(intermediate < 0 || intermediate > intermediatePoints.size()) {
if(intermediate > intermediatePoints.size()) {
LatLon pn = getPointToNavigate();
if(pn != null) {
- settings.insertIntermediatePoint(pn.getLatitude(), pn.getLongitude(), getPointNavigateDescription(),
+ settings.insertIntermediatePoint(pn.getLatitude(), pn.getLongitude(), getPointNavigateDescription(),
intermediatePoints.size());
}
}
settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), historyName);
} else {
- settings.insertIntermediatePoint(point.getLatitude(), point.getLongitude(), historyName,
+ settings.insertIntermediatePoint(point.getLatitude(), point.getLongitude(), historyName,
intermediate);
}
} else {
@@ -254,7 +303,7 @@ public class TargetPointsHelper {
readFromSettings(settings);
updateRouteAndReferesh(updateRoute);
}
-
+
public void setStartPoint(LatLon startPoint, boolean updateRoute, String name) {
if(startPoint != null) {
settings.setPointToStart(startPoint.getLatitude(), startPoint.getLongitude(), name);
@@ -264,7 +313,7 @@ public class TargetPointsHelper {
readFromSettings(settings);
updateRouteAndReferesh(updateRoute);
}
-
+
public boolean checkPointToNavigate(){
if(pointToNavigate == null){
ctx.showToastMessage(R.string.mark_final_location_first);
@@ -272,7 +321,7 @@ public class TargetPointsHelper {
}
return true;
}
-
+
public boolean checkPointToNavigateShort(){
if(pointToNavigate == null){
ctx.showShortToastMessage(R.string.mark_final_location_first);
@@ -284,6 +333,4 @@ public class TargetPointsHelper {
public Location getPointToStartLocation() {
return wrap(getPointToStart());
}
-
-
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java
index 6f24115a79..c8e290e32c 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavouritesActivity.java
@@ -6,6 +6,7 @@ package net.osmand.plus.activities;
import java.io.File;
import java.util.ArrayList;
+import android.content.Intent;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
@@ -36,6 +37,10 @@ public class FavouritesActivity extends SherlockFragmentActivity {
private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
private static final String TRACKS = "TRACKS";
private static final String SELECTED_TRACK = "SELECTED_TRACK";
+ public static int FAVORITES_TAB = 0;
+ public static int GPX_TAB = 1;
+ public static int SELECTED_GPX_TAB = 2;
+ public static String TAB_PARAM = "TAB_PARAM";
private TabsAdapter mTabsAdapter;
private TabSpec selectedTrack;
private TabHost tabHost;
@@ -85,7 +90,15 @@ public class FavouritesActivity extends SherlockFragmentActivity {
AvailableGPXFragment.class, null);
selectedTrack = mTabsAdapter.addTab(tabHost.newTabSpec(SELECTED_TRACK).setIndicator(getString(R.string.selected_track)),
SelectedGPXFragment.class, null);
- tabHost.setCurrentTab(tab);
+ Intent intent = getIntent();
+ if(intent != null) {
+ int tt = intent.getIntExtra(TAB_PARAM, -1);
+ if(tt >= 0) {
+ tabHost.setCurrentTab(tt);
+ }
+ } else {
+ tabHost.setCurrentTab(tab);
+ }
updateSelectedTracks();
}
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index ff2e996ee6..fd14fabdfc 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -301,6 +301,7 @@ public class MapActivity extends AccessibleActivity {
}
settings.MAP_ACTIVITY_ENABLED.set(true);
+ app.setMapActivity(this);
checkExternalStorage();
showAndHideMapPosition();
@@ -559,6 +560,7 @@ public class MapActivity extends AccessibleActivity {
settings.setLastKnownMapZoom(mapView.getZoom());
settings.MAP_ACTIVITY_ENABLED.set(false);
+ app.setMapActivity(null);
app.getResourceManager().interruptRendering();
app.getResourceManager().setBusyIndicator(null);
OsmandPlugin.onMapActivityPause(this);
diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
index 93a2fab224..5810d31ad6 100644
--- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java
@@ -4,29 +4,24 @@ import java.io.File;
import java.util.*;
import android.content.Context;
+import android.content.Intent;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
import net.osmand.data.LatLon;
-import net.osmand.plus.ApplicationMode;
-import net.osmand.plus.GPXUtilities;
+import net.osmand.plus.*;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.Route;
import net.osmand.plus.GPXUtilities.WptPt;
-import net.osmand.plus.OsmAndFormatter;
-import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.OsmandPlugin;
-import net.osmand.plus.R;
-import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.sherpafy.WaypointDialogHelper;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import net.osmand.util.MapUtils;
-import android.content.Intent;
import android.graphics.Paint;
import android.os.AsyncTask;
import android.text.format.DateFormat;
@@ -242,6 +237,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
routeStepsControl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+// FavouritesDbHelper fp = map.getMyApplication().getFavorites();
+// app.getTargetPointsHelper().addVisibleLocationPoint(fp.getFavouritePoints().get(new Random().nextInt(fp.getFavouritePoints().size())));
Intent intent = new Intent(app, RoutePointsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
app.startActivity(intent);
@@ -252,6 +249,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
return routeStepsControl;
}
+
public class RoutePoint {
boolean isNextNavigate;
int gpxOrder;
diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java
index 15f0151e37..2c73c90814 100644
--- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java
+++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java
@@ -1,5 +1,6 @@
package net.osmand.plus.routing;
+import com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator;
import gnu.trove.list.array.TIntArrayList;
import java.util.ArrayList;
@@ -13,6 +14,7 @@ import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
import net.osmand.data.DataTileManager;
import net.osmand.data.LatLon;
+import net.osmand.data.LocationPoint;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.R;
@@ -30,7 +32,7 @@ public class RouteCalculationResult {
private final List directions;
private final List segments;
private final List alarmInfo;
- private final List waypoints;
+ private final List waypoints;
private final String errorMessage;
private final int[] listDistance;
private final int[] intermediatePoints;
@@ -59,11 +61,11 @@ public class RouteCalculationResult {
this.directions = new ArrayList();
this.alarmInfo = new ArrayList();
this.waypointIndexes = new int[0];
- this.waypoints = new ArrayList();
+ this.waypoints = new ArrayList();
}
public RouteCalculationResult(List list, List directions, RouteCalculationParams params,
- DataTileManager waypointsTm) {
+ DataTileManager extends LocationPoint> waypointsTm) {
this.routingTime = 0;
this.errorMessage = null;
this.intermediatePoints = new int[params.intermediates == null ? 0 : params.intermediates.size()];
@@ -89,12 +91,12 @@ public class RouteCalculationResult {
calculateIntermediateIndexes(params.ctx, this.locations, params.intermediates, localDirections, this.intermediatePoints);
this.directions = Collections.unmodifiableList(localDirections);
updateDirectionsTime(this.directions, this.listDistance);
- this.waypoints = new ArrayList();
+ this.waypoints = new ArrayList();
this.waypointIndexes = calculateWaypointIndexes(list, waypointsTm, waypoints);
}
public RouteCalculationResult(List list, Location start, LatLon end, List intermediates,
- Context ctx, boolean leftSide, float routingTime) {
+ Context ctx, boolean leftSide, float routingTime,DataTileManager waypointsTm) {
this.routingTime = routingTime;
List computeDirections = new ArrayList();
this.errorMessage = null;
@@ -113,17 +115,18 @@ public class RouteCalculationResult {
this.directions = Collections.unmodifiableList(computeDirections);
updateDirectionsTime(this.directions, this.listDistance);
this.alarmInfo = Collections.unmodifiableList(alarms);
- this.waypointIndexes = new int[0];
- this.waypoints = new ArrayList();
+ this.waypoints = new ArrayList();
+
+ this.waypointIndexes = calculateWaypointIndexes(this.locations, waypointsTm, waypoints);
}
- public List getWaypointsToAnnounce(Location loc) {
+ public List getWaypointsToAnnounce(Location loc) {
if (currentWaypointGPX != lastWaypointGPX && loc != null) {
- ArrayList points = new ArrayList();
+ ArrayList points = new ArrayList();
Location next = locations.get(currentRoute);
float dist = loc.distanceTo(next);
while (currentWaypointGPX < lastWaypointGPX) {
- WptPt w = waypoints.get(currentWaypointGPX);
+ WptPt w = (WptPt) waypoints.get(currentWaypointGPX);
if(MapUtils.getDistance(w.lat, w.lon, next.getLatitude(), next.getLongitude()) > dist + 50) {
currentWaypointGPX++;
} else {
@@ -131,7 +134,7 @@ public class RouteCalculationResult {
}
}
while (currentWaypointGPX < lastWaypointGPX) {
- WptPt w = waypoints.get(currentWaypointGPX);
+ WptPt w = (WptPt) waypoints.get(currentWaypointGPX);
if(MapUtils.getDistance(w.lat, w.lon, loc.getLatitude(), next.getLongitude()) < 60) {
currentWaypointGPX++;
points.add(w);
@@ -519,27 +522,27 @@ public class RouteCalculationResult {
* PREPARATION
*
*/
- private int[] calculateWaypointIndexes(List list, DataTileManager waypointsTm, List waypoints) {
+ private int[] calculateWaypointIndexes(List list, DataTileManager extends LocationPoint> waypointsTm, List waypoints) {
if(waypointsTm == null || waypointsTm.isEmpty() || list.size() == 0) {
return new int[0];
}
TIntArrayList ls = new TIntArrayList();
Location loc = list.get(0);
Location ploc = list.get(0);
- Set added = new HashSet();
+ Set added = new HashSet();
int prev31x = MapUtils.get31TileNumberX(loc.getLatitude());
int prev31y = MapUtils.get31TileNumberY(loc.getLongitude());
for(int j = 1; j < list.size(); j++) {
loc = list.get(j);
int t31x = MapUtils.get31TileNumberX(loc.getLatitude());
int t31y = MapUtils.get31TileNumberY(loc.getLongitude());
- List ws = waypointsTm.getObjects(Math.min(prev31x, t31x) - Math.abs(t31x - prev31x) / 4,
+ List extends LocationPoint> ws = waypointsTm.getObjects(Math.min(prev31x, t31x) - Math.abs(t31x - prev31x) / 4,
Math.min(prev31y, t31y) - Math.abs(t31y - prev31y) / 4,
Math.max(prev31x, t31x) + Math.abs(t31x - prev31x) / 4,
Math.max(prev31y, t31y) + Math.abs(t31y - prev31y) / 4);
- for(WptPt w : ws) {
+ for(LocationPoint w : ws) {
if (added.contains(w)) {
- double ds = MapUtils.getOrthogonalDistance(w.lat, w.lon, ploc.getLatitude(), ploc.getLongitude(), loc.getLatitude(),
+ double ds = MapUtils.getOrthogonalDistance(w.getLatitude(), w.getLongitude(), ploc.getLatitude(), ploc.getLongitude(), loc.getLatitude(),
loc.getLongitude());
if (ds < 160) {
ls.add(j);
diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java
index ea0ca48abd..c29bcb0517 100644
--- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java
+++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java
@@ -22,10 +22,12 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
+import com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.DataTileManager;
+import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.GPXUtilities;
@@ -775,8 +777,13 @@ public class RouteProvider {
// something really strange better to see that message on the scren
return emptyResult();
} else {
+ DataTileManager mngr = new DataTileManager