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