maposmatic-dev
[Top][All Lists]
Advanced

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

[Maposmatic-dev] [PATCH 22/22] multi-page: minor fixups for compatibili


From: Thomas Petazzoni
Subject: [Maposmatic-dev] [PATCH 22/22] multi-page: minor fixups for compatibility with Gaël's work to remo ve the scaling
Date: Fri, 30 Mar 2012 13:00:39 +0200

Signed-off-by: Thomas Petazzoni <address@hidden>
---
 ocitysmap2/layoutlib/abstract_renderer.py   |    2 +-
 ocitysmap2/layoutlib/multi_page_renderer.py |   14 +++++---------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/ocitysmap2/layoutlib/abstract_renderer.py 
b/ocitysmap2/layoutlib/abstract_renderer.py
index 713bf58..4f7083f 100644
--- a/ocitysmap2/layoutlib/abstract_renderer.py
+++ b/ocitysmap2/layoutlib/abstract_renderer.py
@@ -58,7 +58,7 @@ class Renderer:
     # on the rendered map of a kilometer
     DEFAULT_KM_IN_MM = 100
 
-    def __init__(self, db, rc, tmpdir, street_index):
+    def __init__(self, db, rc, tmpdir, dpi, street_index):
         """
         Create the renderer.
 
diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py 
b/ocitysmap2/layoutlib/multi_page_renderer.py
index df6cef6..7645ed1 100644
--- a/ocitysmap2/layoutlib/multi_page_renderer.py
+++ b/ocitysmap2/layoutlib/multi_page_renderer.py
@@ -65,8 +65,8 @@ class MultiPageRenderer(Renderer):
     description = 'A multi-page layout.'
     multipages = True
 
-    def __init__(self, *args, **kwargs):
-        Renderer.__init__(self, *args, **kwargs)
+    def __init__(self, db, rc, tmpdir, dpi, street_index):
+        Renderer.__init__(self, db, rc, tmpdir, dpi, street_index)
 
         self._grid_legend_margin_pt = \
             min(Renderer.GRID_LEGEND_MARGIN_RATIO * self.paper_width_pt,
@@ -204,7 +204,9 @@ class MultiPageRenderer(Renderer):
 
             # Create one canvas for the current page
             map_canvas = MapCanvas(self.rc.stylesheet,
-                                   bb, graphical_ratio=None)
+                                   bb, self._usable_area_width_pt,
+                                   self._usable_area_height_pt, dpi,
+                                   extend_bbox_to_ratio=False)
 
             map_canvas.add_shape_file(shade)
             map_canvas.add_shape_file(grid_shape,
@@ -317,14 +319,8 @@ class MultiPageRenderer(Renderer):
             
ctx.translate(commons.convert_pt_to_dots(Renderer.PRINT_SAFE_MARGIN_PT),
                           
commons.convert_pt_to_dots(Renderer.PRINT_SAFE_MARGIN_PT))
 
-            ctx.save()
             rendered_map = canvas.get_rendered_map()
-            ctx.scale(commons.convert_pt_to_dots(self._usable_area_width_pt)
-                      / rendered_map.width,
-                      commons.convert_pt_to_dots(self._usable_area_height_pt)
-                      / rendered_map.height)
             mapnik.render(rendered_map, ctx)
-            ctx.restore()
 
             # Render the page number
             ctx.save()
-- 
1.7.4.1




reply via email to

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