]> mj.ucw.cz Git - leo.git/blob - map.h
Do not crash on broken multipolygons
[leo.git] / map.h
1 /*
2  *      Hic Est Leo -- Global Map Operations
3  *
4  *      (c) 2014 Martin Mares <mj@ucw.cz>
5  */
6
7 #ifndef _LEO_MAP_H
8 #define _LEO_MAP_H
9
10 #include "svg.h"
11
12 /* Map configuration */
13
14 extern double map_min_x, map_min_y;
15 extern double map_max_x, map_max_y;
16 extern double page_width, page_height;
17 extern uns map_clip, map_rotate, map_draw_border;
18 extern char *map_projection;
19 extern char *map_svg_output;
20
21 // Remember to update map.c:map_formats
22 enum data_source_type {
23   DATA_SOURCE_INVALID,
24   DATA_SOURCE_OSMXML,
25   DATA_SOURCE_FIXED,
26   DATA_SOURCE_SHAPE,
27 };
28
29 struct data_source {
30   cnode n;
31   // Configuration
32   char *file;
33   int format;
34   clist styles;         // of data_source_style
35   // Runtime
36   struct osm *osm;
37 };
38
39 struct data_source_style {
40   cnode n;
41   // Configuration
42   char *name;
43   // Runtime
44   struct css_sheet *css;
45 };
46
47 extern clist map_sources;
48
49 /* Calculated by map_set_scale() */
50
51 extern double map_scale;
52 extern double page_offset_x, page_offset_y;
53 extern double page_map_width, page_map_height;
54
55 void map_set_scale(void);
56 bool map_object_visible_p(struct osm_object *o);
57
58 void map_load_styles(void);
59 void map_load_sources(void);
60 void map_apply_styles(struct svg *svg);
61
62 #endif