X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=leo.c;h=75df2e7a4f3b85b4e24ee476da3f1116fd5c5ae1;hb=eadd63b657be979276b0f7bab89f76a632473ab4;hp=dea6cde89a684e6c87e83871add89e09ec6d261a;hpb=bc432588d79bf0c0ba61430e0b6fc4c8e754eef6;p=leo.git diff --git a/leo.c b/leo.c index dea6cde..75df2e7 100644 --- a/leo.c +++ b/leo.c @@ -18,6 +18,8 @@ #include "sym.h" #include "map.h" +#include "labeller.h" + 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; @@ -113,42 +115,17 @@ static void draw_scale(struct svg *svg) int main(int argc UNUSED, char **argv) { cf_def_file = "map.cf"; +// HACKING + cf_def_file = argv[1]; cf_declare_section("Debug", &debug_cf, 0); - opt_parse(&options, argv+1); + opt_parse(&options, argv+2); +// TILL HERE osm_init(); styles_init(); - - msg(L_INFO, "Parsing OSM"); - osm_xml_parse(map_xml_input); - if (debug_dump_source) - { - puts("=== Source data ==="); - osm_dump(); - } - osm_make_multipolygons(); - - msg(L_INFO, "Projecting"); - osm_project(map_projection); - if (debug_dump_after_proj) - { - puts("=== Map after projection ==="); - osm_dump(); - } - + map_load_styles(); + map_load_sources(); map_set_scale(); - if (debug_dump_after_scaling) - { - puts("=== Map after scaling ==="); - osm_dump(); - } - - struct css_sheet *ss = css_load(map_style_sheet); - if (debug_dump_css) - { - puts("=== Stylesheet ==="); - css_dump(ss); - } struct svg *svg = svg_open(map_svg_output); if (!map_rotate) @@ -162,32 +139,10 @@ int main(int argc UNUSED, char **argv) svg_set_attr_dimen(svg, "height", page_width); } - struct style_results r; - style_init(&r); sym_init(); + labeller_init(); - msg(L_INFO, "Applying stylesheet"); - for (uns i = OSM_TYPE_NODE; i <= OSM_TYPE_MULTIPOLYGON; i++) - CLIST_FOR_EACH(struct osm_object *, o, osm_obj_list[i]) - { - if (debug_dump_styling) - { - puts("==============================="); - osm_obj_dump(o); - } - if (!map_object_visible_p(o)) - { - if (debug_dump_styling) - printf("--> invisible\n"); - continue; - } - style_begin(&r, o); - css_apply(ss, &r); - if (debug_dump_styling) - style_dump(&r); - sym_from_style(o, &r, svg); - style_end(&r); - } + map_apply_styles(svg); if (map_clip) { @@ -216,6 +171,7 @@ int main(int argc UNUSED, char **argv) struct svg_icon *logo = svg_icon_load(svg, "../logo/kocka-s-okrajem.svg"); #endif + labeller_label(); sym_draw_all(svg); // Draw logo