Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d66ed711d6
3 changed files with 34 additions and 6 deletions
|
@ -183,15 +183,21 @@ public class WaypointHelper {
|
|||
int kIterator = pointsProgress.get(ALARMS);
|
||||
List<LocationPointWrapper> lp = locationPoints.get(ALARMS);
|
||||
while (kIterator < lp.size()) {
|
||||
LocationPointWrapper lwp = lp.get(kIterator);
|
||||
if (lp.get(kIterator).routeIndex < route.getCurrentRoute()) {
|
||||
AlarmInfo inf = (AlarmInfo) lp.get(kIterator).point;
|
||||
int currentRoute = route.getCurrentRoute();
|
||||
if (inf.getLocationIndex() < currentRoute && inf.getLastLocationIndex() != -1
|
||||
&& inf.getLastLocationIndex() < currentRoute) {
|
||||
// skip
|
||||
} else {
|
||||
int d = route.getDistanceToPoint(lwp.routeIndex);
|
||||
if (inf.getType() == AlarmInfoType.TUNNEL && inf.getLastLocationIndex() != -1
|
||||
&& currentRoute > inf.getLocationIndex()
|
||||
&& currentRoute < inf.getLastLocationIndex()) {
|
||||
inf.setFloatValue(route.getDistanceToPoint(inf.getLastLocationIndex()));
|
||||
}
|
||||
int d = route.getDistanceToPoint(inf.getLocationIndex());
|
||||
if (d > LONG_ANNOUNCE_RADIUS) {
|
||||
break;
|
||||
}
|
||||
AlarmInfo inf = (AlarmInfo) lwp.point;
|
||||
float time = speed > 0 ? d / speed : Integer.MAX_VALUE;
|
||||
int vl = inf.updateDistanceAndGetPriority(time, d);
|
||||
if (vl < value && (showCameras || inf.getType() != AlarmInfoType.SPEED_CAMERA)) {
|
||||
|
@ -325,11 +331,21 @@ public class WaypointHelper {
|
|||
if (lp != null) {
|
||||
int kIterator = pointsProgress.get(type);
|
||||
while (kIterator < lp.size() && lp.get(kIterator).routeIndex < currentRoute) {
|
||||
if (type == ALARMS) {
|
||||
AlarmInfo alarm = (AlarmInfo) lp.get(kIterator).getPoint();
|
||||
if (alarm.getLastLocationIndex() >= currentRoute) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
kIterator++;
|
||||
}
|
||||
pointsProgress.set(type, kIterator);
|
||||
while (kIterator < lp.size()) {
|
||||
LocationPointWrapper lwp = lp.get(kIterator);
|
||||
if (type == ALARMS && lwp.routeIndex < currentRoute) {
|
||||
kIterator++;
|
||||
continue;
|
||||
}
|
||||
if (lwp.announce) {
|
||||
if (route.getDistanceToPoint(lwp.routeIndex) > LONG_ANNOUNCE_RADIUS * 2) {
|
||||
break;
|
||||
|
|
|
@ -41,6 +41,7 @@ public class AlarmInfo implements LocationPoint {
|
|||
|
||||
private AlarmInfoType type;
|
||||
protected final int locationIndex;
|
||||
private int lastLocationIndex = -1;
|
||||
private int intValue;
|
||||
private float floatValue;
|
||||
private double latitude;
|
||||
|
@ -81,11 +82,19 @@ public class AlarmInfo implements LocationPoint {
|
|||
public int getLocationIndex() {
|
||||
return locationIndex;
|
||||
}
|
||||
|
||||
|
||||
public int getLastLocationIndex() {
|
||||
return lastLocationIndex;
|
||||
}
|
||||
|
||||
public void setLastLocationIndex(int lastLocationIndex) {
|
||||
this.lastLocationIndex = lastLocationIndex;
|
||||
}
|
||||
|
||||
public void setIntValue(int intValue) {
|
||||
this.intValue = intValue;
|
||||
}
|
||||
|
||||
|
||||
public static AlarmInfo createSpeedLimit(int speed, Location loc){
|
||||
AlarmInfo info = new AlarmInfo(AlarmInfoType.SPEED_LIMIT, 0);
|
||||
info.setLatLon(loc.getLatitude(), loc.getLongitude());
|
||||
|
|
|
@ -239,6 +239,9 @@ public class RouteCalculationResult {
|
|||
tunnelAlarm.setFloatValue(tunnelAlarm.getFloatValue() + s.getDistance());
|
||||
}
|
||||
} else {
|
||||
if (tunnelAlarm != null) {
|
||||
tunnelAlarm.setLastLocationIndex(locations.size());
|
||||
}
|
||||
tunnelAlarm = null;
|
||||
}
|
||||
while (true) {
|
||||
|
|
Loading…
Reference in a new issue