Add:Core:Added patches from Aurelien Jacobs
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 24 Mar 2008 17:36:50 +0000 (17:36 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 24 Mar 2008 17:36:50 +0000 (17:36 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@957 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/graphics.c
navit/src/item_def.h
navit/src/layout.c
navit/src/layout.h
navit/src/navit.xml
navit/src/osm2navit.c
navit/src/xmlconfig.c

index a4e188d..b83922d 100644 (file)
@@ -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:
index 69f2b58..2eb2832 100644 (file)
@@ -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)
index 3acec7e..4b3d85c 100644 (file)
@@ -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; i<dash_num; i++)
+               e->u.polyline.dash_table[i] = dash_table[i];
 
        return e;
 }
index fcf60d5..8783100 100644 (file)
@@ -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);
index 7037ac6..e4ccff3 100644 (file)
@@ -129,13 +129,13 @@ Change to your home coordinates.
                                <polygon color="#e7cf87" />
                        </item>
                        <item type="rail" order="6-">
-                               <polyline color="#808080" width="3" /> 
+                               <polyline color="#808080" width="3" dash="10" />
                        </item>
                        <item type="ferry" order="5-">
-                               <polyline color="#000000" width="1" /> 
+                               <polyline color="#000000" width="1" dash="10" />
                        </item>
                        <item type="border_country" order="0-">
-                               <polyline color="#b8434e" width="1" /> 
+                               <polyline color="#b8434e" width="1" dash="10,5,2,5" />
                        </item>
                        <item type="border_state" order="0-">
                                <polyline color="#808080" width="1" /> 
@@ -845,6 +845,9 @@ Change to your home coordinates.
                        <item type="poi_oil_field" order="0-">
                                <icon src="oil_field.xpm" />
                        </item>
+                       <item type="poi_peak" order="6-">
+                               <icon src="peak.xpm" />
+                       </item>
                        <item type="poi_personal_service" order="0-">
                                <icon src="personal_service.xpm" />
                        </item>
@@ -857,6 +860,10 @@ Change to your home coordinates.
                        <item type="poi_public_office" order="0-">
                                <icon src="public_office.xpm" />
                        </item>
+                       <item type="poi_rail_station" order="9-">
+                               <circle color="#ff0000" radius="3" width="3" />
+                               <circle color="#000000" radius="6" width="2" label_size="8" />
+                       </item>
                        <item type="poi_repair_service" order="0-">
                                <icon src="repair_service.xpm" />
                        </item>
index e235e14..fd7ec6e 100644 (file)
@@ -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"
index 97c6c25..864d730 100644 (file)
@@ -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; i<size && (tok=strtok_r(str, ",", &saveptr)); i++) {
+               table[i]=convert_number(tok);
+               str=NULL;
+       }
+       g_free(val_str);
+    return i;
+}
+
+static int
 xmlconfig_config(struct xmlstate *state)
 {
        state->element_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);