]> mj.ucw.cz Git - leo.git/blob - labeller.h
Labelling: Some fixes concerning variants initialization
[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   bool *bitmap;
35 };
36
37 struct request
38 {
39   enum request_type type;
40   int ind;
41   struct variant *variants;
42 };
43
44 struct request_point
45 {
46   struct request request;
47   struct symbol *sym;
48   z_index_t zindex;
49   double x;
50   double y;
51   double offset_x;
52   double offset_y;
53   int num_variants;
54 };
55
56 struct request_segment
57 {
58   struct request request;
59   struct request_line *rl;
60   double x1;
61   double y1;
62   double x2;
63   double y2;
64   double angle;
65   struct symbol *label;
66   z_index_t zindex;
67 };
68
69 struct request_section
70 {
71   struct request request;
72   int num_segments;
73   struct request_segment *segments;
74 };
75
76 struct request_line
77 {
78   struct request request;
79   struct symbol *line;
80   int num_variants;
81   struct request_section *sections;
82 };
83
84 struct request_area
85 {
86   struct request request;
87   struct osm_multipolygon *o;
88   struct symbol *label;
89   z_index_t zindex;
90   double cx, cy;
91 };
92
93 struct buffer_line
94 {
95   struct sym_line *line;
96   z_index_t zindex;
97 };
98
99 struct buffer_linelabel
100 {
101   struct osm_way *way;
102   struct symbol *label;
103   z_index_t zindex;
104 };
105
106 struct graph_node
107 {
108   osm_id_t id;
109   struct osm_node *o;
110   struct graph_edge **edges;
111   int num;
112 };
113
114 struct graph_edge
115 {
116   osm_id_t id;
117   double length;
118   color_t color;
119   int visited;
120   struct graph_edge *prev;
121   struct graph_edge *next;
122   struct graph_node *n1;
123   struct graph_node *n2;
124   uns longline;
125   struct symbol *label;
126   struct sym_line *line;
127   z_index_t zindex;
128   enum edge_dir dir;
129   struct graph_node *anode;
130   struct graph_node *bnode; // DEBUG PRINT
131   int num; // DEBUG
132 };
133
134 struct longline
135 {
136   uns id;
137   struct graph_edge *first;
138 };
139
140 struct placement
141 {
142   struct request *request;
143   double x;
144   double y;
145   int variant_used;
146   bool processed;
147   // FIXME: Replace with clist?
148   struct placement_link *map_links;
149   struct individual *individual;
150 };
151
152 struct placement_link
153 {
154   struct map_placement *mp;
155   struct placement_link *next;
156 };
157
158 struct map_placement
159 {
160   struct placement *placement;
161   struct map_placement *next;
162   struct map_placement *prev;
163 };
164
165 struct map_part
166 {
167   // FIXME: Replace with clist?
168   struct map_placement *placement;
169 };
170
171 struct individual
172 {
173   struct placement *placements;
174   struct map_part **map;
175   int penalty;
176 };
177
178 void labeller_init(void);
179 void labeller_add_point(struct symbol *sym, struct osm_object *object, z_index_t zindex);
180 void labeller_add_line(struct symbol *sym, z_index_t zindex);
181 void labeller_label(void);
182 void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex);
183 void labeller_add_arealabel(struct symbol *sym, struct osm_object *o, z_index_t zindex);
184
185 #endif