diff options
Diffstat (limited to 'navit/layout.c')
| -rw-r--r-- | navit/layout.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/navit/layout.c b/navit/layout.c index 0889fb52b..2300ab68d 100644 --- a/navit/layout.c +++ b/navit/layout.c @@ -399,6 +399,7 @@ int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) { case attr_icon: case attr_image: case attr_arrows: + case attr_spikes: itemgra->elements = g_list_append(itemgra->elements, attr->u.element); return 1; default: @@ -446,6 +447,27 @@ static void element_set_arrows_width(struct element *e, struct attr **attrs) { e->u.arrows.width=10; } +static void element_set_spikes_width(struct element *e, struct attr **attrs) { + struct attr *width; + width=attr_search(attrs, attr_width); + if (width) + e->u.spikes.width=width->u.num; + else + e->u.spikes.width=10; +} + +static void element_set_spikes_distance(struct element *e, struct attr **attrs) { + struct attr *distance; + distance=attr_search(attrs, attr_distance); + if (distance) { + e->u.spikes.distance=distance->u.num; + /* paranoia check. We divide with that value */ + if(e->u.spikes.distance < 1) + e->u.spikes.distance = 1; + } else + e->u.spikes.distance=10; +} + static void element_set_polyline_width(struct element *e, struct attr **attrs) { struct attr *width; width=attr_search(attrs, attr_width); @@ -651,6 +673,17 @@ arrows_new(struct attr *parent, struct attr **attrs) { return (struct arrows *)e; } +struct spikes * +spikes_new(struct attr *parent, struct attr **attrs) { + struct element *e; + e = g_malloc0(sizeof(*e)); + e->type=element_spikes; + element_set_color(e, attrs); + element_set_spikes_width(e, attrs); + element_set_spikes_distance(e, attrs); + return (struct spikes *)e; +} + int element_add_attr(struct element *e, struct attr *attr) { switch (attr->type) { case attr_coord: |
