[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 2/5] multi-page: fix grey shape around the overv
From: |
Étienne Loks |
Subject: |
[Maposmatic-dev] [PATCH 2/5] multi-page: fix grey shape around the overview map |
Date: |
Fri, 30 Mar 2012 18:51:18 +0200 |
---
ocitysmap2/layoutlib/multi_page_renderer.py | 32 +++++++++++++-------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py
b/ocitysmap2/layoutlib/multi_page_renderer.py
index 288f956..884fdff 100644
--- a/ocitysmap2/layoutlib/multi_page_renderer.py
+++ b/ocitysmap2/layoutlib/multi_page_renderer.py
@@ -188,23 +188,10 @@ class MultiPageRenderer(Renderer):
# print bb.as_javascript(name="p%d" % i)
self.pages = []
- # Create an overview map
-
- # Create the gray shape around the map
- first_bbox, last_bbox = bboxes[0][0], bboxes[-1][0]
- overview_coord = list(first_bbox.get_top_left()) + \
- list(last_bbox.get_bottom_right())
- overview_bb = coords.BoundingBox(*overview_coord
- ).create_expanded(0.001, 0.001)
- exterior = shapely.wkt.loads(overview_bb.as_wkt())
- interior = shapely.wkt.loads(self.rc.polygon_wkt)
- shade_wkt = exterior.difference(interior).wkt
- shade = maplib.shapes.PolyShapeFile(self.rc.bounding_box,
- os.path.join(self.tmpdir, 'shape_overview.shp'),
- 'shade-overview')
- shade.add_shade_from_wkt(shade_wkt)
+ # Create an overview map
+ overview_bb = self._geo_bbox.create_expanded(0.001, 0.001)
# Create the grid
map_grid = OverviewGrid(overview_bb,
[bb for bb, bb_inner in bboxes], self.rc.i18n.isrtl())
@@ -214,7 +201,20 @@ class MultiPageRenderer(Renderer):
# Create one canvas for the current page
map_canvas = MapCanvas(self.rc.stylesheet,
- overview_bb, graphical_ratio=None)
+ overview_bb, self._usable_area_width_pt,
+ self._usable_area_height_pt, dpi,
+ extend_bbox_to_ratio=True)
+
+ # Create the gray shape around the map
+ exterior = shapely.wkt.loads(map_canvas.get_actual_bounding_box()\
+ .as_wkt())
+ interior = shapely.wkt.loads(self.rc.polygon_wkt)
+ shade_wkt = exterior.difference(interior).wkt
+ shade = maplib.shapes.PolyShapeFile(self.rc.bounding_box,
+ os.path.join(self.tmpdir, 'shape_overview.shp'),
+ 'shade-overview')
+ shade.add_shade_from_wkt(shade_wkt)
+
map_canvas.add_shape_file(shade)
map_canvas.add_shape_file(grid_shape,
--
1.7.9.1