int dbg_segments = 0;
int dbg_plan = 0;
+int dbg_requests = 0;
+int dbg_graph = 0;
+int dbg_bfs = 0;
+int dbg_map_parts = 0;
+int dbg_movement = 0;
int page_width_int;
int page_height_int;
void labeller_add_line(struct symbol *sym, z_index_t zindex)
{
-printf("Adding line on %u\n", zindex);
+ if (dbg_requests)
+ printf("Adding line on %u\n", zindex);
struct buffer_line *b = GARY_PUSH(buffer_line);
b->line = (struct sym_line *) sym;
b->zindex = zindex;
void label_graph(void)
{
-printf("There are %u line labels requested\n", GARY_SIZE(buffer_linelabel));
+ if (dbg_graph)
+ printf("There are %u line labels requested\n", GARY_SIZE(buffer_linelabel));
for (uns i=0; i<GARY_SIZE(buffer_linelabel); i++)
{
if (buffer_linelabel[i].label->type == SYMBOLIZER_TEXT)
- printf("Labelling nodes of way %s\n", osm_val_decode(((struct sym_text *) buffer_linelabel[i].label)->text));
+ if (dbg_graph)
+ printf("Labelling nodes of way %s\n", osm_val_decode(((struct sym_text *) buffer_linelabel[i].label)->text));
CLIST_FOR_EACH(struct osm_ref *, ref, buffer_linelabel[i].way->nodes)
{
- printf("Looking for node %ju\n", ref->o->id);
+ if (dbg_graph)
+ printf("Looking for node %ju\n", ref->o->id);
struct graph_node *n = hash_find(ref->o->id);
if (n == NULL)
{
}
else
{
- printf("Searching among %u edges\n", GARY_SIZE(n->edges));
+ if (dbg_graph)
+ printf("Searching among %u edges\n", GARY_SIZE(n->edges));
for (uns j=0; j<GARY_SIZE(n->edges); j++)
{
if (n->edges[j]->id == buffer_linelabel[i].way->o.id)
{
- printf("Labelling node %ju\n", n->id);
+ if (dbg_graph)
+ printf("Labelling node %ju\n", n->id);
n->edges[j]->label = buffer_linelabel[i].label;
n->edges[j]->zindex = buffer_linelabel[i].zindex;
}
void bfs_edge(struct graph_edge *e, struct graph_node *node, struct graph_node *anode, enum edge_dir dir)
{
-printf("BFS edge called for edge %d (going %d) in direction %d\n", e->num, e->dir, dir);
+ if (dbg_bfs)
+ printf("BFS edge called for edge %d (going %d) in direction %d\n", e->num, e->dir, dir);
struct graph_edge *candidate = NULL;
for (uns i=0; i<GARY_SIZE(node->edges); i++)
{
struct graph_edge *other = node->edges[i];
-if (e->num == 987) printf("Got label %d\n", e->num);
if ((other->longline != (uns) -1) && (other->longline != e->longline)) continue;
-if (e->num == 987) printf("Continuing with edge %d\n", e->num);
-printf("Testing %d ?= %d\n", other->visited, e->longline);
if ((uns) other->visited != e->longline) {
- printf("Pushing new edge %d / %ju\n", other->num, other->id);
+ if (dbg_bfs)
+ printf("Pushing new edge %d / %ju\n", other->num, other->id);
struct graph_edge **e_ptr = GARY_PUSH(bfs_queue);
*e_ptr = other;
other->visited = e->longline;
if (candidate)
{
-printf("New line in longline %u\n", e->longline);
+ if (dbg_bfs)
+ printf("New line in longline %u\n", e->longline);
struct graph_edge *other = candidate;
other->longline = e->longline;
other->dir = dir;
void bfs(uns longline)
{
-printf("BFS called for longline %u\n", longline);
-printf("%d longlines are believed to exist, %d exist\n", num_longlines, GARY_SIZE(longlines));
+if (dbg_bfs)
+ printf("BFS called for longline %u\n", longline);
+if (dbg_bfs)
+ printf("%d longlines are believed to exist, %d exist\n", num_longlines, GARY_SIZE(longlines));
for (uns i=0; i<GARY_SIZE(bfs_queue); i++)
{
struct graph_edge *cur = bfs_queue[i];
- printf("Exploring new edge %d; %d remaining\n", cur->num, GARY_SIZE(bfs_queue));
+ if (dbg_bfs)
+ printf("Exploring new edge %d; %d remaining\n", cur->num, GARY_SIZE(bfs_queue));
//ASSERT(! cur->visited);
cur->visited = longline;
{
GARY_PUSH(longlines);
longlines[num_longlines].first = node->edges[i];
- printf("Running new BFS\n");
- printf("Creating longline %u\n", num_longlines);
+ if (dbg_bfs)
+ printf("Running new BFS\n");
+ if (dbg_bfs)
+ 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;
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));
+ if (dbg_bfs)
+ printf("Joined %d edges\n", dbg_num_hits); dbg_num_hits = 0;
+ if (dbg_bfs)
+ printf("Planned %u edges\n", GARY_SIZE(bfs_queue));
num_longlines++;
}
}
}
else
{
- printf("Warning: Skipping line\n");
+ if (dbg_segments)
+ printf("Warning: Skipping line\n");
continue;
// FIXME;
}
- printf("New longline\n");
+ if (dbg_segments)
+ printf("New longline\n");
while (e)
{
if (e->visited < 0)
{
make_graph();
label_graph();
-//dump_graph();
bfs_wrapper();
-//dump_longlines();
make_segments();
-dump_linelabel_requests();
printf("Having %u point requests, %u line requests and %u area requests\n", GARY_SIZE(requests_point), GARY_SIZE(requests_line), GARY_SIZE(requests_area));
}
*/
- dump_individual(population1[0]);
-//dump_bitmaps(population1[0]);
-
plan_individual(population1[0]);
labeller_cleanup();
hide_segment_labels(individual);
-if (p != num_requests)
-{
- printf("Say bye\n");
- exit(42);
-}
-
-printf("Testing p\n");
ASSERT(p == num_requests);
}
}
gen_coords_segment(p);
break;
case REQUEST_LINE:
- printf("Not yet implemented\n");
+ if (dbg_movement)
+ printf("Not yet implemented\n");
break;
default:
- printf("Testing request type\n");
+ if (dbg_movement)
+ printf("Testing request type\n");
ASSERT(p->request->type != REQUEST_INVALID);
}
{
double m = (random() % 1000000) / 10000;
m = pow(m, 1.0/3) * flip(1, -1);
- printf("Movement %.2f\n", m);
+ if (dbg_movement)
+ printf("Movement %.2f\n", m);
return m;
}
case REQUEST_LINE:
case REQUEST_SEGMENT:
case REQUEST_AREA:
- printf("Not yet implemented\n");
+ if (dbg_movement)
+ printf("Not yet implemented\n");
default:
ASSERT(p->request->type != REQUEST_INVALID);
}