void sym_plan(struct symbol *sym, z_index_t zindex)
{
- // DEBUG
- if (sym->type == SYMBOLIZER_TEXT)
- {
- struct sym_text *st = (struct sym_text *) sym;
- printf("In planner: Planning text %s at [%.2f; %.2f]\n", osm_val_decode(st->text), st->x, st->y);
- }
-
struct sym_planned *p = GARY_PUSH(sym_planned);
p->sym = sym;
p->zindex = zindex;
void sym_draw_all(struct svg *svg)
{
- for (uns i = 0; i < GARY_SIZE(sym_planned); i++)
- {
- // DEBUG
- if (sym_planned[i].sym->type == SYMBOLIZER_TEXT)
- {
- struct sym_text *st = (struct sym_text *) sym_planned[i].sym;
- printf("In planner: Will draw text %s at [%.2f; %.2f]\n", osm_val_decode(st->text), st->x, st->y);
- }
- }
-
msg(L_INFO, "Sorting %u symbols by depth", (uns) GARY_SIZE(sym_planned));
sym_sort(sym_planned, GARY_SIZE(sym_planned));
msg(L_INFO, "Drawing symbols");
for (uns i = 0; i < GARY_SIZE(sym_planned); i++)
- {
- // DEBUG
- if (sym_planned[i].sym->type == SYMBOLIZER_TEXT)
- {
- struct sym_text *st = (struct sym_text *) sym_planned[i].sym;
- printf("In planner: Will draw text %s at [%.2f; %.2f]\n", osm_val_decode(st->text), st->x, st->y);
- }
-
sym_draw(sym_planned[i].sym, sym_planned[i].zindex, svg);
- }
+}
+
+struct symbol * sym_copy(struct symbol *sym)
+{
+ ASSERT(sym->type && sym->type < SYMBOLIZER_MAX);
+ if (symbolizers[sym->type]->copy)
+ return symbolizers[sym->type]->copy(sym);
+ else
+ return NULL;
+}
+
+bool sym_look_same(struct symbol *s1, struct symbol *s2)
+{
+ if (s1->type != s2->type)
+ return false;
+
+ ASSERT(s1->type && s1->type < SYMBOLIZER_MAX);
+ if (symbolizers[s1->type]->look_same)
+ return symbolizers[s1->type]->look_same(s1, s2);
+ else
+ return false;
}