X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=map.c;h=8f318e23e9427bafa5a65a7baf5417a2d1ed68ad;hb=af80b4c6ce10632dfda42b6f93634c4ad5f5e3f5;hp=2aab9e2c66cdbe2687187277e37bc99ccea5de97;hpb=b5ad4205a047a4be68e74c82f5637b13bd3f6896;p=leo.git diff --git a/map.c b/map.c index 2aab9e2..8f318e2 100644 --- 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)