Merge pull request #907 from Bars107/master

Simplified fix for multiple announced waypoints.
This commit is contained in:
vshcherb 2014-10-07 15:22:08 +03:00
commit 66cbf94aae

View file

@ -59,8 +59,6 @@ public class WaypointHelper {
private List<List<LocationPointWrapper>> locationPoints = new ArrayList<List<LocationPointWrapper>>();
private ConcurrentHashMap<LocationPoint, Integer> locationPointsStates = new ConcurrentHashMap<LocationPoint, Integer>();
private List<LocationPointWrapper> alreadyAnnouncedPoints = new ArrayList<LocationPointWrapper>();
private List<LocationPointWrapper> alreadyApproachedPoints = new ArrayList<LocationPointWrapper>();
private TIntArrayList pointsProgress = new TIntArrayList();
private RouteCalculationResult route;
@ -321,24 +319,15 @@ public class WaypointHelper {
if (state != null && state.intValue() == ANNOUNCED_ONCE
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS)) {
locationPointsStates.put(point, ANNOUNCED_DONE);
if (!alreadyAnnouncedPoints.contains(lwp)){
announcePoints.add(lwp);
alreadyAnnouncedPoints.add(lwp);
}
} else if (type != ALARMS && (state == null || state == NOT_ANNOUNCED)
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS)) {
locationPointsStates.put(point, ANNOUNCED_ONCE);
if (!alreadyApproachedPoints.contains(lwp)){
approachPoints.add(lwp);
alreadyApproachedPoints.add(lwp);
}
} else if (type == ALARMS && (state == null || state == NOT_ANNOUNCED)
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, ALARMS_ANNOUNCE_RADIUS)) {
locationPointsStates.put(point, ANNOUNCED_ONCE);
if (!alreadyApproachedPoints.contains(lwp)){
approachPoints.add(lwp);
alreadyApproachedPoints.add(lwp);
}
}
kIterator++;
}
@ -417,7 +406,7 @@ public class WaypointHelper {
}
public void clearAllVisiblePoints() {
this.locationPointsStates.clear();
//this.locationPointsStates.clear();
this.locationPoints = new ArrayList<List<LocationPointWrapper>>();
}
@ -489,7 +478,7 @@ public class WaypointHelper {
protected synchronized void setLocationPoints(List<List<LocationPointWrapper>> locationPoints, RouteCalculationResult route) {
this.locationPoints = locationPoints;
this.locationPointsStates.clear();
//this.locationPointsStates.clear();
TIntArrayList list = new TIntArrayList(locationPoints.size());
list.fill(0, locationPoints.size(), 0);
this.pointsProgress = list;