[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Maposmatic-dev] ocitymap patch - grid label overlap
From: |
Florian Lohoff |
Subject: |
Re: [Maposmatic-dev] ocitymap patch - grid label overlap |
Date: |
Wed, 2 Oct 2013 10:15:28 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi David,
On Fri, Sep 27, 2013 at 07:55:19AM +0200, David MENTRE wrote:
> Hello Florian,
>
> 2013/9/23 Florian Lohoff <address@hidden>:
> > what do you think of this modification? IMHO its ugly that grid
> > labels overlap in the grid corners.
>
> I agree on the approach. I wanted to check the current layout but
> maposmatic.org is currently down (big issue at the hosting company).
>
> On your patch, maybe you could add some short comments telling what
> are doing your if statements.
>
> Have you checked that your patch works correctly with the different
> kind of layouts?
I havent - But in the end whenever we put the labels in the corner
we want to avoid putting 2 of them in the same corner.
The example in the commit message shows which of them gets eliminated.
> Sorry for the late feedback, but better later than never. ;-)
Same patch - whitespace corrected (i used tabs) and with
a short comment.
commit dcc1351a26b0a385fa3c5ba8fb30c5d8ccef9317
Author: Florian Lohoff <address@hidden>
Date: Wed Oct 2 08:08:42 2013 +0000
Clear the corners of duplicate labels
The grid corners typically get a vertical and a horizontal
label. These do overlap from a certain scale on.
Avoid by printing only one label:
A B C 1
2 2
3 3
4 B C D
diff --git a/ocitysmap/layoutlib/abstract_renderer.py
b/ocitysmap/layoutlib/abstract_renderer.py
index 86a7483..6458566 100644
--- a/ocitysmap/layoutlib/abstract_renderer.py
+++ b/ocitysmap/layoutlib/abstract_renderer.py
@@ -196,11 +196,16 @@ class Renderer:
else:
continue
- draw_utils.draw_simpletext_center(ctx, label,
- x, grid_legend_margin_dots/2.0)
- draw_utils.draw_simpletext_center(ctx, label,
- x, map_area_height_dots -
- grid_legend_margin_dots/2.0)
+ # At the top clear the right corner of the horizontal label
+ if (i < map_grid.horiz_count-1):
+ draw_utils.draw_simpletext_center(ctx, label,
+ x, grid_legend_margin_dots/2.0)
+
+ # At the bottom clear the left corner of the horizontal label
+ if (i > 0):
+ draw_utils.draw_simpletext_center(ctx, label,
+ x, map_area_height_dots -
+ grid_legend_margin_dots/2.0)
for i, label in enumerate(map_grid.vertical_labels):
y = i * step_vert
@@ -212,9 +217,14 @@ class Renderer:
else:
continue
- draw_utils.draw_simpletext_center(ctx, label,
+ # On the left clear the upper corner of the vertical label
+ if (i > 0):
+ draw_utils.draw_simpletext_center(ctx, label,
grid_legend_margin_dots/2.0, y)
- draw_utils.draw_simpletext_center(ctx, label,
+
+ # On the right clear the bottom corner of the vertical label
+ if (i < map_grid.vert_count -1):
+ draw_utils.draw_simpletext_center(ctx, label,
map_area_width_dots -
grid_legend_margin_dots/2.0, y)
--
Florian Lohoff address@hidden
signature.asc
Description: Digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Maposmatic-dev] ocitymap patch - grid label overlap,
Florian Lohoff <=