summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2015-10-04 18:58:51 +0200
committermvglasow <michael -at- vonglasow.com>2015-10-04 18:58:51 +0200
commit83974e5713e6a17f8f7abe0be80641521c5e4527 (patch)
tree870564a9a8dc34bd8aab495b55d5cabb57506f81
parentb6e6f9a69e56c24ddabcd80ae2394bcd702758b2 (diff)
parenteac6f24eb75d2657e22c2030e487c417f223e362 (diff)
downloadnavit-83974e5713e6a17f8f7abe0be80641521c5e4527.tar.gz
Merge branch 'trunk' into trac1324
-rw-r--r--navit/navigation.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/navit/navigation.c b/navit/navigation.c
index c16570954..1b5f08dbd 100644
--- a/navit/navigation.c
+++ b/navit/navigation.c
@@ -1625,7 +1625,6 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
item_hash_insert(this_->hash, streetitem, ret);
mr=map_rect_new(streetitem->map, NULL);
-
struct map *tmap = streetitem->map;
if (! (streetitem=map_rect_get_item_byid(mr, streetitem->id_hi, streetitem->id_lo))) {
@@ -1680,10 +1679,8 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
}
}
}
-
navigation_itm_update(ret, routeitem);
-
while (item_coord_get(routeitem, &c[i], 1))
{
dbg(lvl_debug, "coord %d 0x%x 0x%x\n", i, c[i].x ,c[i].y);
@@ -1705,6 +1702,15 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
ret->start=c[0];
ret->end=c[i];
+ if(item_attr_get(routeitem, attr_route, &route_attr))
+ graph_map = route_get_graph_map(route_attr.u.route);
+ if (graph_map )
+ {
+ if (this_->last)
+ ret->prev=this_->last;
+ navigation_itm_ways_update(ret,graph_map);
+ }
+
/* If we have a ramp, check the map for higway_exit info,
* but only on the first node of the ramp.
* We are doing the same for motorway-like roads because some
@@ -1715,10 +1721,9 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
* If present, obtain exit_ref, exit_label and exit_to
* from the map.
*/
- if ( (streetitem->type == type_ramp)
- || (streetitem->type == type_highway_land)
- || (streetitem->type == type_highway_city)
- || (streetitem->type == type_street_n_lanes)) {
+ if (ret->way.next && ((streetitem->type == type_ramp) || (streetitem->type == type_highway_land)
+ || (streetitem->type == type_highway_city) || (streetitem->type == type_street_n_lanes)))
+ {
struct map_selection mselexit;
struct item *rampitem;
dbg(lvl_debug,"test ramp\n");
@@ -1726,7 +1731,7 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
mselexit.u.c_rect.lu = c[0] ;
mselexit.u.c_rect.rl = c[0] ;
mselexit.range = item_range_all;
- mselexit.order = 18;
+ mselexit.order =18;
map_rect_destroy(mr);
mr = map_rect_new(tmap, &mselexit);
@@ -1741,12 +1746,12 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
if (attr.type && attr.type == attr_label)
{
dbg(lvl_debug,"exit_label=%s\n",attr.u.str);
- ret->way.exit_label= map_convert_string(streetitem->map,attr.u.str);
+ ret->way.exit_label= map_convert_string(tmap,attr.u.str);
}
if (attr.type == attr_ref)
{
dbg(lvl_debug,"exit_ref=%s\n",attr.u.str);
- ret->way.exit_ref= map_convert_string(streetitem->map,attr.u.str);
+ ret->way.exit_ref= map_convert_string(tmap,attr.u.str);
}
if (attr.type == attr_exit_to)
{
@@ -1760,7 +1765,7 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
&& (this_->last)
&& (!(this_->last->way.item.type == type_ramp))) {
char *destination_raw;
- destination_raw=map_convert_string(streetitem->map,attr.u.str);
+ destination_raw=map_convert_string(tmap,attr.u.str);
dbg(lvl_debug,"destination_raw from exit_to =%s\n",destination_raw);
if ((split_string_to_list(&(ret->way),destination_raw, ';')) < 2)
/*
@@ -1777,10 +1782,6 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
}
}
}
-
- if(item_attr_get(routeitem, attr_route, &route_attr))
- graph_map = route_get_graph_map(route_attr.u.route);
-
dbg(lvl_debug,"i=%d start %d end %d '%s' \n", i, ret->way.angle2, ret->angle_end, ret->way.name_systematic);
map_rect_destroy(mr);
} else {
@@ -1792,9 +1793,6 @@ navigation_itm_new(struct navigation *this_, struct item *routeitem)
if (this_->last) {
this_->last->next=ret;
ret->prev=this_->last;
- if (graph_map) {
- navigation_itm_ways_update(ret,graph_map);
- }
}
dbg(lvl_debug,"ret=%p\n", ret);
this_->last=ret;
@@ -2336,7 +2334,17 @@ maneuver_required2 (struct navigation *nav, struct navigation_itm *old, struct n
if (!m.is_same_street && m.is_unambiguous < 1) { /* FIXME: why < 1? */
ret=1;
r="yes: different street and ambiguous";
- } else
+ }
+ /* we should have cat of the candidate within dlim
+ * instead of testing against max_cat.
+ * The highest cat road might be well outside dlim
+ */
+ else if (m.max_cat >= m.new_cat && m.is_unambiguous < 1)
+ {
+ ret = 1;
+ r="yes: ambiguous because of other candidates within dlim";
+ }
+ else
r="no: same street or unambiguous";
#ifdef DEBUG
r=g_strdup_printf("%s: d %d left %d right %d dlim=%d cat old:%d new:%d max:%d unambiguous=%d same_street=%d", ret==1?"yes":"no", m.delta, m.left, m.right, dlim, m.old_cat, m.new_cat, m.max_cat, m.is_unambiguous, m.is_same_street);