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