From 05a2151cd5ca84a85ea56b4b8546e3fad036fc48 Mon Sep 17 00:00:00 2001 From: Karryanna Date: Tue, 9 Jun 2015 14:16:13 +0200 Subject: [PATCH] Labelling: Placing out of paper is counted as overlap --- labeller.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/labeller.c b/labeller.c index 644fa77..2f5a176 100644 --- a/labeller.c +++ b/labeller.c @@ -1423,6 +1423,8 @@ int overlaps(struct placement *p1, struct placement *p2) int get_overlap(struct placement *p) { + if (p->variant_used == -1) return 0; + struct map_part **parts = get_map_parts(p); if (! parts) { @@ -1466,6 +1468,14 @@ int get_overlap(struct placement *p) if (dbg_overlaps >= VERBOSITY_PLACEMENT) printf("Placement of request %d add %d to overlaps\n", p->request->ind, overlap); + if (p->x < 0) overlap += 0 - p->x; + if (p->x + p->request->variants[p->variant_used].width > page_width_int) + overlap += p->x + p->request->variants[p->variant_used].width - page_width_int; + + if (p->y < 0) overlap += 0 - p->y; + if (p->y + p->request->variants[p->variant_used].height > page_height_int) + overlap += p->y + p->request->variants[p->variant_used].height - page_height_int; + return overlap; } -- 2.39.2