From a732e5a272c5a1a30abc8c8f830583c75f334b96 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 15 Jun 2014 22:01:57 +0200 Subject: [PATCH] Rotation controlled by a config option --- leo.c | 24 ++++++++++++------------ map.c | 3 ++- map.cf | 3 +++ map.h | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/leo.c b/leo.c index 10092d6..c873770 100644 --- a/leo.c +++ b/leo.c @@ -18,8 +18,6 @@ #include "sym.h" #include "map.h" -#undef ROTATE - uns debug_dump_source, debug_dump_after_proj, debug_dump_after_scaling; uns debug_dump_multipolygons, debug_dump_css, debug_dump_styling, debug_dump_symbols; @@ -153,13 +151,16 @@ int main(int argc UNUSED, char **argv) } struct svg *svg = svg_open(map_svg_output); -#ifndef ROTATE - svg_set_attr_dimen(svg, "width", page_width); - svg_set_attr_dimen(svg, "height", page_height); -#else - svg_set_attr_dimen(svg, "width", page_height); - svg_set_attr_dimen(svg, "height", page_width); -#endif + if (!map_rotate) + { + svg_set_attr_dimen(svg, "width", page_width); + svg_set_attr_dimen(svg, "height", page_height); + } + else + { + svg_set_attr_dimen(svg, "width", page_height); + svg_set_attr_dimen(svg, "height", page_width); + } struct style_results r; style_init(&r); @@ -206,9 +207,8 @@ int main(int argc UNUSED, char **argv) svg_push_element(svg, "g"); svg_set_attr_format(svg, "clip-path", "url(#boundary)"); -#ifdef ROTATE - svg_set_attr_format(svg, "transform", "translate(%.6g,0) rotate(90)", page_height * svg->scale); -#endif + if (map_rotate) + svg_set_attr_format(svg, "transform", "translate(%.6g,0) rotate(90)", page_height * svg->scale); } // FIXME: Replace by generic logo drawing facility diff --git a/map.c b/map.c index 57d7861..455d7aa 100644 --- a/map.c +++ b/map.c @@ -19,7 +19,7 @@ double map_min_x, map_min_y; double map_max_x, map_max_y; double page_width, page_height; -uns map_clip, map_draw_border; +uns map_clip, map_rotate, map_draw_border; char *map_xml_input; char *map_projection; char *map_style_sheet; @@ -34,6 +34,7 @@ static struct cf_section map_cf = { CF_DOUBLE("PageWidth", &page_width), CF_DOUBLE("PageHeight", &page_height), CF_UNS("Clip", &map_clip), + CF_UNS("Rotate", &map_rotate), CF_UNS("DrawBorder", &map_draw_border), CF_STRING("XMLInput", &map_xml_input), CF_STRING("Projection", &map_projection), diff --git a/map.cf b/map.cf index e605403..a6ae531 100644 --- a/map.cf +++ b/map.cf @@ -22,6 +22,9 @@ Map { # Clip output to the requested rectangle Clip 1 + # Rotate the map by 90 degrees + Rotate 0 + # Draw blue border around the requested rectangle DrawBorder 0 diff --git a/map.h b/map.h index eaad9b6..127d30a 100644 --- a/map.h +++ b/map.h @@ -12,7 +12,7 @@ extern double map_min_x, map_min_y; extern double map_max_x, map_max_y; extern double page_width, page_height; -extern uns map_clip, map_draw_border; +extern uns map_clip, map_rotate, map_draw_border; extern char *map_xml_input; extern char *map_projection; extern char *map_style_sheet; -- 2.39.2