]> mj.ucw.cz Git - leo.git/commitdiff
Labeller: add_line renamed, add_linelabel/add_arealabel merged
authorKarryanna <karry@karryanna.cz>
Tue, 30 Jun 2015 13:19:57 +0000 (15:19 +0200)
committerKarryanna <karry@karryanna.cz>
Tue, 30 Jun 2015 13:19:57 +0000 (15:19 +0200)
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

labeller.c
labeller.h
sym-line.c
sym-text.c

index 61dd53ecbd5913758d9f1b81ed30a8cac1c37530..016742d9a780084c685fdd01492dcc9a43766295 100644 (file)
@@ -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)
index 8a486318d81c31d114936df49bd4d255dc638d29..34d66850259895ea9d13a6b879fa2b6a09dbdd22 100644 (file)
@@ -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
index f7a617fdd636f12503f54a76b6d5ede34cf679b8..0dd3e1fca0a3774b0fd8e83aa29e0989ba3f0853 100644 (file)
@@ -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));
         }
     }
 }
index 46ecaeeb56a271ea4ee9721c69ff49a7775776de..159f00ebe911a8a0ae5d828bfc92ea7374ddcab4 100644 (file)
@@ -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)