#include "leo.h"
#include "osm.h"
+#include "shp.h"
#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;
static const char * const map_formats[] = {
"invalid",
"osmxml",
+ "fixed",
+ "shape",
};
static struct cf_section map_source_cf = {
{
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;
+ case DATA_SOURCE_SHAPE:
+ msg(L_INFO, "Parsing %s as shape file", ds->file);
+ if (!ds->file)
+ die("Shape data sources must have a file name");
+ shp_parse(ds->file);
+ need_proj = 1;
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)