From: Karryanna Date: Tue, 30 Jun 2015 13:19:57 +0000 (+0200) Subject: Labeller: add_line renamed, add_linelabel/add_arealabel merged X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=79c8febcdbbab16099fe8b8beac05b12921fe4ec;p=leo.git Labeller: add_line renamed, add_linelabel/add_arealabel merged labeller_add_line renamed to labeller_notify_line + it no loger plans the line labeller_add_linelabel and labeller_add_arealabel are now both called as labeller_add_label --- diff --git a/labeller.c b/labeller.c index 61dd53e..016742d 100644 --- a/labeller.c +++ b/labeller.c @@ -146,6 +146,9 @@ double individual_distances(struct individual *individual); double get_omittment(struct placement *p); double individual_omittment(struct individual *individual); +void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); +void labeller_add_arealabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); + struct individual **perform_crossover(struct individual *parent1, struct individual *parent2); void perform_mutation(struct individual *individual); void init_placement(struct placement *p, struct individual *individual, struct request *r); @@ -391,13 +394,27 @@ void labeller_add_point(struct symbol *sym, struct osm_object *object, z_index_t DEBUG(dbg_requests, VERBOSITY_PLACEMENT, "Inited point to [%.2f; %.2f] on %u\n", r->x, r->y, r->zindex); } -void labeller_add_line(struct symbol *sym, z_index_t zindex) +void labeller_notify_line(struct symbol *sym, z_index_t zindex) { DEBUG(dbg_requests, VERBOSITY_PLACEMENT, "Adding line on %u\n", zindex); struct buffer_line *b = GARY_PUSH(buffer_line); b->line = (struct sym_line *) sym; b->zindex = zindex; - sym_plan(sym, zindex); +} + +void labeller_add_label(struct symbol *sym, struct osm_object *o, z_index_t zindex) +{ + switch (o->type) + { + case OSM_TYPE_WAY: + if (osm_way_cyclic_p((struct osm_way *) o)) + labeller_add_arealabel(sym, o, zindex); + else + labeller_add_linelabel(sym, o, zindex); + break; + default: + ; + } } void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex) diff --git a/labeller.h b/labeller.h index 8a48631..34d6685 100644 --- a/labeller.h +++ b/labeller.h @@ -192,9 +192,8 @@ void labeller_init(void); void labeller_cleanup(void); void labeller_add_point(struct symbol *sym, struct osm_object *object, z_index_t zindex); -void labeller_add_line(struct symbol *sym, z_index_t zindex); +void labeller_notify_line(struct symbol *sym, z_index_t zindex); void labeller_label(void); -void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); -void labeller_add_arealabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); +void labeller_add_label(struct symbol *sym, struct osm_object *o, z_index_t zindex); #endif diff --git a/sym-line.c b/sym-line.c index f7a617f..0dd3e1f 100644 --- a/sym-line.c +++ b/sym-line.c @@ -183,10 +183,9 @@ static void sym_line_gen(struct osm_object *o, struct style_info *si, struct svg if (o->type == OSM_TYPE_WAY) { - if (casing) - sym_plan(&sl->s, sym_zindex(o, si, 2)); - else - labeller_add_line(&sl->s, sym_zindex(o, si, casing ? 2 : 3)); + if (!casing) + labeller_notify_line(&sl->s, sym_zindex(o, si, casing ? 2 : 3)); + sym_plan(&sl->s, sym_zindex(o, si, casing ? 2 : 3)); } } } diff --git a/sym-text.c b/sym-text.c index 46ecaee..159f00e 100644 --- a/sym-text.c +++ b/sym-text.c @@ -461,14 +461,7 @@ static void sym_text_center(struct osm_object *o, struct style_info *si, osm_val st->x -= st->tw / 2; st->y += st->th - (st->th + st->td) / 2; text_fix_placement(st); - if (o->type == OSM_TYPE_WAY && !osm_way_cyclic_p((struct osm_way *) o)) - { - labeller_add_linelabel(&st->s, o, sym_zindex(o, si, 4.9)); - } - else - { - labeller_add_arealabel(&st->s, o, sym_zindex(o, si, 4.9)); - } + labeller_add_label(&st->s, o, sym_zindex(o, si, 4.9)); } static void sym_text_way(struct osm_object *o, struct style_info *si, osm_val_t text)