From 4507883d1e111a365e0571331663872ea176ed41 Mon Sep 17 00:00:00 2001 From: martin-s Date: Mon, 24 Mar 2008 17:36:50 +0000 Subject: [PATCH] Add:Core:Added patches from Aurelien Jacobs git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@957 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/graphics.c | 4 ++++ navit/src/item_def.h | 2 ++ navit/src/layout.c | 7 ++++++- navit/src/layout.h | 5 ++++- navit/src/navit.xml | 13 ++++++++++--- navit/src/osm2navit.c | 3 ++- navit/src/xmlconfig.c | 23 ++++++++++++++++++++--- 7 files changed, 48 insertions(+), 9 deletions(-) diff --git a/navit/src/graphics.c b/navit/src/graphics.c index a4e188d..b83922d 100644 --- a/navit/src/graphics.c +++ b/navit/src/graphics.c @@ -389,6 +389,10 @@ xdisplay_draw_elements(struct graphics *gra, GHashTable *display_list, struct it case element_polyline: 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, + e->u.polyline.dash_table, + e->u.polyline.dash_num); gra->meth.draw_lines(gra->priv, gc->priv, di->pnt, di->count); break; case element_circle: diff --git a/navit/src/item_def.h b/navit/src/item_def.h index 69f2b58..2eb2832 100644 --- a/navit/src/item_def.h +++ b/navit/src/item_def.h @@ -230,6 +230,8 @@ ITEM(nav_roundabout_l5) ITEM(nav_roundabout_l6) ITEM(nav_roundabout_l7) ITEM(nav_roundabout_l8) +ITEM(poi_peak) +ITEM(poi_rail_station) /* Line */ ITEM2(0x80000000,line) ITEM2(0x80000001,line_unspecified) diff --git a/navit/src/layout.c b/navit/src/layout.c index 3acec7e..4b3d85c 100644 --- a/navit/src/layout.c +++ b/navit/src/layout.c @@ -68,15 +68,20 @@ polygon_new(struct color *color) } struct element * -polyline_new(struct color *color, int width, int directed) +polyline_new(struct color *color, int width, int directed, + int *dash_table, int dash_num) { struct element *e; + int i; e = g_new0(struct element, 1); e->type=element_polyline; e->color=*color; e->u.polyline.width=width; e->u.polyline.directed=directed; + e->u.polyline.dash_num=dash_num; + for (i=0; iu.polyline.dash_table[i] = dash_table[i]; return e; } diff --git a/navit/src/layout.h b/navit/src/layout.h index fcf60d5..8783100 100644 --- a/navit/src/layout.h +++ b/navit/src/layout.h @@ -17,6 +17,8 @@ struct element { struct element_polyline { int width; int directed; + int dash_num; + unsigned char dash_table[4]; } polyline; struct element_polygon { } polygon; @@ -57,7 +59,8 @@ void itemtype_add_type(struct itemtype *this, enum item_type type); 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); +struct element *polyline_new(struct color *color, int width, int directed, + 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/src/navit.xml b/navit/src/navit.xml index 7037ac6..e4ccff3 100644 --- a/navit/src/navit.xml +++ b/navit/src/navit.xml @@ -129,13 +129,13 @@ Change to your home coordinates. - + - + - + @@ -845,6 +845,9 @@ Change to your home coordinates. + + + @@ -857,6 +860,10 @@ Change to your home coordinates. + + + + diff --git a/navit/src/osm2navit.c b/navit/src/osm2navit.c index e235e14..fd7ec6e 100644 --- a/navit/src/osm2navit.c +++ b/navit/src/osm2navit.c @@ -105,11 +105,13 @@ static char *attrmap={ "n aeroway helipad poi_heliport\n" "n man_made tower poi_tower\n" "n natural bay poi_bay\n" + "n natural peak poi_peak\n" "n place suburb district_label\n" "n place city town_label_2e5\n" "n place town town_label_2e4\n" "n place village town_label_2e3\n" "n place hamlet town_label_2e2\n" + "n railway station poi_rail_station\n" "w amenity place_of_worship poly_building\n" "w building glasshouse poly_building\n" "w building 1 poly_building\n" @@ -155,7 +157,6 @@ static char *attrmap={ "w power line powerline\n" "w railway rail rail\n" "w railway narrow_gauge rail\n" - "w railway station poly_building\n" "w railway subway rail\n" "w railway tram rail\n" "w leisure golf_course poly_golf_course\n" diff --git a/navit/src/xmlconfig.c b/navit/src/xmlconfig.c index 97c6c25..864d730 100644 --- a/navit/src/xmlconfig.c +++ b/navit/src/xmlconfig.c @@ -145,6 +145,20 @@ convert_number(const char *val) } static int +convert_number_list(const char *val, int *table, int size) +{ + char *tok,*str,*val_str,*saveptr=NULL; + int i; + str=val_str=g_strdup(val); + for (i=0; ielement_object = (void *)1; @@ -525,19 +539,22 @@ static int xmlconfig_polyline(struct xmlstate *state) { struct color color; - const char *width, *directed; - int w=0,d=0; + const char *width, *dash, *directed; + int w=0, d=0, dt[4], ds=0; if (! find_color(state, 1, &color)) return 0; width=find_attribute(state, "width", 0); if (width) w=convert_number(width); + dash=find_attribute(state, "dash", 0); + if (dash) + ds=convert_number_list(dash, dt, sizeof(dt)/sizeof(*dt)); directed=find_attribute(state, "directed", 0); if (directed) d=convert_number(directed); - state->element_object=polyline_new(&color, w, d); + state->element_object=polyline_new(&color, w, d, dt, ds); if (! state->element_object) return 0; itemtype_add_element(state->parent->element_object, state->element_object); -- 2.7.4