From fa81ce86a8d06ca8002008e45f920759cf5e2abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Loks?= Date: Sat, 31 Mar 2012 16:19:53 +0200 Subject: [PATCH] multi-page: add a more suitable style for shade of outside town --- ocitysmap2/__init__.py | 7 +++++++ ocitysmap2/layoutlib/multi_page_renderer.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ocitysmap2/__init__.py b/ocitysmap2/__init__.py index 3e0eb9e..2df4adb 100644 --- a/ocitysmap2/__init__.py +++ b/ocitysmap2/__init__.py @@ -146,6 +146,10 @@ class Stylesheet: self.shade_color = 'black' self.shade_alpha = 0.1 + # shade color for town contour in multi-pages + self.shade_color_2 = 'white' + self.shade_alpha_2 = 0.4 + @staticmethod def create_from_config_section(parser, section_name): """Creates a Stylesheet object from the OCitySMap configuration. @@ -173,6 +177,9 @@ class Stylesheet: assign_if_present('shade_color') assign_if_present('shade_alpha', float) + + assign_if_present('shade_color_2') + assign_if_present('shade_alpha_2', float) return s @staticmethod diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py b/ocitysmap2/layoutlib/multi_page_renderer.py index 5a75de6..fd91526 100644 --- a/ocitysmap2/layoutlib/multi_page_renderer.py +++ b/ocitysmap2/layoutlib/multi_page_renderer.py @@ -241,7 +241,7 @@ class MultiPageRenderer(Renderer): # Area to keep visible interior_contour = shapely.wkt.loads(self.rc.polygon_wkt) # Determine the shade WKT - shade_contour_wkt = exterior.difference(interior_contour).wkt + shade_contour_wkt = interior.difference(interior_contour).wkt # Prepare the shade SHP shade_contour = maplib.shapes.PolyShapeFile(bb, os.path.join(self.tmpdir, 'shade_contour%d.shp' % i), @@ -262,8 +262,8 @@ class MultiPageRenderer(Renderer): map_canvas.add_shape_file(shade) map_canvas.add_shape_file(shade_contour, - self.rc.stylesheet.shade_color, - self.rc.stylesheet.shade_alpha) + self.rc.stylesheet.shade_color_2, + self.rc.stylesheet.shade_alpha_2) map_canvas.add_shape_file(grid_shape, self.rc.stylesheet.grid_line_color, self.rc.stylesheet.grid_line_alpha,