]> mj.ucw.cz Git - leo.git/blob - labeller.h
4c0aacc4722a3cd48ed17f0d3ad236cb4f3f638d
[leo.git] / labeller.h
1 #ifndef _LEO_LABELLER_H
2 #define _LEO_LABELLER_H
3
4 #include "lab-utils.h"
5
6 enum request_type
7 {
8   REQUEST_INVALID,
9   REQUEST_POINT,
10   REQUEST_AREA,
11   REQUEST_LINE,
12   REQUEST_SECTION,
13   REQUEST_SEGMENT,
14 };
15
16 struct variant
17 {
18   int width;
19   int height;
20   int offset_x;
21   int offset_y;
22   bool *bitmap;
23 };
24
25 struct request
26 {
27   enum request_type type;
28   int ind;
29   struct variant *variants;
30 };
31
32 struct request_point
33 {
34   struct request request;
35   struct symbol *sym;
36   z_index_t zindex;
37   double x;
38   double y;
39   double offset_x;
40   double offset_y;
41   int num_variants;
42 };
43
44 struct request_segment
45 {
46   struct request request;
47   struct request_line *rl;
48   double x1;
49   double y1;
50   double x2;
51   double y2;
52   double slope;
53   struct symbol *label;
54   z_index_t zindex;
55 };
56
57 struct request_section
58 {
59   struct request request;
60   int num_segments;
61   struct request_segment *segments;
62 };
63
64 struct request_line
65 {
66   struct request request;
67   struct symbol *line;
68   int num_variants;
69   struct request_section *sections;
70 };
71
72 struct request_area
73 {
74   struct request request;
75   struct osm_multipolygon *o;
76   struct symbol *label;
77   z_index_t zindex;
78   double cx, cy;
79 };
80
81 struct buffer_line
82 {
83   struct sym_line *line;
84   z_index_t zindex;
85 };
86
87 struct buffer_linelabel
88 {
89   struct osm_way *way;
90   struct symbol *label;
91   z_index_t zindex;
92 };
93
94 struct placement
95 {
96   struct request *request;
97   double x;
98   double y;
99   int variant_used;
100   int ind;
101   bool processed;
102   // FIXME: Replace with clist?
103   struct map_placement *map_links;
104   struct individual *individual;
105 };
106
107 struct map_placement
108 {
109   struct placement *placement;
110   struct map_part *part;
111   struct map_placement *next_in_map;
112   struct map_placement *prev_in_map;
113   struct map_placement *next_in_placement;
114   struct map_placement *prev_in_placement;
115 };
116
117 struct map_part
118 {
119   // FIXME: Replace with clist?
120   struct map_placement *placement;
121   int ind;
122 };
123
124 struct individual
125 {
126   struct placement *placements;
127   struct map_part **map;
128   int penalty;
129 };
130
131 void labeller_conf(void);
132 void labeller_init(void);
133 void labeller_cleanup(void);
134
135 void labeller_label(void);
136
137 void labeller_add_point(struct symbol *sym, struct osm_object *object, z_index_t zindex);
138 void labeller_notify_line(struct symbol *sym, z_index_t zindex);
139 void labeller_add_label(struct symbol *sym, struct osm_object *o, z_index_t zindex);
140
141 extern struct request_point *requests_point;
142 extern struct request_line *requests_line;
143 extern struct request_area *requests_area;
144
145 extern struct longline *longlines;
146 extern struct buffer_line *buffer_line;
147 extern struct buffer_linelabel *buffer_linelabel;
148
149 extern int dbg_segments;
150 extern int dbg_plan;
151 extern int dbg_requests;
152 extern int dbg_graph;
153 extern int dbg_bfs;
154 extern int dbg_map_parts;
155 extern int dbg_movement;
156 extern int dbg_init;
157 extern int dbg_overlaps;
158 extern int dbg_rank;
159 extern int dbg_evolution;
160 extern int dbg_mutation;
161 extern int dbg_breeding;
162
163 extern int page_width_int;
164 extern int page_height_int;
165
166 extern int num_requests;
167 extern int num_placements;
168
169 extern int conf_map_part_width;
170 extern int conf_map_part_height;
171
172 extern uns num_map_parts_row;
173 extern uns num_map_parts_col;
174 extern uns num_map_parts;
175
176
177 #endif