some work on STOP direction

This commit is contained in:
sonora 2017-10-27 15:36:42 +02:00
parent e1d8d443a3
commit 9afed0966b
2 changed files with 19 additions and 13 deletions

View file

@ -685,21 +685,27 @@ public class RouteDataObject {
return direction;
}
public boolean isStopDirectionOpposite(boolean direction) {
for(int i=0; i<types.length; i++) {
public int isStopForward(boolean direction) {
for (int i = 0; i < types.length; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
if (r.getTag().equals("highway") && r.getValue().equals("stop")) {
for (int j=0; j<types.length; j++) {
if (direction = true && r.getTag().equals("direction") && r.getValue().equals("backward")) {
return true;
}
if (direction = false && r.getTag().equals("direction") && r.getValue().equals("forward")) {
return true;
for (int j = 0; j < types.length; j++) {
if (r.getTag().equals("direction")) {
string dv = r.getValue();
if ((dv.equals("forward") && direction = true) || (dv.equals("backward") && direction = false)) {
return 1;
} else if ((dv.equals("forward") && direction = false) || (dv.equals("backward") && direction = true)) {
return -1;
}
}
// stop=all usually tagged on conflicting node itself, so not needed here
//if (r.getTag().equals("stop") && r.getValue().equals("all")) {
// return 1;
//}
}
}
}
return false;
return 0; //no directional info detected
}
public double distance(int startPoint, int endPoint) {

View file

@ -272,13 +272,13 @@ public class WaypointHelper {
RouteTypeRule typeRule = reg.quickGetEncodingRule(pointTypes[r]);
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0, loc);
//Check if stop sign is tagged with direction=forward/backward
// Check if stop has directional info
if (info != null && info.getType() != null && info.getType() == AlarmInfoType.STOP) {
//TODO: better than bearingVsRouteDirection would be routeVsWayDirection analysis
if (ro.isStopDirectionOpposite(ro.bearingVsRouteDirection(loc))) {
// TODO: better than bearingVsRouteDirection would be routeVsWayDirection analysis
if (ro.isStopForward(ro.bearingVsRouteDirection(loc) == -1)) {
info = null;
}
//TODO: Still missing here is analysis if a stop without direction=* tagging is _behind_ an intersection
// TODO: Could add some analysis here if a stop without directional tagging is shortly _behind_ an intersection
}
// Issue #2873 may indicate we need some sort of check here if Alarm is in forward direction