diff options
author | mvglasow <mvglasow@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-09 01:40:07 +0000 |
---|---|---|
committer | mvglasow <mvglasow@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-09 01:40:07 +0000 |
commit | 51ff320a33b5b3ba706bdcc21d098a55e4f0aaab (patch) | |
tree | bb6acc415763499ab0e0c2a7e11bf10eb2765e39 | |
parent | 84dcfe7398002f3acd3dc5dd20a0564adebaa368 (diff) | |
download | navit-svn-51ff320a33b5b3ba706bdcc21d098a55e4f0aaab.tar.gz |
Fix:core:Announce turns when going straight is not allowed | One step closer to fixing #660, thanks jandegr and tryagain
Signed-off-by: mvglasow <michael -at- vonglasow.com>
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5933 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/navigation.c | 94 |
1 files changed, 45 insertions, 49 deletions
diff --git a/navit/navigation.c b/navit/navigation.c index 96b84946..22a028ef 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -1263,35 +1263,35 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na } else if (w->item.type != type_ramp) { num_other++; } - if (w != &(new->way)) { - dw=angle_delta(old->angle_end, w->angle2); - if (dw < 0) { - if (dw > left) - left=dw; - if (dw > -curve_limit && d < 0 && d > -curve_limit) - dc=dw; - } else { - if (dw < right) - right=dw; - if (dw < curve_limit && d > 0 && d < curve_limit) - dc=dw; - } - wcat=maneuver_category(w->item.type); - /* If any other street has the same name, we can't use the same name criterion. - * Exceptions apply if we're coming from a motorway-like road and: - * - the other road is motorway-like (a motorway might split up temporarily) or - * - the other road is a ramp (they are sometimes tagged with the name of the motorway) - * The second one is really a workaround for bad tagging practice in OSM. Since entering - * a ramp always creates a maneuver, we don't expect the workaround to have any unwanted - * side effects. - */ - if (is_same_street && is_same_street2(old->way.name1, old->way.name2, w->name1, w->name2) && (!is_motorway_like(&(old->way)) || (!is_motorway_like(w) && w->item.type != type_ramp)) && is_way_allowed(nav,w,2)) - is_same_street=0; - /* Mark if the street has a higher or the same category */ - if (wcat > maxcat) - maxcat=wcat; - } /* if w != new->way */ } /* if is_way_allowed */ + if (w != &(new->way)) { + dw=angle_delta(old->angle_end, w->angle2); + if (dw < 0) { + if (dw > left) + left=dw; + if (dw > -curve_limit && d < 0 && d > -curve_limit) + dc=dw; + } else { + if (dw < right) + right=dw; + if (dw < curve_limit && d > 0 && d < curve_limit) + dc=dw; + } + wcat=maneuver_category(w->item.type); + /* If any other street has the same name, we can't use the same name criterion. + * Exceptions apply if we're coming from a motorway-like road and: + * - the other road is motorway-like (a motorway might split up temporarily) or + * - the other road is a ramp (they are sometimes tagged with the name of the motorway) + * The second one is really a workaround for bad tagging practice in OSM. Since entering + * a ramp always creates a maneuver, we don't expect the workaround to have any unwanted + * side effects. + */ + if (is_same_street && is_same_street2(old->way.name1, old->way.name2, w->name1, w->name2) && (!is_motorway_like(&(old->way)) || (!is_motorway_like(w) && w->item.type != type_ramp)) && is_way_allowed(nav,w,2)) + is_same_street=0; + /* Mark if the street has a higher or the same category */ + if (wcat > maxcat) + maxcat=wcat; + } /* if w != new->way */ //if ((w->flags & AF_ONEWAYMASK) && is_same_street2(new->way.name1, new->way.name2, w->name1, w->name2)) if (is_same_street2(new->way.name1, new->way.name2, w->name1, w->name2)) // FIXME: for some reason new->way has no flags set (at least in my test case), so we can't test for oneway @@ -1327,10 +1327,25 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na ret=1; r="yes: turning into dual-carriageway through-road of T junction"; } - if (!r) - r="no: only one option permitted"; } } + if (!r && abs(d) > 75) { + /* always make an announcement if you have to make a sharp turn */ + r="yes: delta over 75"; + ret=1; + } else if (!r && abs(d) >= curve_limit) { + if ((cat >= maneuver_category(type_street_2_city)) && (num_similar > 1)) { + /* When coming from street_2_* or higher category road, check if + * - we have multiple options of the same category and + * - we have to make a considerable turn (at least curve_limit) + * If both is the case, ANNOUNCE. + */ + ret=1; + r="yes: more than one similar road and delta >= curve_limit"; + } + } + if ((!r) && (num_options <= 1)) + r="no: only one option permitted"; if (!r) { if (is_motorway_like(&(old->way)) && (num_other == 0) && (num_new_motorways > 1)) { /* If we are at a motorway interchange, ANNOUNCE @@ -1357,25 +1372,6 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na ret=1; } } - if (!r && abs(d) > 75) { - /* always make an announcement if you have to make a sharp turn */ - r="yes: delta over 75"; - ret=1; - } else if (!r && abs(d) >= curve_limit) { - /* When coming from street_2_* or higher category road, check if - * - we have multiple options of the same category and - * - we have to make a considerable turn (at least curve_limit) - * If both is the case, ANNOUNCE. - * Note: 22.5 degrees is the threshold because anything higher is - * closer to 45 than to 0 degrees. - */ - if (cat >= maneuver_category(type_street_2_city)) { - if (num_similar > 1) { - ret=1; - r="yes: more than one similar road and delta >= curve_limit"; - } - } - } ncat=maneuver_category(new->way.item.type); if (!r) { /* get the delta limit for checking for other streets. It is lower if the street has no other |