fix bug in STOP direction analysis

This commit is contained in:
sonora 2017-10-28 15:09:01 +02:00
parent d727018b44
commit 767ad1b239
4 changed files with 6 additions and 10 deletions

View file

@ -52,7 +52,6 @@ public class BinaryMapRouteReaderAdapter {
public final static int TRAFFIC_SIGNALS = 6;
public final static int RAILWAY_CROSSING = 7;
private final static int LANES = 8;
private final static int STOP = 9;
private final String t;
private final String v;
private int intValue;
@ -151,8 +150,6 @@ public class BinaryMapRouteReaderAdapter {
}
} else if(t.equalsIgnoreCase("highway") && "traffic_signals".equals(v)){
type = TRAFFIC_SIGNALS;
} else if(t.equalsIgnoreCase("highway") && "stop".equals(v)){
type = STOP;
} else if(t.equalsIgnoreCase("railway") && ("crossing".equals(v) || "level_crossing".equals(v))){
type = RAILWAY_CROSSING;
} else if(t.equalsIgnoreCase("roundabout") && v != null){

View file

@ -685,10 +685,11 @@ public class RouteDataObject {
return direction;
}
public int isStopApplicable(boolean direction) {
int sz = types.length;
public int isStopApplicable(boolean direction, int intId) {
int[] pt = getPointTypes(intId);
int sz = pt.length;
for (int i = 0; i < sz; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
RouteTypeRule r = region.quickGetEncodingRule(pt[i]);
if (r.getTag().equals("direction")) {
String dv = r.getValue();
if ((dv.equals("forward") && direction == true) || (dv.equals("backward") && direction == false)) {

View file

@ -273,12 +273,10 @@ public class WaypointHelper {
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0, loc);
// For STOP first check if it has directional info
// TODO: Check if this is needed here
if (info != null && info.getType() != null && info.getType() == AlarmInfoType.STOP) {
if (ro.isStopApplicable(ro.bearingVsRouteDirection(loc)) == -1) {
if (ro.isStopApplicable(ro.bearingVsRouteDirection(loc), i) == -1) {
info = null;
}
//Toast.makeText(app.getApplicationContext(), Double.toString(ro.directionRoute(0, true)) + ",\n" + Double.toString(loc.getBearing()) + ",\n" + Double.toString(MapUtils.alignAngleDifference(ro.directionRoute(0, true) - loc.getBearing() / 180f * Math.PI))), Toast.LENGTH_LONG).show();
}
if (info != null) {

View file

@ -191,7 +191,7 @@ public class RouteCalculationResult {
loc.setLongitude(MapUtils.get31LongitudeX(x31));
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, locInd, loc);
// For STOP first check if it has directional info
if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && (res.getObject().isStopApplicable(res.isForwardDirection()) == -1))) {
if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && (res.getObject().isStopApplicable(res.isForwardDirection(), intId) == -1))) {
alarms.add(info);
}
}