X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=labeller.h;h=c16c43dd11518a40c37b82733c2f08e4d4aa74a9;hb=6a7eb18eb0f3cb8a6a26edf9cf63e949afbd744e;hp=f17bda5b406b8a754242f88602f0aecad794aa64;hpb=5ac436112370bca9a88fe9ed31f399197b6b08cf;p=leo.git diff --git a/labeller.h b/labeller.h index f17bda5..c16c43d 100644 --- a/labeller.h +++ b/labeller.h @@ -1,18 +1,22 @@ #ifndef _LEO_LABELLER_H #define _LEO_LABELLER_H -enum label_type +enum edge_dir { - LABEL_POINT, - LABEL_LINE, - LABEL_AREA, + DIR_INVALID, + DIR_UNSET, + DIR_CENTER, + DIR_FWD, + DIR_BWD, }; enum request_type { + REQUEST_INVALID, REQUEST_POINT, - REQUEST_AREALABEL, - REQUEST_LINELABEL, + REQUEST_AREA, + REQUEST_LINE, + REQUEST_SECTION, REQUEST_SEGMENT, }; @@ -23,24 +27,10 @@ enum term_cond TERM_COND_ITERATIONS, }; -struct sym_placement -{ - double x; - double y; - int variant; - struct request *request; -}; - -struct request -{ - enum request_type type; - int ind; -}; - struct point_variant { - double width; - double height; + int width; + int height; bool *bitmap; }; @@ -49,11 +39,16 @@ struct line_variant bool *masks; }; +struct request +{ + enum request_type type; + int ind; +}; + struct request_point { struct request request; struct symbol *sym; - struct osm_object *object; // FIXME: Linked also by sym z_index_t zindex; double x; double y; @@ -66,34 +61,41 @@ struct request_point struct request_segment { struct request request; + struct request_line *rl; double x1; double y1; double x2; double y2; - double k; - struct sym_line *sym; + double angle; + struct symbol *label; struct point_variant *variant; - struct sym_text *text; z_index_t zindex; }; +struct request_section +{ + struct request request; + int num_segments; + struct request_segment *segments; +}; + struct request_line { struct request request; - struct symbol *sym; + struct symbol *line; int num_variants; - int num_segments; struct line_variant *variants; - struct request_segment *segments; + struct request_section *sections; }; struct request_area { struct request request; struct osm_multipolygon *o; - struct sym_text *sym; - struct point_variant *text_variant; + struct symbol *label; + struct point_variant *variants; z_index_t zindex; + double cx, cy; }; struct buffer_line @@ -105,7 +107,7 @@ struct buffer_line struct buffer_linelabel { struct osm_way *way; - struct sym_text *text; + struct symbol *label; z_index_t zindex; }; @@ -122,16 +124,16 @@ struct graph_edge osm_id_t id; double length; color_t color; - bool visited; + int visited; struct graph_edge *prev; struct graph_edge *next; struct graph_node *n1; struct graph_node *n2; uns longline; - struct sym_text *text; - struct sym_line *sym; + struct symbol *label; + struct sym_line *line; z_index_t zindex; - int dir; + enum edge_dir dir; struct graph_node *anode; struct graph_node *bnode; // DEBUG PRINT int num; // DEBUG @@ -145,11 +147,11 @@ struct longline struct placement { + struct request *request; double x; double y; int variant_used; bool processed; - struct request *request; }; struct map_part @@ -170,47 +172,4 @@ void labeller_label(void); void labeller_add_linelabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); void labeller_add_arealabel(struct symbol *sym, struct osm_object *o, z_index_t zindex); -void make_bitmap_icon(struct point_variant *v, struct sym_icon *si); -void make_bitmap_point(struct point_variant *v, struct sym_point *sp); -void make_bitmap_label(struct point_variant *v, struct sym_text *text); - -void make_graph(void); -void label_graph(void); -void join_edge(struct graph_edge *e, int dir); -void bfs(void); -void make_segments(void); - -void make_population(void); -bool shall_terminate(void); -void breed(void); -void mutate(void); -void elite(void); -void rank_population(void); - -struct individual **perform_crossover(struct individual *parent1, struct individual *parent2); -void perform_mutation(struct individual *individual); - -void init_placement(struct placement *p, struct request *r); -void init_individual(struct individual *i); -void gen_coords_point(struct placement *p); -void gen_coords(struct placement *p); -struct map_part **get_parts(struct placement *symbol, struct individual *individual); - -int randint(int min, int max); - -struct placement **get_closure(struct placement *placement, struct individual *parent1, struct individual *parent2); -void copy_symbols(struct placement **closure, struct individual *parent, struct individual *child); -void move_symbol(struct placement *p); -void move_symbol_point(struct placement *p); - -struct placement **get_overlapping(struct placement *p); -void filter(struct placement **list, bool *pred); - -int flip(int a, int b); -double randdouble(void); - -void cleanup(void); - -void copy_individual(struct individual *src, struct individual *dest); - #endif