]> mj.ucw.cz Git - leo.git/commitdiff
Rotation controlled by a config option
authorMartin Mares <mj@ucw.cz>
Sun, 15 Jun 2014 20:01:57 +0000 (22:01 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 15 Jun 2014 20:01:57 +0000 (22:01 +0200)
leo.c
map.c
map.cf
map.h

diff --git a/leo.c b/leo.c
index 10092d657cfb6d4bbd95d943c589550897583113..c873770b05e34387a0f4da5f886ceda76447e77a 100644 (file)
--- 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 57d786169a8034e9a9103b375b821c43b5ad4a9d..455d7aab19c3206c95b81ed79df881d4163790e3 100644 (file)
--- 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 e605403d5f6a6a654c8cc6f985177abc340f69a1..a6ae531f17af7ca131a5d80431a7b567288cb0bc 100644 (file)
--- 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 eaad9b6a52ab2ba1b4244a0007b71e890501ad89..127d30ac4cb8294a2b61d6ab730a379107a44e28 100644 (file)
--- 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;