From 6222ab42195a9b0a09a3bde7520c41f2594b842c Mon Sep 17 00:00:00 2001 From: martin-s Date: Thu, 25 Sep 2008 21:06:58 +0000 Subject: [PATCH] Fix:Core:Avoid duplicate segments, correct segment direction in graph git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1415 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/route.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/navit/navit/route.c b/navit/navit/route.c index d315e2b..9087cf6 100644 --- a/navit/navit/route.c +++ b/navit/navit/route.c @@ -485,6 +485,12 @@ route_graph_add_segment(struct route_graph *this, struct route_graph_point *star int flags, int offset) { struct route_graph_segment *s; + s=start->start; + while (s) { + if (item_is_equal(*item, s->item)) + return; + s=s->start_next; + } s = g_new0(struct route_graph_segment, 1); if (!s) { printf("%s:Out of memory\n", __FUNCTION__); @@ -1327,7 +1333,7 @@ rp_coord_get(void *priv_data, struct coord *c, int count) struct map_rect_priv *mr = priv_data; struct route_graph_point *p = mr->point; struct route_graph_segment *seg = mr->rseg; - int rc = 0,i; + int rc = 0,i,dir; for (i=0; i < count; i++) { if (mr->item.type == type_rg_point) { if (mr->last_coord >= 1) @@ -1336,7 +1342,12 @@ rp_coord_get(void *priv_data, struct coord *c, int count) } else { if (mr->last_coord >= 2) break; + dir=0; + if (seg->end->seg == seg) + dir=1; if (mr->last_coord) + dir=1-dir; + if (dir) c[i] = seg->end->c; else c[i] = seg->start->c; -- 2.7.4