maposmatic-dev
[Top][All Lists]
Advanced

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

[Maposmatic-dev] [PATCH 12/22] indexlib: render page number as part of t


From: Thomas Petazzoni
Subject: [Maposmatic-dev] [PATCH 12/22] indexlib: render page number as part of the street/amenity location
Date: Fri, 30 Mar 2012 13:00:29 +0200

Signed-off-by: Thomas Petazzoni <address@hidden>
---
 ocitysmap2/indexlib/commons.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ocitysmap2/indexlib/commons.py b/ocitysmap2/indexlib/commons.py
index 5a762f6..f327f30 100644
--- a/ocitysmap2/indexlib/commons.py
+++ b/ocitysmap2/indexlib/commons.py
@@ -141,6 +141,16 @@ class IndexItem:
             baseline_y (int): Y axis coordinate of the baseline.
         """
 
+        if not self.location_str:
+            square_str = '???'
+        else:
+            square_str = self.location_str
+
+        if self.page_number:
+            location_str = "%d, %s" % (self.page_number, square_str)
+        else:
+            location_str = square_str
+
         ctx.save()
         if not rtl:
             _, _, line_start = draw_utils.draw_text_left(ctx, pc, layout,
@@ -150,12 +160,12 @@ class IndexItem:
             line_end, _, _ = draw_utils.draw_text_right(ctx, pc, layout,
                                                         fascent, fheight,
                                                         baseline_x, baseline_y,
-                                                        self.location_str or 
'???')
+                                                        location_str)
         else:
             _, _, line_start = draw_utils.draw_text_left(ctx, pc, layout,
                                                          fascent, fheight,
                                                          baseline_x, 
baseline_y,
-                                                         self.location_str or 
'???')
+                                                         location_str)
             line_end, _, _ = draw_utils.draw_text_right(ctx, pc, layout,
                                                         fascent, fheight,
                                                         baseline_x, baseline_y,
-- 
1.7.4.1




reply via email to

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