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