simplify code
This commit is contained in:
parent
346d99d653
commit
22aa402169
3 changed files with 17 additions and 21 deletions
|
@ -685,11 +685,10 @@ public class RouteDataObject {
|
|||
return direction;
|
||||
}
|
||||
|
||||
public int isStopForward(boolean direction) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
public int isStopApplicable(boolean direction) {
|
||||
int sz = types.length;
|
||||
for (int i = 0; i < sz; 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 (r.getTag().equals("direction")) {
|
||||
String dv = r.getValue();
|
||||
if ((dv.equals("forward") && direction == true) || (dv.equals("backward") && direction == false)) {
|
||||
|
@ -703,8 +702,7 @@ public class RouteDataObject {
|
|||
// return 1;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Open: Could add some analysis if a STOP without directional tagging is shortly _behind_ an intersection
|
||||
return 0; //no directional info detected
|
||||
}
|
||||
|
||||
|
|
|
@ -273,9 +273,9 @@ public class WaypointHelper {
|
|||
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, 0, loc);
|
||||
|
||||
// For STOP first check if it has directional info
|
||||
// Issue #2885: This seems to fail
|
||||
// TODO: Check if this is needed here
|
||||
if (info != null && info.getType() != null && info.getType() == AlarmInfoType.STOP) {
|
||||
if (ro.isStopForward(ro.bearingVsRouteDirection(loc)) == -1) {
|
||||
if (ro.isStopApplicable(ro.bearingVsRouteDirection(loc)) == -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();
|
||||
|
|
|
@ -191,9 +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
|
||||
// Issue #2885: This seems to fail
|
||||
// Open: Could also add some analysis if a STOP without directional tagging is shortly _behind_ an intersection
|
||||
if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && (res.getObject().isStopForward(res.isForwardDirection()) == -1))) {
|
||||
if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && (res.getObject().isStopApplicable(res.isForwardDirection()) == -1))) {
|
||||
alarms.add(info);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue