Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-30 07:53:59 +01:00
commit 1ff38c52aa
3 changed files with 13 additions and 12 deletions

View file

@ -685,7 +685,7 @@ public class RouteDataObject {
return direction; return direction;
} }
public boolean isStopApplicable(boolean direction, int intId) { public boolean isStopApplicable(boolean direction, int intId, int startPointInd, int endPointInd) {
int[] pt = getPointTypes(intId); int[] pt = getPointTypes(intId);
int sz = pt.length; int sz = pt.length;
for (int i = 0; i < sz; i++) { for (int i = 0; i < sz; i++) {
@ -704,11 +704,11 @@ public class RouteDataObject {
// return true; // return true;
//} //}
} }
// Experimental: Distance analysis for STOP with no recognized directional tagging (but exclude those mapped on intersection node) // Heuristic fallback: Distance analysis for STOP with no recognized directional tagging:
double d1 = distance(0, intId); // Mask STOPs closer to the start than to the end of the routing segment if it is within 50m of start, but do not mask STOPs mapped directly on start/end (likely intersection node)
double d2 = distance(intId, getPointsLength() - 1); double d2Start = distance(startPointInd, intId);
if (((direction == true) && (d1 < d2) && (d1 != 0)) double d2End = distance(intId, endPointInd);
|| ((direction == false) && (d1 > d2) && (d2 != 0))) { if ((d2Start < d2End) && d2Start != 0 && d2End != 0 && d2Start < 50) {
return false; return false;
} }
// No directional info detected // No directional info detected

View file

@ -273,11 +273,12 @@ 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
if (info != null && info.getType() != null && info.getType() == AlarmInfoType.STOP) { // Looks like has no effect here
if (!ro.isStopApplicable(ro.bearingVsRouteDirection(loc), i)) { //if (info != null && info.getType() != null && info.getType() == AlarmInfoType.STOP) {
info = null; // if (!ro.isStopApplicable(ro.bearingVsRouteDirection(loc), i)) {
} // info = null;
} // }
//}
if (info != null) { if (info != null) {
if (info.getType() != AlarmInfoType.SPEED_CAMERA || showCameras) { if (info.getType() != AlarmInfoType.SPEED_CAMERA || showCameras) {

View file

@ -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(), intId))) { if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && !res.getObject().isStopApplicable(res.isForwardDirection(), intId, res.getStartPointIndex(), res.getEndPointIndex()))) {
alarms.add(info); alarms.add(info);
} }
} }