]> mj.ucw.cz Git - leo.git/blob - labeller.h
Labelling: Map parts generation doesn't round coordinates up
[leo.git] / labeller.h
1 #ifndef _LEO_LABELLER_H
2 #define _LEO_LABELLER_H
3
4 enum edge_dir
5 {
6   DIR_INVALID,
7   DIR_UNSET,
8   DIR_CENTER,
9   DIR_FWD,
10   DIR_BWD,
11 };
12
13 enum request_type
14 {
15   REQUEST_INVALID,
16   REQUEST_POINT,
17   REQUEST_AREA,
18   REQUEST_LINE,
19   REQUEST_SECTION,
20   REQUEST_SEGMENT,
21 };
22
23 enum term_cond
24 {
25   TERM_COND_PENALTY,
26   TERM_COND_STAGNATION,
27   TERM_COND_ITERATIONS,
28 };
29
30 struct variant
31 {
32   int width;
33   int height;
34   int offset_x;
35   int offset_y;
36   bool *bitmap;
37 };
38
39 struct request
40 {
41   enum request_type type;
42   int ind;
43   struct variant *variants;
44 };
45
46 struct request_point
47 {
48   struct request request;
49   struct symbol *sym;
50   z_index_t zindex;
51   double x;
52   double y;
53   double offset_x;
54   double offset_y;
55   int num_variants;
56 };
57
58 struct request_segment
59 {
60   struct request request;
61   struct request_line *rl;
62   double x1;
63   double y1;
64   double x2;
65   double y2;
66   double slope;
67   struct symbol *label;
68   z_index_t zindex;
69 };
70
71 struct request_section
72 {
73   struct request request;
74   int num_segments;
75   struct request_segment *segments;
76 };
77
78 struct request_line
79 {
80   struct request request;
81   struct symbol *line;
82   int num_variants;
83   struct request_section *sections;
84 };
85
86 struct request_area
87 {
88   struct request request;
89   struct osm_multipolygon *o;
90   struct symbol *label;
91   z_index_t zindex;
92   double cx, cy;
93 };
94
95 struct buffer_line
96 {
97   struct sym_line *line;
98   z_index_t zindex;
99 };
100
101 struct buffer_linelabel
102 {
103   struct osm_way *way;
104   struct symbol *label;
105   z_index_t zindex;
106 };
107
108 struct graph_node
109 {
110   osm_id_t id;
111   struct osm_node *o;
112   struct graph_edge **edges;
113   int num;
114 };
115
116 struct graph_edge
117 {
118   osm_id_t id;
119   double length;
120   color_t color;
121   int visited;
122   struct graph_edge *prev;
123   struct graph_edge *next;
124   struct graph_node *n1;
125   struct graph_node *n2;
126   uns longline;
127   struct symbol *label;
128   struct sym_line *line;
129   z_index_t zindex;
130   enum edge_dir dir;
131   struct graph_node *anode;
132   struct graph_node *bnode; // DEBUG PRINT
133   int num; // DEBUG
134 };
135
136 struct longline
137 {
138   uns id;
139   struct graph_edge *first;
140 };
141
142 struct placement
143 {
144   struct request *request;
145   double x;
146   double y;
147   int variant_used;
148   int ind;
149   bool processed;
150   // FIXME: Replace with clist?
151   struct placement_link *map_links;
152   struct individual *individual;
153 };
154
155 struct placement_link
156 {
157   struct map_placement *mp;
158   struct placement_link *next;
159 };
160
161 struct map_placement
162 {
163   struct placement *placement;
164   struct map_placement *next;
165   struct map_placement *prev;
166 };
167
168 struct map_part
169 {
170   // FIXME: Replace with clist?
171   struct map_placement *placement;
172 };
173
174 struct individual
175 {
176   struct placement *placements;
177   struct map_part **map;
178   int penalty;
179 };
180
181 void labeller_init(void);
182 void labeller_add_point(struct symbol *sym, struct osm_object *object, z_index_t zindex);
183 void labeller_add_line(struct symbol *sym, z_index_t zindex);
184 void labeller_label(void);
185 void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex);
186 void labeller_add_arealabel(struct symbol *sym, struct osm_object *o, z_index_t zindex);
187
188 #endif