diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-07-26 20:36:27 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-07-26 20:36:27 +0000 |
commit | e745426003e8bcf2e5920038d30b71ac10d27a78 (patch) | |
tree | 40cab9ea7baa6483c5740cad24ef1439c522c734 /navit | |
parent | a51019fa34772c2bd88f0ba320d648e12972b21d (diff) | |
download | navit-e745426003e8bcf2e5920038d30b71ac10d27a78.tar.gz |
Add:Core:Made detail level for layouts configurable
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1231 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/attr_def.h | 3 | ||||
-rw-r--r-- | navit/graphics.c | 8 | ||||
-rw-r--r-- | navit/layout.c | 18 | ||||
-rw-r--r-- | navit/layout.h | 4 | ||||
-rw-r--r-- | navit/navit.c | 14 | ||||
-rw-r--r-- | navit/osm2navit.c | 6 | ||||
-rw-r--r-- | navit/xmlconfig.c | 18 |
7 files changed, 32 insertions, 39 deletions
diff --git a/navit/attr_def.h b/navit/attr_def.h index d7ffaedd5..91c404361 100644 --- a/navit/attr_def.h +++ b/navit/attr_def.h @@ -63,6 +63,7 @@ ATTR(vocabulary_name_systematic) ATTR(vocabulary_distances) ATTR(announce_name_systematic_first) ATTR(antialias) +ATTR(order_delta) ATTR2(0x00028000,type_boolean_begin) /* boolean */ ATTR(overwrite) @@ -130,7 +131,7 @@ ATTR(command) ATTR(src) ATTR(path) ATTR2(0x0003ffff,type_string_end) -ATTR(order_limit) +ATTR(order) ATTR2(0x00050000,type_double_start) ATTR(position_height) ATTR(position_speed) diff --git a/navit/graphics.c b/navit/graphics.c index 42c217283..ee7929e55 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -835,12 +835,12 @@ void graphics_displaylist_draw(struct graphics *gra, struct displaylist *display p.x=0; p.y=0; // FIXME find a better place to set the background color - graphics_gc_set_background(gra->gc[0], l->color); - graphics_gc_set_foreground(gra->gc[0], l->color); + graphics_gc_set_background(gra->gc[0], &l->color); + graphics_gc_set_foreground(gra->gc[0], &l->color); gra->meth.background_gc(gra->priv, gra->gc[0]->priv); gra->meth.draw_mode(gra->priv, draw_mode_begin); gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &p, 32767, 32767); - xdisplay_draw(displaylist->dl, gra, l, order); + xdisplay_draw(displaylist->dl, gra, l, order+l->order_delta); if (callback) callback_list_call_attr_0(gra->cbl, attr_postdraw); gra->meth.draw_mode(gra->priv, draw_mode_end); @@ -892,6 +892,8 @@ void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList } #endif profile(0,NULL); + dbg(0,"delta=%d\n", l->order_delta); + order+=l->order_delta; do_draw(displaylist, trans, mapsets, order); // profile(1,"do_draw"); graphics_displaylist_draw(gra, displaylist, trans, l, 1); diff --git a/navit/layout.c b/navit/layout.c index 8e2cb0e58..653d2b512 100644 --- a/navit/layout.c +++ b/navit/layout.c @@ -19,16 +19,26 @@ #include <glib.h> #include <string.h> +#include "item.h" #include "layout.h" -struct layout * layout_new(const char *name, struct color *color) +struct layout * layout_new(struct attr *parent, struct attr **attrs) { struct layout *l; + struct color def_color = {0xffff, 0xefef, 0xb7b7, 0xffff}; + struct attr *name_attr,*color_attr,*order_delta_attr; + + if (! (name_attr=attr_search(attrs, NULL, attr_name))) + return NULL; l = g_new0(struct layout, 1); - l->name = g_strdup(name); - l->color = g_new0(struct color,1); - *(l->color) = *color; + l->name = g_strdup(name_attr->u.str); + if ((color_attr=attr_search(attrs, NULL, attr_color))) + l->color = *color_attr->u.color; + else + l->color = def_color; + if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta))) + l->order_delta=order_delta_attr->u.num; return l; } diff --git a/navit/layout.h b/navit/layout.h index 401e6fa51..5d9705233 100644 --- a/navit/layout.h +++ b/navit/layout.h @@ -62,7 +62,7 @@ struct color; struct layer { char *name; int details; GList *itemtypes; }; -struct layout { char *name; struct color *color; GList *layers; }; +struct layout { char *name; struct color color; GList *layers; int order_delta; }; /* prototypes */ enum item_type; @@ -70,7 +70,7 @@ struct element; struct itemtype; struct layer; struct layout; -struct layout *layout_new(const char *name, struct color *color); +struct layout *layout_new(struct attr *parent, struct attr **attrs); struct layer *layer_new(const char *name, int details); void layout_add_layer(struct layout *layout, struct layer *layer); struct itemtype *itemtype_new(int order_min, int order_max); diff --git a/navit/navit.c b/navit/navit.c index beb7baf67..6af9f4c19 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -161,15 +161,6 @@ navit_get_tracking(struct navit *this_) } void -navit_add_layout(struct navit *this_, struct layout *lay) -{ - this_->layouts = g_list_append(this_->layouts, lay); - if(!this_->layout_current) { - this_->layout_current=lay; - } -} - -void navit_draw(struct navit *this_) { GList *l; @@ -1434,6 +1425,11 @@ navit_add_attr(struct navit *this_, struct attr *attr) return navit_set_gui(this_, attr->u.gui); case attr_graphics: return navit_set_graphics(this_, attr->u.graphics); + case attr_layout: + this_->layouts = g_list_append(this_->layouts, attr->u.layout); + if(!this_->layout_current) + this_->layout_current=attr->u.layout; + return 1; case attr_route: this_->route=attr->u.route; route_set_projection(this_->route, transform_get_projection(this_->trans)); diff --git a/navit/osm2navit.c b/navit/osm2navit.c index b49664fda..d6db7fb23 100644 --- a/navit/osm2navit.c +++ b/navit/osm2navit.c @@ -1808,7 +1808,7 @@ phase34_process_file(int phase, FILE *in) struct index_item { struct item_bin item; struct rect r; - struct attr_bin attr_order_limit; + struct attr_bin attr_order; short min; short max; struct attr_bin attr_zipfile_ref; @@ -1836,8 +1836,8 @@ index_submap_add(int phase, struct tile_head *th, GList **tiles_list) ii.item.type=type_submap; ii.item.clen=4; - ii.attr_order_limit.len=2; - ii.attr_order_limit.type=attr_order_limit; + ii.attr_order.len=2; + ii.attr_order.type=attr_order; ii.attr_zipfile_ref.len=2; ii.attr_zipfile_ref.type=attr_zipfile_ref; diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c index 84756b2da..c8da7f1da 100644 --- a/navit/xmlconfig.c +++ b/navit/xmlconfig.c @@ -463,22 +463,6 @@ xmlconfig_map(struct xmlstate *state) } static int -xmlconfig_layout(struct xmlstate *state) -{ - const char *name=find_attribute(state, "name", 1); - struct color color = {0xffff, 0xefef, 0xb7b7, 0xffff}; - - if (! name) - return 0; - find_color(state, 0, &color); - state->element_attr.u.data = layout_new(name, &color); - if (! state->element_attr.u.data) - return 0; - navit_add_layout(state->parent->element_attr.u.data, state->element_attr.u.data); - return 1; -} - -static int xmlconfig_layer(struct xmlstate *state) { const char *name=find_attribute(state, "name", 1); @@ -648,7 +632,7 @@ struct element_func { { "navit", "config", NULL, NEW(navit_new), ADD(navit_add_attr), INIT(navit_init), DESTROY(navit_destroy)}, { "graphics", "navit", NULL, NEW(graphics_new), NULL, NULL, NULL}, { "gui", "navit", NULL, NEW(gui_new), NULL, NULL, NULL}, - { "layout", "navit", xmlconfig_layout}, + { "layout", "navit", NULL, NEW(layout_new), NULL, NULL, NULL}, { "layer", "layout", xmlconfig_layer}, { "item", "layer", xmlconfig_item}, { "circle", "item", xmlconfig_circle}, |