fix bug in STOP direction analysis
This commit is contained in:
parent
d727018b44
commit
767ad1b239
4 changed files with 6 additions and 10 deletions
|
@ -52,7 +52,6 @@ public class BinaryMapRouteReaderAdapter {
|
||||||
public final static int TRAFFIC_SIGNALS = 6;
|
public final static int TRAFFIC_SIGNALS = 6;
|
||||||
public final static int RAILWAY_CROSSING = 7;
|
public final static int RAILWAY_CROSSING = 7;
|
||||||
private final static int LANES = 8;
|
private final static int LANES = 8;
|
||||||
private final static int STOP = 9;
|
|
||||||
private final String t;
|
private final String t;
|
||||||
private final String v;
|
private final String v;
|
||||||
private int intValue;
|
private int intValue;
|
||||||
|
@ -151,8 +150,6 @@ public class BinaryMapRouteReaderAdapter {
|
||||||
}
|
}
|
||||||
} else if(t.equalsIgnoreCase("highway") && "traffic_signals".equals(v)){
|
} else if(t.equalsIgnoreCase("highway") && "traffic_signals".equals(v)){
|
||||||
type = TRAFFIC_SIGNALS;
|
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))){
|
} else if(t.equalsIgnoreCase("railway") && ("crossing".equals(v) || "level_crossing".equals(v))){
|
||||||
type = RAILWAY_CROSSING;
|
type = RAILWAY_CROSSING;
|
||||||
} else if(t.equalsIgnoreCase("roundabout") && v != null){
|
} else if(t.equalsIgnoreCase("roundabout") && v != null){
|
||||||
|
|
|
@ -685,10 +685,11 @@ public class RouteDataObject {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int isStopApplicable(boolean direction) {
|
public int isStopApplicable(boolean direction, int intId) {
|
||||||
int sz = types.length;
|
int[] pt = getPointTypes(intId);
|
||||||
|
int sz = pt.length;
|
||||||
for (int i = 0; i < sz; i++) {
|
for (int i = 0; i < sz; i++) {
|
||||||
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
|
RouteTypeRule r = region.quickGetEncodingRule(pt[i]);
|
||||||
if (r.getTag().equals("direction")) {
|
if (r.getTag().equals("direction")) {
|
||||||
String dv = r.getValue();
|
String dv = r.getValue();
|
||||||
if ((dv.equals("forward") && direction == true) || (dv.equals("backward") && direction == false)) {
|
if ((dv.equals("forward") && direction == true) || (dv.equals("backward") && direction == false)) {
|
||||||
|
|
|
@ -273,12 +273,10 @@ public class WaypointHelper {
|
||||||
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0, loc);
|
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0, loc);
|
||||||
|
|
||||||
// For STOP first check if it has directional info
|
// 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 (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;
|
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) {
|
if (info != null) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class RouteCalculationResult {
|
||||||
loc.setLongitude(MapUtils.get31LongitudeX(x31));
|
loc.setLongitude(MapUtils.get31LongitudeX(x31));
|
||||||
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, locInd, loc);
|
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, locInd, loc);
|
||||||
// For STOP first check if it has directional info
|
// 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);
|
alarms.add(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue