The single page renderers can output PNG, SVGZ, PDF and CSV, but by design, the multi page renderer can only output PDF and CSV. So we introduce a get_compatible_output_formats() in the renderer class so that users of OcitySMap2 can find out which formats are possible depending on the choosen layout.
Signed-off-by: Thomas Petazzoni <[email protected]> --- ocitysmap2/layoutlib/abstract_renderer.py | 4 ++++ ocitysmap2/layoutlib/multi_page_renderer.py | 5 +++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/ocitysmap2/layoutlib/abstract_renderer.py b/ocitysmap2/layoutlib/abstract_renderer.py index 5da2fde..11aed7d 100644 --- a/ocitysmap2/layoutlib/abstract_renderer.py +++ b/ocitysmap2/layoutlib/abstract_renderer.py @@ -296,6 +296,10 @@ class Renderer: raise NotImplementedError @staticmethod + def get_compatible_output_formats(): + return [ "png", "svgz", "pdf", "csv" ] + + @staticmethod def get_compatible_paper_sizes(bounding_box, zoom_level, resolution_km_in_mm): """Returns a list of the compatible paper sizes for the given bounding diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py b/ocitysmap2/layoutlib/multi_page_renderer.py index 1acab3b..a27b6f3 100644 --- a/ocitysmap2/layoutlib/multi_page_renderer.py +++ b/ocitysmap2/layoutlib/multi_page_renderer.py @@ -664,6 +664,11 @@ class MultiPageRenderer(Renderer): def _paper_pt_to_geo_m(self, paper_pt): return self._paper_mm_to_geo_m(commons.convert_pt_to_mm(paper_pt)) + # In multi-page mode, we only render pdf and csv formats + @staticmethod + def get_compatible_output_formats(): + return [ "pdf", "csv" ] + # In multi-page mode, we only accept A4, A5 and US letter as paper # sizes. The goal is to render booklets, not posters. @staticmethod -- 1.7.4.1
