]> mj.ucw.cz Git - leo.git/blobdiff - map.c
Support for fixed objects
[leo.git] / map.c
diff --git a/map.c b/map.c
index 2aab9e2c66cdbe2687187277e37bc99ccea5de97..8f318e23e9427bafa5a65a7baf5417a2d1ed68ad 100644 (file)
--- a/map.c
+++ b/map.c
@@ -18,6 +18,7 @@
 #include "map.h"
 #include "css.h"
 #include "sym.h"
+#include "fixed.h"
 
 double map_min_x, map_min_y;
 double map_max_x, map_max_y;
@@ -42,6 +43,7 @@ static struct cf_section map_style_cf = {
 static const char * const map_formats[] = {
   "invalid",
   "osmxml",
+  "fixed",
 };
 
 static struct cf_section map_source_cf = {
@@ -217,29 +219,45 @@ static void map_load_source(struct data_source *ds)
 {
   ds->osm = osm_init();
 
+  bool need_mp = 0;
+  bool need_proj = 0;
+
   switch (ds->format)
     {
     case DATA_SOURCE_OSMXML:
       msg(L_INFO, "Parsing %s as OSM XML", ds->file);
+      if (!ds->file)
+       die("OSM XML data sources must have a file name");
       osm_xml_parse(ds->file);
-      if (debug_dump_source)
-       {
-         puts("=== Source data ===");
-         osm_dump();
-       }
-      osm_make_multipolygons();
+      need_mp = 1;
+      need_proj = 1;
+      break;
+    case DATA_SOURCE_FIXED:
+      msg(L_INFO, "Adding fixed objects");
+      fixed_add();
       break;
     default:
       die("Invalid data source format");
     }
 
-  msg(L_INFO, "Projecting");
-  osm_project(map_projection);
-  if (debug_dump_after_proj)
+  if (debug_dump_source)
     {
-      puts("=== Map after projection ===");
+      puts("=== Source data ===");
       osm_dump();
     }
+  if (need_mp)
+    osm_make_multipolygons();
+
+  if (need_proj)
+    {
+      msg(L_INFO, "Projecting");
+      osm_project(map_projection);
+      if (debug_dump_after_proj)
+       {
+         puts("=== Map after projection ===");
+         osm_dump();
+       }
+    }
 }
 
 void map_load_sources(void)