maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] ocitymap patch - grid label overlap


From: Florian Lohoff
Subject: [Maposmatic-dev] ocitymap patch - grid label overlap
Date: Mon, 23 Sep 2013 18:37:29 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,
what do you think of this modification? IMHO its ugly that grid
labels overlap in the grid corners.
 

commit 6dc059a058af5f9dd1b5411100072aadaacdf7bb
Author: Florian Lohoff <address@hidden>
Date:   Mon Sep 23 16:33:33 2013 +0000

    Never print 2 labels in the grid corner
    
    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..e74fd47 100644
--- a/ocitysmap/layoutlib/abstract_renderer.py
+++ b/ocitysmap/layoutlib/abstract_renderer.py
@@ -196,11 +196,14 @@ 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)
+           if (i < map_grid.horiz_count-1):
+               draw_utils.draw_simpletext_center(ctx, label,
+                           x, grid_legend_margin_dots/2.0)
+
+            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 +215,12 @@ class Renderer:
             else:
                 continue
 
-            draw_utils.draw_simpletext_center(ctx, 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,
+
+            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

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]