diff --git a/generate_map.py b/generate_map.py index f9ca02f..c640918 100755 --- a/generate_map.py +++ b/generate_map.py @@ -390,8 +390,7 @@ class BoundingBox: swm = self.with_margin(pdist) swe = self.with_margin(ns.dotsize_erfa) swc = self.with_margin(ns.dotsize_treff) - swme = swm.with_margin(ns.dotsize_erfa) - swmc = swm.with_margin(ns.dotsize_treff) + maxs = [] # I hope these weights are somewhat reasonably balanced... # Basically the weights correspond to geometrical distances, # except for an actual collision, which gets a huge extra weight. @@ -406,13 +405,7 @@ class BoundingBox: w += 50 self._optimal = False else: - w += max(pdist*2 - swm.chebyshev_distance(o), 0) - continue - if o in swm: - if o.finished: - w += 3 - else: - w += 1 + maxs.append(max(pdist*2 - swm.chebyshev_distance(o), 0)) for city, location in erfas.items(): if city == self.meta['city']: continue @@ -420,7 +413,7 @@ class BoundingBox: w += 1000 self._optimal = False else: - w += max(pdist*2 - swe.chebyshev_distance(location), 0) + maxs.append(max(pdist*2 - swe.chebyshev_distance(o), 0)) for city, location in chaostreffs.items(): if city == self.meta['city']: continue @@ -428,7 +421,9 @@ class BoundingBox: w += 1000 self._optimal = False else: - w += max(pdist*2 - swc.chebyshev_distance(location), 0) + maxs.append(max(pdist*2 - swc.chebyshev_distance(location), 0)) + if len(maxs) > 0: + w += max(maxs) self._weight = w @property @@ -490,8 +485,8 @@ def optimize_text_layout(ns, erfas, chaostreffs, size, svg): BoundingBox(erfax - mw/2, erfay + dist, width=mw, height=mh, meta=meta, base_weight=bw + 0.001), BoundingBox(erfax - ns.dotsize_erfa, erfay - dist - mh, width=mw, height=mh, meta=meta, base_weight=bw + 0.002), BoundingBox(erfax - ns.dotsize_erfa, erfay + dist, width=mw, height=mh, meta=meta, base_weight=bw + 0.003), - BoundingBox(erfax + ns.dotsize_erfa - mw, erfay - dist - mh, width=mw, height=mh, meta=meta, base_weight=bw + 0.001), - BoundingBox(erfax + ns.dotsize_erfa - mw, erfay + dist, width=mw, height=mh, meta=meta, base_weight=bw + 0.001), + BoundingBox(erfax + ns.dotsize_erfa - mw, erfay - dist - mh, width=mw, height=mh, meta=meta, base_weight=bw + 0.002), + BoundingBox(erfax + ns.dotsize_erfa - mw, erfay + dist, width=mw, height=mh, meta=meta, base_weight=bw + 0.003), ]) # If debugging is enabled, render one rectangle around each label's bounding box, and one rectangle around each label's median box diff --git a/map.readme.png b/map.readme.png index c947146..af18c1c 100644 Binary files a/map.readme.png and b/map.readme.png differ