kopia lustrzana https://github.com/hholzgra/ocitysmap
multi-page overview: correct page number position
rodzic
757ee41530
commit
7da6b70ab2
|
|
@ -43,8 +43,6 @@ import logging
|
|||
|
||||
LOG = logging.getLogger('ocitysmap')
|
||||
|
||||
OVERVIEW_PAGE_STR = "Page %(page_number)d"
|
||||
|
||||
class Renderer:
|
||||
"""
|
||||
The job of an OCitySMap layout renderer is to lay out the resulting map and
|
||||
|
|
@ -232,8 +230,7 @@ class Renderer:
|
|||
drawing area (cairo units).
|
||||
"""
|
||||
ctx.save()
|
||||
|
||||
ctx.set_font_size(18)
|
||||
ctx.set_font_size(14)
|
||||
|
||||
bbox = map_canvas.get_actual_bounding_box()
|
||||
bottom_right, bottom_left, top_left, top_right = bbox.to_mercator()
|
||||
|
|
@ -250,8 +247,7 @@ class Renderer:
|
|||
|
||||
x_percent = 100.0*(center_x - left)/coord_delta_x
|
||||
x = int(area_width_dots*x_percent/100)
|
||||
Renderer._draw_centered_text(ctx,
|
||||
OVERVIEW_PAGE_STR % {'page_number':idx+2}, x, y)
|
||||
Renderer._draw_centered_text(ctx, unicode(idx + 3), x, y)
|
||||
ctx.restore()
|
||||
|
||||
def _create_map_canvas(self, width, height, dpi,
|
||||
|
|
|
|||
|
|
@ -545,19 +545,17 @@ class MultiPageRenderer(Renderer):
|
|||
Renderer._draw_centered_text(ctx, str(i + 1), 0, 0)
|
||||
ctx.restore()
|
||||
|
||||
ctx.save()
|
||||
ctx.translate(commons.convert_pt_to_dots(self.grayed_margin_pt),
|
||||
commons.convert_pt_to_dots(self.grayed_margin_pt))
|
||||
|
||||
if overview_grid:
|
||||
# draw pages numbers
|
||||
self._draw_overview_labels(ctx, canvas, overview_grid,
|
||||
commons.convert_pt_to_dots(self._usable_area_width_pt) \
|
||||
- 2 * commons.convert_pt_to_dots(self.grayed_margin_pt),
|
||||
commons.convert_pt_to_dots(self._usable_area_height_pt) \
|
||||
- 2 * commons.convert_pt_to_dots(self.grayed_margin_pt))
|
||||
commons.convert_pt_to_dots(self._usable_area_width_pt),
|
||||
commons.convert_pt_to_dots(self._usable_area_height_pt))
|
||||
if grid:
|
||||
# Place the vertical and horizontal square labels
|
||||
ctx.save()
|
||||
ctx.translate(commons.convert_pt_to_dots(self.grayed_margin_pt),
|
||||
commons.convert_pt_to_dots(self.grayed_margin_pt))
|
||||
self._draw_labels(ctx, grid,
|
||||
commons.convert_pt_to_dots(self._usable_area_width_pt) \
|
||||
- 2 * commons.convert_pt_to_dots(self.grayed_margin_pt),
|
||||
|
|
@ -565,7 +563,7 @@ class MultiPageRenderer(Renderer):
|
|||
- 2 * commons.convert_pt_to_dots(self.grayed_margin_pt),
|
||||
commons.convert_pt_to_dots(self._grid_legend_margin_pt))
|
||||
|
||||
ctx.restore()
|
||||
ctx.restore()
|
||||
|
||||
ctx.restore()
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue