From e00976f6e4bd97a372590bfc6caf62a3408783af Mon Sep 17 00:00:00 2001 From: kazer_ Date: Mon, 1 Sep 2008 09:45:27 +0000 Subject: [PATCH] Patch:Core:Patch from Helge to add offset to dashed polylines. Thank you git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1354 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/graphics.c | 3 ++- navit/navit/item_def.h | 1 + navit/navit/layout.c | 3 ++- navit/navit/layout.h | 3 ++- navit/navit/navit.xml | 30 ++++++++++++++++++++++++++---- navit/navit/osm2navit.c | 1 + navit/navit/xmlconfig.c | 9 ++++++--- 7 files changed, 40 insertions(+), 10 deletions(-) diff --git a/navit/navit/graphics.c b/navit/navit/graphics.c index a32ab0d..d5f0e28 100644 --- a/navit/navit/graphics.c +++ b/navit/navit/graphics.c @@ -673,7 +673,8 @@ static void xdisplay_draw_elements(struct graphics *gra, GHashTable *display_lis if (e->u.polyline.width > 1) gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width); if (e->u.polyline.width > 0 && e->u.polyline.dash_num > 0) - graphics_gc_set_dashes(gc, e->u.polyline.width, 0, + graphics_gc_set_dashes(gc, e->u.polyline.width, + e->u.polyline.dash_offset, e->u.polyline.dash_table, e->u.polyline.dash_num); gra->meth.draw_lines(gra->priv, gc->priv, di->pnt, di->count); diff --git a/navit/navit/item_def.h b/navit/navit/item_def.h index e7a02a3..648327c 100644 --- a/navit/navit/item_def.h +++ b/navit/navit/item_def.h @@ -364,6 +364,7 @@ ITEM(piste_downhill_intermediate) ITEM(piste_downhill_advanced) ITEM(piste_downhill_expert) ITEM(piste_downhill_freeride) +ITEM(footway_and_piste_nordic) /* Area */ ITEM2(0xc0000000,area) ITEM2(0xc0000001,area_unspecified) diff --git a/navit/navit/layout.c b/navit/navit/layout.c index e4f5571..eb124df 100644 --- a/navit/navit/layout.c +++ b/navit/navit/layout.c @@ -100,7 +100,7 @@ polygon_new(struct color *color) struct element * polyline_new(struct color *color, int width, int directed, - int *dash_table, int dash_num) + int dash_offset, int *dash_table, int dash_num) { struct element *e; int i; @@ -110,6 +110,7 @@ polyline_new(struct color *color, int width, int directed, e->color=*color; e->u.polyline.width=width; e->u.polyline.directed=directed; + e->u.polyline.dash_offset = dash_offset; e->u.polyline.dash_num=dash_num; for (i=0; iu.polyline.dash_table[i] = dash_table[i]; diff --git a/navit/navit/layout.h b/navit/navit/layout.h index e6417d8..dda9834 100644 --- a/navit/navit/layout.h +++ b/navit/navit/layout.h @@ -37,6 +37,7 @@ struct element { int width; int directed; int dash_num; + int dash_offset; unsigned char dash_table[4]; } polyline; struct element_polygon { @@ -79,7 +80,7 @@ void layer_add_itemtype(struct layer *layer, struct itemtype *itemtype); void itemtype_add_element(struct itemtype *itemtype, struct element *element); struct element *polygon_new(struct color *color); struct element *polyline_new(struct color *color, int width, int directed, - int *dash_table, int dash_num); + int dash_offset, int *dash_table, int dash_num); struct element *circle_new(struct color *color, int radius, int width, int label_size); struct element *label_new(int label_size); struct element *icon_new(const char *src); diff --git a/navit/navit/navit.xml b/navit/navit/navit.xml index e682aa1..ac7c1aa 100644 --- a/navit/navit/navit.xml +++ b/navit/navit/navit.xml @@ -481,16 +481,38 @@ It's always the top left corner of the icon, so you need to consider the icon's - + - + + - + + - + + + + + + + + + + + + + + + + + + + + + diff --git a/navit/navit/osm2navit.c b/navit/navit/osm2navit.c index 21525d1..26873b9 100644 --- a/navit/navit/osm2navit.c +++ b/navit/navit/osm2navit.c @@ -172,6 +172,7 @@ static char *attrmap={ "w highway=path,bicycle=designated cycleway\n" "w highway=footway footway\n" "w piste:type=nordic piste_nordic\n" + "w highway=footway,piste:type=nordic footway_and_piste_nordic\n" "w route=ski piste_nordic\n" "w piste:type=downhill,piste:difficulty=novice piste_downhill_novice\n" "w piste:type=downhill,piste:difficulty=easy piste_downhill_easy\n" diff --git a/navit/navit/xmlconfig.c b/navit/navit/xmlconfig.c index c8da7f1..69541d9 100644 --- a/navit/navit/xmlconfig.c +++ b/navit/navit/xmlconfig.c @@ -522,8 +522,8 @@ static int xmlconfig_polyline(struct xmlstate *state) { struct color color; - const char *width, *dash, *directed; - int w=0, d=0, dt[4], ds=0; + const char *width, *dash, *directed, *dash_offset; + int w=0, d=0, doff=0, dt[4], ds=0; if (! find_color(state, 1, &color)) return 0; @@ -533,11 +533,14 @@ xmlconfig_polyline(struct xmlstate *state) dash=find_attribute(state, "dash", 0); if (dash) ds=convert_number_list(dash, dt, sizeof(dt)/sizeof(*dt)); + dash_offset=find_attribute(state, "offset", 0); + if (dash_offset) + doff=convert_number(dash_offset); directed=find_attribute(state, "directed", 0); if (directed) d=convert_number(directed); - state->element_attr.u.data=polyline_new(&color, w, d, dt, ds); + state->element_attr.u.data=polyline_new(&color, w, d, doff, dt, ds); if (! state->element_attr.u.data) return 0; itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data); -- 2.7.4