maposmatic-dev
[Top][All Lists]
Advanced

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

[Maposmatic-dev] [PATCH 07/22] indexlib: add page_number to IndexItem


From: Thomas Petazzoni
Subject: [Maposmatic-dev] [PATCH 07/22] indexlib: add page_number to IndexItem
Date: Fri, 30 Mar 2012 13:00:24 +0200

The multi-page renderer needs to know on which page each IndexItem has
been found. Therefore, we introduce a new page_number field in the
IndexItem class. This field remains to None for the single page
renderers, and is used to store an integer by the multi-page renderer.

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

diff --git a/ocitysmap2/indexlib/commons.py b/ocitysmap2/indexlib/commons.py
index 6bbc88c..5a762f6 100644
--- a/ocitysmap2/indexlib/commons.py
+++ b/ocitysmap2/indexlib/commons.py
@@ -104,6 +104,7 @@ class IndexItem:
     endpoint1    = None # coords.Point
     endpoint2    = None # coords.Point
     location_str = None # str or None
+    page_number  = None # integer or None. Only used by multi-page renderer.
 
     def __init__(self, label, endpoint1, endpoint2):
         assert label is not None
@@ -111,14 +112,15 @@ class IndexItem:
         self.endpoint1    = endpoint1
         self.endpoint2    = endpoint2
         self.location_str = None
+        self.page_number  = None
 
     def __str__(self):
         return '%s...%s' % (self.label, self.location_str)
 
     def __repr__(self):
-        return ('IndexItem(%s, %s, %s, %s)'
+        return ('IndexItem(%s, %s, %s, %s, %s)'
                 % (repr(self.label), self.endpoint1, self.endpoint2,
-                   repr(self.location_str)))
+                   repr(self.location_str), repr(self.page_number)))
 
     def draw(self, rtl, 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]