+ longlines[num_longlines].first = node->edges[i];
+ printf("Running new BFS\n");
+ printf("Creating longline %u\n", num_longlines);
+ GARY_RESIZE(bfs_queue, 0);
+ struct graph_edge **e = GARY_PUSH(bfs_queue);
+ *e = node->edges[i];
+ node->edges[i]->longline = num_longlines;
+ ya_bfs(node->edges[i]->longline);
+ //dump_longlines();
+ printf("Joined %d edges\n", dbg_num_hits); dbg_num_hits = 0;
+ printf("Planned %u edges\n", GARY_SIZE(bfs_queue));
+ num_longlines++;
+ }
+ }
+ }
+ HASH_END_FOR;
+
+ GARY_FREE(bfs_queue);
+}
+
+/***
+* void oldbfs(void)
+* {
+* printf("Starting outer BFS\n");
+* printf("There are %u buffered lines and %d eges\n", GARY_SIZE(buffer_line), num_edges_dbg);
+*
+* GARY_INIT(bfs_queue, 0);
+* GARY_INIT(longlines, 0);
+*
+* int dbg_bfs_continues = 0;
+*
+* HASH_FOR_ALL(hash, node)
+* {
+* // FIXME: Skip if visited node
+*
+* for (uns i=0; i<GARY_SIZE(node->edges); i++)
+* {
+* struct graph_edge *e = node->edges[i];
+*
+* if (e->visited) continue;
+*
+* // BFS itself
+* for (uns i1=0; i1<GARY_SIZE(e->n1->edges); i1++)
+* {
+* struct graph_edge *other = e->n1->edges[i1];
+* if (other->visited) { dbg_bfs_continues++; continue; }
+*
+* if (((other->n1->id == e->n1->id) || (other->n2->id == e->n1->id)) &&
+* (e->text) && (other->text) && (e->text->text == other->text->text))
+* {
+* // printf("Hit\n");
+* other->visited = 1;
+* }
+* }
+* for (uns i2=0; i2<GARY_SIZE(e->n2->edges); i2++)
+* {
+* struct graph_edge *other = e->n2->edges[i2];
+* if (other->visited) {dbg_bfs_continues++; continue; }
+*
+* if (((other->n1->id == e->n2->id) || (other->n2->id == e->n2->id)) &&
+* (e->text) && (other->text) && (e->text->text == other->text->text))
+* {
+* // printf("Hit\n");
+* other->visited = 1;
+* }
+* }
+* }
+* }
+*
+* HASH_END_FOR;
+* printf("Total: %d hits, %d visited edges skipped\n", dbg_num_hits, dbg_bfs_continues);
+*
+* GARY_FREE(bfs_queue);
+* }
+* ***/
+
+void dump_longlines(void)
+{
+printf("*** Longlines dump\n");
+ for (uns i=0; i<GARY_SIZE(longlines); i++)
+ {
+printf("Longline %u:", i);
+ struct graph_edge *e = longlines[i].first;
+if ((e->label) && (e->label->type == SYMBOLIZER_TEXT))
+ printf(" labelled %s", osm_val_decode(((struct sym_text *) e->label)->text));
+printf("\n");
+
+ while (e)
+ {
+ printf("\t#%ju (%d): [%.2f; %.2f] -- [%.2f; %.2f] (dir %d)\n",
+ e->id, e->num, e->n1->o->x, e->n1->o->y, e->n2->o->x, e->n2->o->y, e->dir);
+
+ e = e->next;
+ }
+ }
+}
+
+void dump_longlines_old(void)
+{
+ for (uns i=0; i<GARY_SIZE(longlines); i++)
+ {
+ struct graph_edge *e = longlines[i].first;
+
+ printf("> Longline %u;", i);
+ if (longlines[i].first->label && longlines[i].first->label->type == SYMBOLIZER_TEXT) printf(" labelled %s", osm_val_decode(((struct sym_text *) longlines[i].first->label)->text));
+ printf("\n");
+ while (e)
+ {
+ printf("\t#%ju (%d)", e->id, e->num);
+ switch (e->dir)
+ {
+ case DIR_BWD:
+ printf("[%.2f; %.2f] -- #%ju [%.2f; %.2f] (dir %d)\n", e->anode->o->x, e->anode->o->y, e->bnode->o->o.id, e->bnode->o->x, e->bnode->o->y, e->dir);
+ break;
+ case DIR_FWD:
+ printf("[%.2f; %.2f] -- #%ju [%.2f; %.2f] (dir %d)\n", e->bnode->o->x, e->bnode->o->y, e->anode->o->o.id, e->anode->o->x, e->anode->o->y, e->dir);
+ break;
+ case DIR_CENTER:
+ printf("[%.2f; %.2f] -- #%ju [%.2f; %.2f] (dir %d)\n", e->n1->o->x, e->n1->o->y, e->n2->o->o.id, e->n2->o->x, e->n2->o->y, e->dir);
+ break;
+ default:
+ printf("%d\n", e->dir);
+ ASSERT(0);