kopia lustrzana https://github.com/hholzgra/ocitysmap
Remove dead code about zoom_level
Signed-off-by: Gael UTARD <gael.utard@kisis.fr>stable
rodzic
8a6b15f924
commit
e34791cd55
|
@ -178,8 +178,7 @@ def main():
|
||||||
% ', '.join(KNOWN_PAPER_SIZE_NAMES))
|
% ', '.join(KNOWN_PAPER_SIZE_NAMES))
|
||||||
|
|
||||||
# Determine actual paper size
|
# Determine actual paper size
|
||||||
compat_papers = cls_renderer.get_compatible_paper_sizes(bbox,
|
compat_papers = cls_renderer.get_compatible_paper_sizes(bbox)
|
||||||
stylesheet.zoom_level)
|
|
||||||
if not compat_papers:
|
if not compat_papers:
|
||||||
parser.error("No paper size compatible with this rendering.")
|
parser.error("No paper size compatible with this rendering.")
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,6 @@ class Stylesheet:
|
||||||
self.name = None # str
|
self.name = None # str
|
||||||
self.path = None # str
|
self.path = None # str
|
||||||
self.description = '' # str
|
self.description = '' # str
|
||||||
self.zoom_level = Stylesheet.DEFAULT_ZOOM_LEVEL
|
|
||||||
|
|
||||||
self.grid_line_color = 'black'
|
self.grid_line_color = 'black'
|
||||||
self.grid_line_alpha = 0.5
|
self.grid_line_alpha = 0.5
|
||||||
|
@ -169,7 +168,6 @@ class Stylesheet:
|
||||||
s.name = parser.get(section_name, 'name')
|
s.name = parser.get(section_name, 'name')
|
||||||
s.path = parser.get(section_name, 'path')
|
s.path = parser.get(section_name, 'path')
|
||||||
assign_if_present('description')
|
assign_if_present('description')
|
||||||
assign_if_present('zoom_level', int)
|
|
||||||
|
|
||||||
assign_if_present('grid_line_color')
|
assign_if_present('grid_line_color')
|
||||||
assign_if_present('grid_line_alpha', float)
|
assign_if_present('grid_line_alpha', float)
|
||||||
|
|
|
@ -266,15 +266,13 @@ class Renderer:
|
||||||
return [ "png", "svgz", "pdf", "csv" ]
|
return [ "png", "svgz", "pdf", "csv" ]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_compatible_paper_sizes(bounding_box, zoom_level,
|
def get_compatible_paper_sizes(bounding_box, resolution_km_in_mm):
|
||||||
resolution_km_in_mm):
|
|
||||||
"""Returns a list of the compatible paper sizes for the given bounding
|
"""Returns a list of the compatible paper sizes for the given bounding
|
||||||
box. The list is sorted, smaller papers first, and a "custom" paper
|
box. The list is sorted, smaller papers first, and a "custom" paper
|
||||||
matching the dimensions of the bounding box is added at the end.
|
matching the dimensions of the bounding box is added at the end.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
||||||
zoom_level (int): the Mapnik zoom level to use, generally 16.
|
|
||||||
resolution_km_in_mm (int): size of a geographic kilometer in
|
resolution_km_in_mm (int): size of a geographic kilometer in
|
||||||
milimeters on the rendered map.
|
milimeters on the rendered map.
|
||||||
|
|
||||||
|
|
|
@ -729,7 +729,7 @@ class MultiPageRenderer(Renderer):
|
||||||
# sizes. The goal is to render booklets, not posters.
|
# sizes. The goal is to render booklets, not posters.
|
||||||
# The default paper size is A4 portrait
|
# The default paper size is A4 portrait
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_compatible_paper_sizes(bounding_box, zoom_level,
|
def get_compatible_paper_sizes(bounding_box,
|
||||||
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM,
|
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM,
|
||||||
index_position=None, hsplit=1, vsplit=1):
|
index_position=None, hsplit=1, vsplit=1):
|
||||||
valid_sizes = []
|
valid_sizes = []
|
||||||
|
|
|
@ -453,7 +453,7 @@ class SinglePageRenderer(Renderer):
|
||||||
cairo_surface.flush()
|
cairo_surface.flush()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _generic_get_compatible_paper_sizes(bounding_box, zoom_level,
|
def _generic_get_compatible_paper_sizes(bounding_box,
|
||||||
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM, index_position = None):
|
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM, index_position = None):
|
||||||
"""Returns a list of the compatible paper sizes for the given bounding
|
"""Returns a list of the compatible paper sizes for the given bounding
|
||||||
box. The list is sorted, smaller papers first, and a "custom" paper
|
box. The list is sorted, smaller papers first, and a "custom" paper
|
||||||
|
@ -461,7 +461,6 @@ class SinglePageRenderer(Renderer):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
||||||
zoom_level (int): the Mapnik zoom level to use, generally 16.
|
|
||||||
resolution_km_in_mm (int): size of a geographic kilometer in
|
resolution_km_in_mm (int): size of a geographic kilometer in
|
||||||
milimeters on the rendered map.
|
milimeters on the rendered map.
|
||||||
index_position (str): None or 'side' (index on side),
|
index_position (str): None or 'side' (index on side),
|
||||||
|
@ -533,7 +532,7 @@ class SinglePageRendererNoIndex(SinglePageRenderer):
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_compatible_paper_sizes(bounding_box, zoom_level,
|
def get_compatible_paper_sizes(bounding_box,
|
||||||
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
||||||
"""Returns a list of the compatible paper sizes for the given bounding
|
"""Returns a list of the compatible paper sizes for the given bounding
|
||||||
box. The list is sorted, smaller papers first, and a "custom" paper
|
box. The list is sorted, smaller papers first, and a "custom" paper
|
||||||
|
@ -541,7 +540,6 @@ class SinglePageRendererNoIndex(SinglePageRenderer):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
||||||
zoom_level (int): the Mapnik zoom level to use, generally 16.
|
|
||||||
resolution_km_in_mm (int): size of a geographic kilometer in
|
resolution_km_in_mm (int): size of a geographic kilometer in
|
||||||
milimeters on the rendered map.
|
milimeters on the rendered map.
|
||||||
|
|
||||||
|
@ -550,7 +548,7 @@ class SinglePageRendererNoIndex(SinglePageRenderer):
|
||||||
portrait mode.
|
portrait mode.
|
||||||
"""
|
"""
|
||||||
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
||||||
bounding_box, zoom_level, resolution_km_in_mm, None)
|
bounding_box, resolution_km_in_mm, None)
|
||||||
|
|
||||||
|
|
||||||
class SinglePageRendererIndexOnSide(SinglePageRenderer):
|
class SinglePageRendererIndexOnSide(SinglePageRenderer):
|
||||||
|
@ -569,7 +567,7 @@ class SinglePageRendererIndexOnSide(SinglePageRenderer):
|
||||||
SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, street_index, 'side')
|
SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, street_index, 'side')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_compatible_paper_sizes(bounding_box, zoom_level,
|
def get_compatible_paper_sizes(bounding_box,
|
||||||
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
||||||
"""Returns a list of the compatible paper sizes for the given bounding
|
"""Returns a list of the compatible paper sizes for the given bounding
|
||||||
box. The list is sorted, smaller papers first, and a "custom" paper
|
box. The list is sorted, smaller papers first, and a "custom" paper
|
||||||
|
@ -577,7 +575,6 @@ class SinglePageRendererIndexOnSide(SinglePageRenderer):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
||||||
zoom_level (int): the Mapnik zoom level to use, generally 16.
|
|
||||||
resolution_km_in_mm (int): size of a geographic kilometer in
|
resolution_km_in_mm (int): size of a geographic kilometer in
|
||||||
milimeters on the rendered map.
|
milimeters on the rendered map.
|
||||||
|
|
||||||
|
@ -586,7 +583,7 @@ class SinglePageRendererIndexOnSide(SinglePageRenderer):
|
||||||
portrait mode.
|
portrait mode.
|
||||||
"""
|
"""
|
||||||
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
||||||
bounding_box, zoom_level, resolution_km_in_mm, 'side')
|
bounding_box, resolution_km_in_mm, 'side')
|
||||||
|
|
||||||
|
|
||||||
class SinglePageRendererIndexBottom(SinglePageRenderer):
|
class SinglePageRendererIndexBottom(SinglePageRenderer):
|
||||||
|
@ -605,7 +602,7 @@ class SinglePageRendererIndexBottom(SinglePageRenderer):
|
||||||
SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, file_prefix, 'bottom')
|
SinglePageRenderer.__init__(self, db, rc, tmpdir, dpi, file_prefix, 'bottom')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_compatible_paper_sizes(bounding_box, zoom_level,
|
def get_compatible_paper_sizes(bounding_box,
|
||||||
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
resolution_km_in_mm=Renderer.DEFAULT_KM_IN_MM):
|
||||||
"""Returns a list of the compatible paper sizes for the given bounding
|
"""Returns a list of the compatible paper sizes for the given bounding
|
||||||
box. The list is sorted, smaller papers first, and a "custom" paper
|
box. The list is sorted, smaller papers first, and a "custom" paper
|
||||||
|
@ -613,7 +610,6 @@ class SinglePageRendererIndexBottom(SinglePageRenderer):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
bounding_box (coords.BoundingBox): the map geographic bounding box.
|
||||||
zoom_level (int): the Mapnik zoom level to use, generally 16.
|
|
||||||
resolution_km_in_mm (int): size of a geographic kilometer in
|
resolution_km_in_mm (int): size of a geographic kilometer in
|
||||||
milimeters on the rendered map.
|
milimeters on the rendered map.
|
||||||
|
|
||||||
|
@ -622,7 +618,7 @@ class SinglePageRendererIndexBottom(SinglePageRenderer):
|
||||||
portrait mode.
|
portrait mode.
|
||||||
"""
|
"""
|
||||||
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
return SinglePageRenderer._generic_get_compatible_paper_sizes(
|
||||||
bounding_box, zoom_level, resolution_km_in_mm, 'bottom')
|
bounding_box, resolution_km_in_mm, 'bottom')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -656,7 +652,6 @@ if __name__ == '__main__':
|
||||||
self.grid_line_color = 'black'
|
self.grid_line_color = 'black'
|
||||||
self.grid_line_alpha = 0.9
|
self.grid_line_alpha = 0.9
|
||||||
self.grid_line_width = 2
|
self.grid_line_width = 2
|
||||||
self.zoom_level = 16
|
|
||||||
self.shade_color = 'black'
|
self.shade_color = 'black'
|
||||||
self.shade_alpha = 0.7
|
self.shade_alpha = 0.7
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,6 @@ if __name__ == '__main__':
|
||||||
class StylesheetMock:
|
class StylesheetMock:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.path = '/home/sam/src/python/maposmatic/mapnik-osm/osm.xml'
|
self.path = '/home/sam/src/python/maposmatic/mapnik-osm/osm.xml'
|
||||||
self.zoom_level = 16
|
|
||||||
|
|
||||||
bbox = coords.BoundingBox(48.7148, 2.0155, 48.6950, 2.0670)
|
bbox = coords.BoundingBox(48.7148, 2.0155, 48.6950, 2.0670)
|
||||||
canvas = MapCanvas(StylesheetMock(), bbox, 297.0/210)
|
canvas = MapCanvas(StylesheetMock(), bbox, 297.0/210)
|
||||||
|
|
Ładowanie…
Reference in New Issue