kopia lustrzana https://github.com/hholzgra/ocitysmap
multi-page: add a more suitable style for shade of outside town
rodzic
6ae7855a6c
commit
fa81ce86a8
|
@ -146,6 +146,10 @@ class Stylesheet:
|
||||||
self.shade_color = 'black'
|
self.shade_color = 'black'
|
||||||
self.shade_alpha = 0.1
|
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
|
@staticmethod
|
||||||
def create_from_config_section(parser, section_name):
|
def create_from_config_section(parser, section_name):
|
||||||
"""Creates a Stylesheet object from the OCitySMap configuration.
|
"""Creates a Stylesheet object from the OCitySMap configuration.
|
||||||
|
@ -173,6 +177,9 @@ class Stylesheet:
|
||||||
|
|
||||||
assign_if_present('shade_color')
|
assign_if_present('shade_color')
|
||||||
assign_if_present('shade_alpha', float)
|
assign_if_present('shade_alpha', float)
|
||||||
|
|
||||||
|
assign_if_present('shade_color_2')
|
||||||
|
assign_if_present('shade_alpha_2', float)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -241,7 +241,7 @@ class MultiPageRenderer(Renderer):
|
||||||
# Area to keep visible
|
# Area to keep visible
|
||||||
interior_contour = shapely.wkt.loads(self.rc.polygon_wkt)
|
interior_contour = shapely.wkt.loads(self.rc.polygon_wkt)
|
||||||
# Determine the shade 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
|
# Prepare the shade SHP
|
||||||
shade_contour = maplib.shapes.PolyShapeFile(bb,
|
shade_contour = maplib.shapes.PolyShapeFile(bb,
|
||||||
os.path.join(self.tmpdir, 'shade_contour%d.shp' % i),
|
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)
|
||||||
map_canvas.add_shape_file(shade_contour,
|
map_canvas.add_shape_file(shade_contour,
|
||||||
self.rc.stylesheet.shade_color,
|
self.rc.stylesheet.shade_color_2,
|
||||||
self.rc.stylesheet.shade_alpha)
|
self.rc.stylesheet.shade_alpha_2)
|
||||||
map_canvas.add_shape_file(grid_shape,
|
map_canvas.add_shape_file(grid_shape,
|
||||||
self.rc.stylesheet.grid_line_color,
|
self.rc.stylesheet.grid_line_color,
|
||||||
self.rc.stylesheet.grid_line_alpha,
|
self.rc.stylesheet.grid_line_alpha,
|
||||||
|
|
Ładowanie…
Reference in New Issue