/[zanavi_public1]/navit/navit/maptool/maptool.h
ZANavi

Diff of /navit/navit/maptool/maptool.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 35 Revision 36
30#define LONGLONG_FMT "%I64d" 30#define LONGLONG_FMT "%I64d"
31#else 31#else
32#define LONGLONG_FMT "%lld" 32#define LONGLONG_FMT "%lld"
33#endif 33#endif
34 34
35
36#define sq(x) ((double)(x)*(x))
37
38
35#define BUFFER_SIZE 1280 39#define BUFFER_SIZE 1280
36 40
37#define debug_tile(x) 0 41#define debug_tile(x) 0
38#define debug_itembin(x) 0 42#define debug_itembin(x) 0
39 43
96struct item_bin_sink { 100struct item_bin_sink {
97 void *priv_data[8]; 101 void *priv_data[8];
98 GList *sink_funcs; 102 GList *sink_funcs;
99}; 103};
100 104
105struct node_item {
106 int id;
107 char ref_node;
108 char ref_way;
109 char ref_ref;
110 char dummy;
111 struct coord c;
112};
113
101struct zip_info; 114struct zip_info;
115struct country_table;
102 116
103/* boundaries.c */ 117/* boundaries.c */
118struct boundary {
119 struct item_bin *ib;
120 struct country_table *country;
121 char *iso2;
122 GList *segments,*sorted_segments;
123 GList *children;
124 struct rect r;
125};
104 126
127char *osm_tag_value(struct item_bin *ib, char *key);
128long long *boundary_relid(struct boundary *b);
105int process_boundaries(FILE *boundaries, FILE *ways); 129GList *process_boundaries(FILE *boundaries, FILE *ways);
130GList *boundary_find_matches(GList *bl, struct coord *c);
106 131
107/* buffer.c */ 132/* buffer.c */
108struct buffer { 133struct buffer {
109 int malloced_step; 134 int malloced_step;
110 long long malloced; 135 long long malloced;
172void *item_bin_get_attr(struct item_bin *ib, enum attr_type type, void *last); 197void *item_bin_get_attr(struct item_bin *ib, enum attr_type type, void *last);
173struct attr_bin * item_bin_get_attr_bin_last(struct item_bin *ib); 198struct attr_bin * item_bin_get_attr_bin_last(struct item_bin *ib);
174void item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val); 199void item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val);
175void item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str); 200void item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str);
176void item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max); 201void item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max);
202void item_bin_remove_attr(struct item_bin *ib, void *ptr);
177void item_bin_write(struct item_bin *ib, FILE *out); 203void item_bin_write(struct item_bin *ib, FILE *out);
178struct item_bin *item_bin_dup(struct item_bin *ib); 204struct item_bin *item_bin_dup(struct item_bin *ib);
179void item_bin_write_range(struct item_bin *ib, FILE *out, int min, int max); 205void item_bin_write_range(struct item_bin *ib, FILE *out, int min, int max);
180void item_bin_write_clipped(struct item_bin *ib, struct tile_parameter *param, struct item_bin_sink *out); 206void item_bin_write_clipped(struct item_bin *ib, struct tile_parameter *param, struct item_bin_sink *out);
181void item_bin_dump(struct item_bin *ib, FILE *out); 207void item_bin_dump(struct item_bin *ib, FILE *out);
182void dump_itembin(struct item_bin *ib); 208void dump_itembin(struct item_bin *ib);
183void item_bin_set_type_by_population(struct item_bin *ib, int population); 209void item_bin_set_type_by_population(struct item_bin *ib, int population);
184void item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, FILE *out); 210void item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, FILE *out);
211void item_bin_town_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, FILE *out);
185int item_bin_sort_file(char *in_file, char *out_file, struct rect *r, int *size); 212int item_bin_sort_file(char *in_file, char *out_file, struct rect *r, int *size);
186 213
187/* itembin_buffer.c */ 214/* itembin_buffer.c */
215struct node_item *read_node_item(FILE *in);
188struct item_bin *read_item(FILE *in); 216struct item_bin *read_item(FILE *in);
189struct item_bin *read_item_range(FILE *in, int *min, int *max); 217struct item_bin *read_item_range(FILE *in, int *min, int *max);
190struct item_bin *init_item(enum item_type type); 218struct item_bin *init_item(enum item_type type);
191 219
192/* maptool.c */ 220/* maptool.c */
201extern struct buffer node_buffer; 229extern struct buffer node_buffer;
202extern int processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles; 230extern int processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles;
203extern struct item_bin *item_bin; 231extern struct item_bin *item_bin;
204extern int bytes_read; 232extern int bytes_read;
205extern int overlap; 233extern int overlap;
234extern int experimental;
235extern int use_global_fixed_country_id;
236extern int global_fixed_country_id;
237extern int unknown_country;
206void sig_alrm(int sig); 238void sig_alrm(int sig);
207void sig_alrm_end(void); 239void sig_alrm_end(void);
240extern int border_only_map;
241extern int coastline_only_map;
208 242
209/* misc.c */ 243/* misc.c */
210extern struct rect world_bbox; 244extern struct rect world_bbox;
211 245
212 246
226 260
227 261
228/* osm.c */ 262/* osm.c */
229typedef long int osmid; 263typedef long int osmid;
230 264
265struct maptool_osm {
266 FILE *boundaries;
267 FILE *turn_restrictions;
268 FILE *nodes;
269 FILE *ways;
270 FILE *line2poi;
271 FILE *poly2poi;
272 FILE *towns;
273};
274
275
276void osm_warning(char *type, long long id, int cont, char *fmt, ...);
231void osm_add_tag(char *k, char *v); 277void osm_add_tag(char *k, char *v);
232void osm_add_node(osmid id, double lat, double lon); 278void osm_add_node(osmid id, double lat, double lon);
233void osm_add_way(osmid id); 279void osm_add_way(osmid id);
234void osm_add_relation(osmid id); 280void osm_add_relation(osmid id);
235void osm_end_relation(FILE *turn_restrictions, FILE *boundaries); 281void osm_end_relation(struct maptool_osm *osm);
236void osm_add_member(int type, osmid ref, char *role); 282void osm_add_member(int type, osmid ref, char *role);
237void osm_end_way(FILE *out); 283void osm_end_way(struct maptool_osm *osm);
238void osm_end_node(FILE *out); 284void osm_end_node(struct maptool_osm *osm);
239void osm_add_nd(osmid ref); 285void osm_add_nd(osmid ref);
240long long item_bin_get_id(struct item_bin *ib); 286long long item_bin_get_id(struct item_bin *ib);
241void flush_nodes(int final); 287void flush_nodes(int final);
242void sort_countries(int keep_tmpfiles); 288void sort_countries(int keep_tmpfiles);
243void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out); 289void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out);
290void clear_node_item_buffer(void);
291void ref_ways(FILE *in);
244int resolve_ways(FILE *in, FILE *out); 292void resolve_ways(FILE *in, FILE *out);
293long long item_bin_get_nodeid(struct item_bin *ib);
294long long item_bin_get_wayid(struct item_bin *ib);
295long long item_bin_get_relationid(struct item_bin *ib);
296FILE *resolve_ways_file(FILE *in, char *suffix, char *filename);
297void process_way2poi(FILE *in, FILE *out, int type);
245int map_find_intersections(FILE *in, FILE *out, FILE *out_index, FILE *out_graph, FILE *out_coastline, int final); 298int map_find_intersections(FILE *in, FILE *out, FILE *out_index, FILE *out_graph, FILE *out_coastline, int final);
246void write_countrydir(struct zip_info *zip_info); 299void write_countrydir(struct zip_info *zip_info);
300void osm_process_towns(FILE *in, FILE *boundaries, FILE *ways);
301void load_countries(void);
247void remove_countryfiles(void); 302void remove_countryfiles(void);
303struct country_table * country_from_iso2(char *iso);
248void osm_init(FILE*); 304void osm_init(FILE*);
249 305
250/* osm_psql.c */ 306/* osm_psql.c */
251int map_collect_data_osm_db(char *dbstr, FILE *out_ways, FILE *out_nodes, FILE *out_turn_restrictions, FILE *out_boundaries); 307int map_collect_data_osm_db(char *dbstr, struct maptool_osm *osm);
252 308
253/* osm_protobuf.c */ 309/* osm_protobuf.c */
254int map_collect_data_osm_protobuf(FILE *in, FILE *out_ways, FILE *out_nodes, FILE *out_turn_restrictions, FILE *out_boundaries); 310int map_collect_data_osm_protobuf(FILE *in, struct maptool_osm *osm);
255int osm_protobufdb_load(FILE *in, char *dir); 311int osm_protobufdb_load(FILE *in, char *dir);
312
313
314/* osm_relations.c */
315struct relations * relations_new(void);
316struct relations_func *relations_func_new(void (*func)(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv), void *func_priv);
317void relations_add_func(struct relations *rel, struct relations_func *func, void *relation_priv, void *member_priv, int type, osmid id);
318void relations_process(struct relations *rel, FILE *nodes, FILE *ways, FILE *relations);
256 319
257/* osm_xml.c */ 320/* osm_xml.c */
258int osm_xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size); 321int osm_xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size);
259void osm_xml_decode_entities(char *buffer); 322void osm_xml_decode_entities(char *buffer);
260int map_collect_data_osm(FILE *in, FILE *out_ways, FILE *out_nodes, FILE *out_turn_restrictions, FILE *out_boundaries); 323int map_collect_data_osm(FILE *in, struct maptool_osm *osm);
261 324
262 325
263/* sourcesink.c */ 326/* sourcesink.c */
264 327
265struct item_bin_sink *item_bin_sink_new(void); 328struct item_bin_sink *item_bin_sink_new(void);

Legend:
Removed from v.35  
changed lines
  Added in v.36

   
Visit the ZANavi Wiki