navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
maptool.h
Go to the documentation of this file.
1 
19 #include "config.h"
20 #include <glib.h>
21 #include "coord.h"
22 #include "item.h"
23 #include "attr.h"
24 #include "geom.h"
25 #include "types.h"
26 
27 #define sq(x) ((double)(x)*(x))
28 
29 #define BUFFER_SIZE 1280
30 
31 #define debug_tile(x) 0
32 #define debug_itembin(x) 0
33 
34 #define RELATION_MEMBER_PRINT_FORMAT "%d:"LONGLONG_FMT":%s"
35 #define RELATION_MEMBER_PARSE_FORMAT "%d:"LONGLONG_FMT":%n"
36 
37 struct tile_data {
38  char buffer[1024];
40  struct rect item_bbox;
41  struct rect tile_bbox;
42 };
43 
45  int min;
46  int max;
47  int overlap;
49 };
50 
51 struct tile_info {
52  int write;
53  int maxlen;
54  char *suffix;
56  FILE *tilesdir_out;
57 };
58 
59 extern struct tile_head {
62  char *name;
63  char *zip_data;
65  int zipnum;
66  int process;
67  struct tile_head *next;
68  // char subtiles[0];
70 
71 
82 struct item_bin {
84  int len;
88  int clen;
89 };
90 
98 struct attr_bin {
100  int len;
103 };
104 
105 
107  int (*func)(struct item_bin_sink_func *func, struct item_bin *ib, struct tile_data *tile_data);
108  void *priv_data[8];
109 };
110 
112  void *priv_data[8];
114 };
115 #define NODE_ID_BITS 56
116 struct node_item {
117  struct coord c;
118  unsigned long long int nd_id:NODE_ID_BITS;
119  char ref_way;
120 };
121 
122 struct zip_info;
123 
125 
130 typedef unsigned long long int osmid;
131 #define OSMID_FMT ULONGLONG_FMT
132 
135  FILE *ways_in;
136  FILE *ways_out;
137  FILE *nodes_in;
138  FILE *nodes_out;
139  FILE *nodes2_in;
140  FILE *nodes2_out;
141 };
142 
143 /* boundaries.c */
144 
145 struct boundary {
146  struct item_bin *ib;
148  char *iso2;
151  struct rect r;
153 };
154 
155 char *osm_tag_value(struct item_bin *ib, char *key);
156 
157 osmid boundary_relid(struct boundary *b);
158 
159 GList *process_boundaries(FILE *boundaries, FILE *ways);
160 
161 GList *boundary_find_matches(GList *bl, struct coord *c);
162 
163 void free_boundaries(GList *l);
164 
165 /* buffer.c */
166 
168 struct buffer {
172  long long malloced;
174  unsigned char *base;
176  long long size;
177 };
178 
179 void save_buffer(char *filename, struct buffer *b, long long offset);
180 void load_buffer(char *filename, struct buffer *b, long long offset, long long size);
181 long long sizeof_buffer(char *filename);
182 
183 /* ch.c */
184 
185 void ch_generate_tiles(char *map_suffix, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info);
186 void ch_assemble_map(char *map_suffix, char *suffix, struct zip_info *zip_info);
187 
188 /* coastline.c */
189 
190 void process_coastlines(FILE *in, FILE *out);
191 
192 /* itembin.c */
193 
194 int item_bin_read(struct item_bin *ib, FILE *in);
195 void item_bin_set_type(struct item_bin *ib, enum item_type type);
196 void item_bin_init(struct item_bin *ib, enum item_type type);
197 void item_bin_add_coord(struct item_bin *ib, struct coord *c, int count);
198 void item_bin_add_coord_reverse(struct item_bin *ib, struct coord *c, int count);
199 void item_bin_bbox(struct item_bin *ib, struct rect *r);
200 void item_bin_copy_coord(struct item_bin *ib, struct item_bin *from, int dir);
201 void item_bin_copy_attr(struct item_bin *ib, struct item_bin *from, enum attr_type attr);
202 void item_bin_add_coord_rect(struct item_bin *ib, struct rect *r);
203 int attr_bin_write_data(struct attr_bin *ab, enum attr_type type, void *data, int size);
204 int attr_bin_write_attr(struct attr_bin *ab, struct attr *attr);
205 void item_bin_add_attr_data(struct item_bin *ib, enum attr_type type, void *data, int size);
206 void item_bin_add_attr(struct item_bin *ib, struct attr *attr);
207 void item_bin_add_attr_int(struct item_bin *ib, enum attr_type type, int val);
208 void *item_bin_get_attr(struct item_bin *ib, enum attr_type type, void *last);
209 struct attr_bin * item_bin_get_attr_bin(struct item_bin *ib, enum attr_type type, void *last);
210 struct attr_bin * item_bin_get_attr_bin_last(struct item_bin *ib);
211 void item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val);
212 void item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str);
213 void item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max);
214 void item_bin_remove_attr(struct item_bin *ib, void *ptr);
215 void item_bin_write(struct item_bin *ib, FILE *out);
216 struct item_bin *item_bin_dup(struct item_bin *ib);
217 void item_bin_write_clipped(struct item_bin *ib, struct tile_parameter *param, struct item_bin_sink *out);
218 void item_bin_dump(struct item_bin *ib, FILE *out);
219 void dump_itembin(struct item_bin *ib);
220 void item_bin_set_type_by_population(struct item_bin *ib, int population);
221 void item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, int maxdepth, FILE *out);
222 int item_bin_sort_file(char *in_file, char *out_file, struct rect *r, int *size);
223 void clip_line(struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out);
224 void clip_polygon(struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out);
226 
227 /* itembin_buffer.c */
228 struct node_item *read_node_item(FILE *in);
229 struct item_bin *read_item(FILE *in);
230 struct item_bin *read_item_range(FILE *in, int *min, int *max);
231 struct item_bin *init_item(enum item_type type);
232 extern struct item_bin *tmp_item_bin;
233 
234 /* maptool.c */
235 
236 extern long long slice_size;
237 extern int attr_debug_level;
238 extern char *suffix;
239 extern int ignore_unknown;
240 extern GHashTable *dedupe_ways_hash;
241 extern int slices;
242 extern struct buffer node_buffer;
244 extern int bytes_read;
245 extern int overlap;
246 extern int unknown_country;
247 extern int experimental;
248 void sig_alrm(int sig);
249 void sig_alrm_end(void);
250 
251 /* misc.c */
252 extern struct rect world_bbox;
253 
254 
255 void bbox_extend(struct coord *c, struct rect *r);
256 void bbox(struct coord *c, int count, struct rect *r);
257 int contains_bbox(int xl, int yl, int xh, int yh, struct rect *r);
258 int bbox_contains_coord(struct rect *r, struct coord *c);
259 int bbox_contains_bbox(struct rect *out, struct rect *in);
260 long long bbox_area(struct rect const *r);
261 void phase1_map(GList *maps, FILE *out_ways, FILE *out_nodes);
262 void dump(FILE *in);
263 int phase4(FILE **in, int in_count, int with_range, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info);
264 int phase5(FILE **in, FILE **references, int in_count, int with_range, char *suffix, struct zip_info *zip_info);
265 void process_binfile(FILE *in, FILE *out);
266 void add_aux_tiles(char *name, struct zip_info *info);
267 void cat(FILE *in, FILE *out);
269 
270 
271 /* osm.c */
272 struct maptool_osm {
273  FILE *boundaries;
277  FILE *nodes;
278  FILE *ways;
279  FILE *line2poi;
280  FILE *poly2poi;
281  FILE *towns;
282 };
283 
290 };
291 
292 void osm_warning(char *type, osmid id, int cont, char *fmt, ...);
293 void osm_info(char *type, osmid id, int cont, char *fmt, ...);
294 void osm_add_tag(char *k, char *v);
295 void osm_add_node(osmid id, double lat, double lon);
296 void osm_add_way(osmid id);
297 void osm_add_relation(osmid id);
298 void osm_end_relation(struct maptool_osm *osm);
299 void osm_add_member(enum relation_member_type type, osmid ref, char *role);
300 void osm_end_way(struct maptool_osm *osm);
301 void osm_end_node(struct maptool_osm *osm);
302 void osm_add_nd(osmid ref);
303 osmid item_bin_get_id(struct item_bin *ib);
304 void flush_nodes(int final);
305 void sort_countries(int keep_tmpfiles);
306 void process_associated_streets(FILE *in, struct files_relation_processing *files_relproc);
307 void process_house_number_interpolations(FILE *in, struct files_relation_processing *files_relproc);
308 void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out);
309 void process_turn_restrictions_old(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out);
310 void clear_node_item_buffer(void);
311 void ref_ways(FILE *in);
312 void resolve_ways(FILE *in, FILE *out);
313 unsigned long long item_bin_get_nodeid(struct item_bin *ib);
314 unsigned long long item_bin_get_wayid(struct item_bin *ib);
315 unsigned long long item_bin_get_relationid(struct item_bin *ib);
316 void process_way2poi(FILE *in, FILE *out, int type);
317 int map_resolve_coords_and_split_at_intersections(FILE *in, FILE *out, FILE *out_index, FILE *out_graph, FILE *out_coastline, int final);
318 void write_countrydir(struct zip_info *zip_info, int max_index_size);
319 void osm_process_towns(FILE *in, FILE *boundaries, FILE *ways, char *suffix);
320 void load_countries(void);
321 void remove_countryfiles(void);
322 struct country_table * country_from_iso2(char *iso);
323 void osm_init(FILE*);
324 
325 /* osm_o5m.c */
326 int map_collect_data_osm_o5m(FILE *in, struct maptool_osm *osm);
327 
328 /* osm_psql.c */
329 int map_collect_data_osm_db(char *dbstr, struct maptool_osm *osm);
330 
331 /* osm_protobuf.c */
332 int map_collect_data_osm_protobuf(FILE *in, struct maptool_osm *osm);
333 int osm_protobufdb_load(FILE *in, char *dir);
334 
335 /* osm_relations.c */
336 struct relations * relations_new(void);
337 struct relations_func *relations_func_new(void (*func)(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv), void *func_priv);
338 void relations_add_relation_member_entry(struct relations *rel, struct relations_func *func, void *relation_priv, void *member_priv, enum relation_member_type type, osmid id);
340 void relations_process(struct relations *rel, FILE *nodes, FILE *ways);
341 void relations_destroy(struct relations *rel);
342 
343 
344 /* osm_xml.c */
345 int osm_xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size);
346 void osm_xml_decode_entities(char *buffer);
347 int map_collect_data_osm(FILE *in, struct maptool_osm *osm);
348 
349 
350 /* sourcesink.c */
351 
352 struct item_bin_sink *item_bin_sink_new(void);
355 void item_bin_sink_add_func(struct item_bin_sink *sink, struct item_bin_sink_func *func);
356 void item_bin_sink_destroy(struct item_bin_sink *sink);
357 int item_bin_write_to_sink(struct item_bin *ib, struct item_bin_sink *sink, struct tile_data *tile_data);
358 struct item_bin_sink *file_reader_new(FILE *in, int limit, int offset);
359 int file_reader_finish(struct item_bin_sink *sink);
360 int file_writer_process(struct item_bin_sink_func *func, struct item_bin *ib, struct tile_data *tile_data);
361 struct item_bin_sink_func *file_writer_new(FILE *out);
362 int file_writer_finish(struct item_bin_sink_func *file_writer);
363 int tile_collector_process(struct item_bin_sink_func *tile_collector, struct item_bin *ib, struct tile_data *tile_data);
365 
366 /* tempfile.c */
367 
368 char *tempfile_name(char *suffix, char *name);
369 FILE *tempfile(char *suffix, char *name, int mode);
370 void tempfile_unlink(char *suffix, char *name);
371 void tempfile_rename(char *suffix, char *from, char *to);
372 
373 /* tile.c */
374 extern GHashTable *tile_hash,*tile_hash2;
375 
376 struct aux_tile {
377  char *name;
378  char *filename;
379  int size;
380 };
381 
382 extern GList *aux_tile_list;
383 
384 int tile(struct rect *r, char *suffix, char *ret, int max, int overlap, struct rect *tr);
385 void tile_bbox(char *tile, struct rect *r, int overlap);
386 int tile_len(char *tile);
387 void load_tilesdir(FILE *in);
388 void tile_write_item_to_tile(struct tile_info *info, struct item_bin *ib, FILE *reference, char *name);
389 void tile_write_item_minmax(struct tile_info *info, struct item_bin *ib, FILE *reference, int min, int max);
390 int add_aux_tile(struct zip_info *zip_info, char *name, char *filename, int size);
391 int write_aux_tiles(struct zip_info *zip_info);
392 int create_tile_hash(void);
393 void write_tilesdir(struct tile_info *info, struct zip_info *zip_info, FILE *out);
394 void merge_tiles(struct tile_info *info);
396 void index_init(struct zip_info *info, int version);
397 void index_submap_add(struct tile_info *info, struct tile_head *th);
398 
399 /* zip.c */
400 void write_zipmember(struct zip_info *zip_info, char *name, int filelen, char *data, int data_size);
401 void zip_write_index(struct zip_info *info);
402 int zip_write_directory(struct zip_info *info);
403 struct zip_info *zip_new(void);
404 void zip_set_zip64(struct zip_info *info, int on);
405 void zip_set_compression_level(struct zip_info *info, int level);
406 void zip_set_maxnamelen(struct zip_info *info, int max);
407 int zip_get_maxnamelen(struct zip_info *info);
408 int zip_add_member(struct zip_info *info);
409 int zip_set_timestamp(struct zip_info *info, char *timestamp);
410 int zip_open(struct zip_info *info, char *out, char *dir, char *index);
411 FILE *zip_get_index(struct zip_info *info);
412 int zip_get_zipnum(struct zip_info *info);
413 void zip_set_zipnum(struct zip_info *info, int num);
414 void zip_close(struct zip_info *info);
415 void zip_destroy(struct zip_info *info);
416 
417 /* Break compilation on 32 bit architectures, as we're going to cast osmid's to gpointer to use them as keys to GHashTable's */
418 struct maptool_force_64 {char s[sizeof(gpointer)<sizeof(osmid)?-1:1];};
void osm_process_towns(FILE *in, FILE *boundaries, FILE *ways, char *suffix)
Definition: osm.c:2228
void ref_ways(FILE *in)
Definition: osm.c:3223
GHashTable * dedupe_ways_hash
Definition: maptool.c:54
attr_type
Definition: attr.h:34
GList ** tiles_list
Definition: maptool.h:55
GList * maps
Definition: map.c:29
void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out)
Definition: osm.c:2969
void write_countrydir(struct zip_info *zip_info, int max_index_size)
Definition: osm.c:3378
Definition: zip.c:28
int size
Definition: maptool.h:379
void dump_itembin(struct item_bin *ib)
Definition: itembin.c:375
int file_reader_finish(struct item_bin_sink *sink)
Definition: sourcesink.c:93
void item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max)
Definition: itembin.c:260
void zip_write_index(struct zip_info *info)
Definition: zip.c:186
void process_house_number_interpolations(FILE *in, struct files_relation_processing *files_relproc)
Definition: osm.c:2733
unsigned long long int nd_id
Definition: maptool.h:118
Definition: maptool.h:98
int maxlen
Definition: maptool.h:53
struct node * nodes
void item_bin_add_coord(struct item_bin *ib, struct coord *c, int count)
Definition: itembin.c:58
struct country_table * country_from_iso2(char *iso)
Definition: osm.c:1681
Definition: maptool.h:59
osmid item_bin_get_id(struct item_bin *ib)
Definition: osm.c:996
int write_aux_tiles(struct zip_info *zip_info)
Definition: tile.c:394
struct rect item_bbox
Definition: maptool.h:40
void write_tilesdir(struct tile_info *info, struct zip_info *zip_info, FILE *out)
Definition: tile.c:526
int offset
Definition: garmin_img.c:69
int max
Definition: maptool.h:46
void ch_generate_tiles(char *map_suffix, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info)
Definition: ch.c:445
struct item_bin_sink * file_reader_new(FILE *in, int limit, int offset)
Definition: sourcesink.c:79
FILE * house_number_interpolations
Definition: maptool.h:276
void tile_write_item_minmax(struct tile_info *info, struct item_bin *ib, FILE *reference, int min, int max)
Definition: tile.c:361
void osm_init(FILE *)
Definition: osm.c:3533
int processed_nodes_out
Definition: maptool.c:68
int size
Definition: garmin_img.c:131
int total_size_used
Definition: maptool.h:64
int num_subtiles
Definition: maptool.h:60
unsigned long long int osmid
Definition: maptool.h:124
Definition: osm_relations.c:25
osmid admin_centre
Definition: maptool.h:152
unsigned char info
Definition: garmin_img.c:539
int processed_tiles
Definition: maptool.c:68
int item_order_by_type(enum item_type type)
Definition: misc.c:170
int attr_bin_write_attr(struct attr_bin *ab, struct attr *attr)
Definition: itembin.c:132
void zip_set_compression_level(struct zip_info *info, int level)
Definition: zip.c:276
struct coord c
Definition: maptool.h:117
void index_init(struct zip_info *info, int version)
Definition: tile.c:663
void dump(FILE *in)
Definition: misc.c:300
GList * aux_tile_list
Definition: tile.c:49
void * priv_data[8]
Definition: maptool.h:108
void zip_destroy(struct zip_info *info)
Definition: zip.c:361
int ignore_unknown
Definition: maptool.c:53
Definition: maptool.h:287
GList * sorted_segments
Definition: maptool.h:149
void osm_add_way(osmid id)
Definition: osm.c:1610
Definition: maptool.h:145
int processed_ways
Definition: maptool.c:68
int tile_collector_process(struct item_bin_sink_func *tile_collector, struct item_bin *ib, struct tile_data *tile_data)
Definition: sourcesink.c:143
long long size
Definition: maptool.h:176
void * priv_data[8]
Definition: maptool.h:112
FILE * poly2poi
Definition: maptool.h:280
int file_writer_process(struct item_bin_sink_func *func, struct item_bin *ib, struct tile_data *tile_data)
Definition: sourcesink.c:116
void zip_set_zipnum(struct zip_info *info, int num)
Definition: zip.c:347
osmid boundary_relid(struct boundary *b)
Definition: boundaries.c:47
Definition: garmin_img.c:513
void osm_add_relation(osmid id)
Definition: osm.c:1638
long long malloced
Definition: maptool.h:172
struct rect tile_bbox
Definition: maptool.h:41
struct attr_bin * item_bin_get_attr_bin(struct item_bin *ib, enum attr_type type, void *last)
Definition: itembin.c:210
int bbox_contains_coord(struct rect *r, struct coord *c)
Definition: misc.c:100
struct buffer node_buffer
Definition: maptool.c:64
int attr_debug_level
Definition: maptool.c:52
FILE * nodes2_in
Definition: maptool.h:139
void item_bin_add_attr_int(struct item_bin *ib, enum attr_type type, int val)
Definition: itembin.c:185
int malloced_step
Definition: maptool.h:170
struct item_bin * init_item(enum item_type type)
Definition: itembin_buffer.c:71
void osm_add_member(enum relation_member_type type, osmid ref, char *role)
Definition: osm.c:1714
void sig_alrm(int sig)
Definition: maptool.c:196
item_type
Definition: item.h:29
char * suffix
FILE * index
Definition: zip.c:38
Definition: maptool.h:376
void tile_write_item_to_tile(struct tile_info *info, struct item_bin *ib, FILE *reference, char *name)
Definition: tile.c:352
void process_turn_restrictions_old(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out)
int len
Definition: maptool.h:84
Definition: maptool.h:82
FILE * boundaries
Definition: maptool.h:273
struct zip_info * zip_new(void)
Definition: zip.c:264
void remove_countryfiles(void)
Definition: osm.c:3512
Definition: maptool.h:289
int tile_len(char *tile)
Definition: tile.c:176
struct item_bin * tmp_item_bin
Definition: itembin_buffer.c:28
int zip_get_zipnum(struct zip_info *info)
Definition: zip.c:341
Definition: maptool.h:106
Definition: maptool.h:111
int tile_depth
Definition: maptool.h:39
long long sizeof_buffer(char *filename)
Definition: buffer.c:68
Definition: maptool.h:134
int map_collect_data_osm_o5m(FILE *in, struct maptool_osm *osm)
Definition: osm_o5m.c:173
void zip_close(struct zip_info *info)
Definition: zip.c:353
void process_way2poi(FILE *in, FILE *out, int type)
Definition: osm.c:3265
void relations_add_relation_default_entry(struct relations *rel, struct relations_func *func)
Definition: osm_relations.c:118
A map tile, a rectangular region of the world.
Definition: binfile.c:64
int processed_relations
Definition: maptool.c:68
int bytes_read
Definition: maptool.c:72
void osm_add_node(osmid id, double lat, double lon)
Definition: osm.c:1416
struct attr_bin * item_bin_get_attr_bin_last(struct item_bin *ib)
Definition: itembin.c:226
Definition: navigation.c:111
Definition: maptool.h:286
struct item_bin * read_item_range(FILE *in, int *min, int *max)
Definition: itembin_buffer.c:59
GList * sink_funcs
Definition: maptool.h:113
FILE * nodes_out
Definition: maptool.h:138
char s[sizeof(gpointer)< sizeof(osmid)?-1:1]
Definition: maptool.h:418
enum attr_type attr_to_copy
Definition: maptool.h:48
long long slice_size
Definition: maptool.c:51
struct tile_head * next
Definition: maptool.h:67
FILE * nodes_in
Definition: maptool.h:137
FILE * zip_get_index(struct zip_info *info)
Definition: zip.c:335
static int match(struct country_search *this_, enum attr_type type, const char *name)
Definition: country.c:384
unsigned long long item_bin_get_wayid(struct item_bin *ib)
Definition: osm.c:978
void osm_info(char *type, osmid id, int cont, char *fmt,...)
Definition: osm.c:914
int contains_bbox(int xl, int yl, int xh, int yh, struct rect *r)
Definition: misc.c:82
int clen
Definition: maptool.h:88
int mode
Definition: graphics_win32.c:59
void item_bin_add_coord_reverse(struct item_bin *ib, struct coord *c, int count)
Definition: itembin.c:68
struct attr map_information_attrs[32]
Definition: maptool.h:395
GHashTable * tile_hash
Definition: tile.c:51
void(* func)(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
Definition: osm_relations.c:33
void clip_polygon(struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out)
Definition: itembin.c:670
int file_writer_finish(struct item_bin_sink_func *file_writer)
Definition: sourcesink.c:135
long long bbox_area(struct rect const *r)
Definition: misc.c:128
int map_collect_data_osm_protobuf(FILE *in, struct maptool_osm *osm)
Definition: osm_protobuf.c:353
int osm_protobufdb_load(FILE *in, char *dir)
Definition: osm_protobufdb.c:810
void process_binfile(FILE *in, FILE *out)
Definition: misc.c:422
void item_bin_dump(struct item_bin *ib, FILE *out)
Definition: itembin.c:337
void item_bin_init(struct item_bin *ib, enum item_type type)
Definition: itembin.c:49
relation_member_type
Definition: maptool.h:285
void cat(FILE *in, FILE *out)
char * osm_tag_value(struct item_bin *ib, char *key)
Definition: boundaries.c:27
void bbox(struct coord *c, int count, struct rect *r)
Definition: misc.c:69
void item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val)
Definition: itembin.c:240
Definition: maptool.h:37
char filename[8]
Definition: garmin_img.c:129
void item_bin_add_attr_data(struct item_bin *ib, enum attr_type type, void *data, int size)
Definition: itembin.c:138
int unknown_country
Definition: maptool.c:57
unsigned long long item_bin_get_nodeid(struct item_bin *ib)
Definition: osm.c:972
#define max(a, b)
Definition: garmin.c:722
void relations_process(struct relations *rel, FILE *nodes, FILE *ways)
Definition: osm_relations.c:134
unsigned char * base
Definition: maptool.h:174
void write_zipmember(struct zip_info *zip_info, char *name, int filelen, char *data, int data_size)
Definition: zip.c:83
int zipnum
Definition: maptool.h:65
FILE * tempfile(char *suffix, char *name, int mode)
Definition: tempfile.c:32
struct geom_poly_segment * item_bin_to_poly_segment(struct item_bin *ib, int type)
Definition: itembin.c:612
void osm_end_relation(struct maptool_osm *osm)
Definition: osm.c:1688
void relations_add_relation_member_entry(struct relations *rel, struct relations_func *func, void *relation_priv, void *member_priv, enum relation_member_type type, osmid id)
Definition: osm_relations.c:100
void ch_assemble_map(char *map_suffix, char *suffix, struct zip_info *zip_info)
Definition: ch.c:480
void flush_nodes(int final)
Definition: osm.c:1387
GList * process_boundaries(FILE *boundaries, FILE *ways)
Definition: boundaries.c:346
enum item_type type
Definition: maptool.h:86
void item_bin_copy_coord(struct item_bin *ib, struct item_bin *from, int dir)
Definition: itembin.c:91
void load_countries(void)
Definition: osm.c:3478
Definition: osm_relations.c:32
int total_size
Definition: maptool.h:61
FILE * line2poi
Definition: maptool.h:279
int item_bin_write_to_sink(struct item_bin *ib, struct item_bin_sink *sink, struct tile_data *tile_data)
Definition: sourcesink.c:64
unsigned char key
Definition: tree.c:65
int phase4(FILE **in, int in_count, int with_range, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info)
Definition: misc.c:309
int phase5(FILE **in, FILE **references, int in_count, int with_range, char *suffix, struct zip_info *zip_info)
Definition: misc.c:374
void sort_countries(int keep_tmpfiles)
Definition: osm.c:2363
int map_resolve_coords_and_split_at_intersections(FILE *in, FILE *out, FILE *out_index, FILE *out_graph, FILE *out_coastline, int final)
Definition: osm.c:3299
struct rect world_bbox
Definition: misc.c:50
int overlap
Definition: maptool.h:47
void osm_warning(char *type, osmid id, int cont, char *fmt,...)
Definition: osm.c:905
char data
Definition: garmin_img.c:354
Definition: osm.c:138
void save_buffer(char *filename, struct buffer *b, long long offset)
Definition: buffer.c:25
void tempfile_rename(char *suffix, char *from, char *to)
Definition: tempfile.c:60
Definition: attr.h:156
void add_aux_tiles(char *name, struct zip_info *info)
Definition: misc.c:431
void item_bin_bbox(struct item_bin *ib, struct rect *r)
Definition: itembin.c:76
int item_bin_read(struct item_bin *ib, FILE *in)
Definition: itembin.c:31
void item_bin_write(struct item_bin *ib, FILE *out)
Definition: itembin.c:270
void item_bin_add_attr(struct item_bin *ib, struct attr *attr)
Definition: itembin.c:145
void zip_set_maxnamelen(struct zip_info *info, int max)
Definition: zip.c:282
void resolve_ways(FILE *in, FILE *out)
Definition: osm.c:3233
void relations_destroy(struct relations *rel)
Definition: osm_relations.c:191
void osm_end_way(struct maptool_osm *osm)
Definition: osm.c:1799
Definition: maptool.h:116
int write
Definition: maptool.h:52
void phase1_map(GList *maps, FILE *out_ways, FILE *out_nodes)
Definition: misc.c:134
void tile_bbox(char *tile, struct rect *r, int overlap)
Definition: tile.c:143
void * item_bin_get_attr(struct item_bin *ib, enum attr_type type, void *last)
Definition: itembin.c:194
void zip_set_zip64(struct zip_info *info, int on)
Definition: zip.c:270
void * func_priv
Definition: osm_relations.c:34
char * iso2
Definition: maptool.h:148
int bbox_contains_bbox(struct rect *out, struct rect *in)
Definition: misc.c:114
Definition: geom.h:47
int processed_nodes
Definition: maptool.c:68
void process_coastlines(FILE *in, FILE *out)
Definition: coastline.c:659
char * suffix
Definition: maptool.h:54
void item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str)
Definition: itembin.c:249
FILE * nodes2_out
Definition: maptool.h:140
int create_tile_hash(void)
Definition: tile.c:449
int add_aux_tile(struct zip_info *zip_info, char *name, char *filename, int size)
Definition: tile.c:372
void merge_tiles(struct tile_info *info)
Definition: tile.c:590
static unsigned char limit[]
Definition: street.c:405
void item_bin_sink_destroy(struct item_bin_sink *sink)
Definition: sourcesink.c:56
void item_bin_copy_attr(struct item_bin *ib, struct item_bin *from, enum attr_type attr)
Definition: itembin.c:104
int zip_open(struct zip_info *info, char *out, char *dir, char *index)
Definition: zip.c:314
FILE * ways_in
Definition: maptool.h:135
void item_bin_write_match(struct item_bin *ib, enum attr_type type, enum attr_type match, int maxdepth, FILE *out)
Definition: itembin.c:461
int zip_get_maxnamelen(struct zip_info *info)
Definition: zip.c:288
int tile(struct rect *r, char *suffix, char *ret, int max, int overlap, struct rect *tr)
Definition: tile.c:77
void item_bin_set_type_by_population(struct item_bin *ib, int population)
Definition: itembin.c:438
struct item_bin_sink * item_bin_sink_new(void)
Definition: sourcesink.c:28
void item_bin_sink_func_destroy(struct item_bin_sink_func *func)
Definition: sourcesink.c:44
void item_bin_add_coord_rect(struct item_bin *ib, struct rect *r)
Definition: itembin.c:114
char * zip_data
Definition: maptool.h:63
struct tile_head * tile_head_root
int overlap
Definition: maptool.c:70
Definition: garmin_img.c:84
struct triple lng lat
Definition: garmin_img.c:498
Definition: geom.h:35
Definition: maptool.h:51
Definition: maptool.h:44
char * tempfile_name(char *suffix, char *name)
Definition: tempfile.c:27
void clear_node_item_buffer(void)
Definition: osm.c:1457
FILE * turn_restrictions
Definition: maptool.h:274
void index_submap_add(struct tile_info *info, struct tile_head *th)
Definition: tile.c:679
void osm_end_node(struct maptool_osm *osm)
Definition: osm.c:1899
int item_bin_sort_file(char *in_file, char *out_file, struct rect *r, int *size)
Definition: itembin.c:564
FILE * associated_streets
Definition: maptool.h:275
void load_buffer(char *filename, struct buffer *b, long long offset, long long size)
Definition: buffer.c:39
FILE * ways_out
Definition: maptool.h:136
char * name
Definition: maptool.h:62
void sig_alrm_end(void)
Definition: maptool.c:205
static int buffer_size
Definition: vehicle_file.c:81
void item_bin_sink_add_func(struct item_bin_sink *sink, struct item_bin_sink_func *func)
Definition: sourcesink.c:50
GList * segments
Definition: maptool.h:149
char * version
Definition: main.c:31
Definition: maptool.h:168
int map_collect_data_osm(FILE *in, struct maptool_osm *osm)
Definition: osm_xml.c:189
void tempfile_unlink(char *suffix, char *name)
Definition: tempfile.c:52
FILE * towns
Definition: maptool.h:281
FILE * nodes
Definition: maptool.h:277
int slices
Definition: maptool.c:56
struct item_bin * read_item(FILE *in)
Definition: itembin_buffer.c:41
char * filename
Definition: maptool.h:378
void load_tilesdir(FILE *in)
Definition: tile.c:485
struct rect r
Definition: maptool.h:151
int min
Definition: maptool.h:45
int osm_xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size)
Definition: osm_xml.c:30
void process_associated_streets(FILE *in, struct files_relation_processing *files_relproc)
Definition: osm.c:2680
int process
Definition: maptool.h:66
FILE * dir
Definition: zip.c:39
void free_boundaries(GList *l)
Definition: boundaries.c:358
typedef int(WINAPI *FP_SetStretchBltMode)(HDC dc
char type[3]
Definition: garmin_img.c:130
Definition: coord.h:34
char * name
Definition: maptool.h:377
char ref_way
Definition: maptool.h:119
int len
Definition: maptool.h:100
void item_bin_set_type(struct item_bin *ib, enum item_type type)
Definition: itembin.c:43
enum attr_type type
Definition: maptool.h:102
struct country_table * country
Definition: maptool.h:147
char name[0]
Definition: street.c:559
FILE * ways
Definition: maptool.h:278
Definition: maptool.h:272
struct item_bin_sink_func * tile_collector_new(struct item_bin_sink *out)
Definition: sourcesink.c:161
struct item_bin * item_bin_dup(struct item_bin *ib)
Definition: itembin.c:276
unsigned long long item_bin_get_relationid(struct item_bin *ib)
Definition: osm.c:987
int zip_write_directory(struct zip_info *info)
Definition: zip.c:208
Definition: maptool.h:288
void osm_add_tag(char *k, char *v)
Definition: osm.c:1044
struct node_item * read_node_item(FILE *in)
Definition: itembin_buffer.c:33
int map_collect_data_osm_db(char *dbstr, struct maptool_osm *osm)
int zip_set_timestamp(struct zip_info *info, char *timestamp)
Definition: zip.c:301
GList * children
Definition: maptool.h:150
#define NODE_ID_BITS
Definition: maptool.h:115
void clip_line(struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out)
Definition: itembin.c:624
struct item_bin_sink_func * item_bin_sink_func_new(int(*func)(struct item_bin_sink_func *func, struct item_bin *ib, struct tile_data *tile_data))
Definition: sourcesink.c:36
void osm_add_nd(osmid ref)
Definition: osm.c:3169
int(* func)(struct item_bin_sink_func *func, struct item_bin *ib, struct tile_data *tile_data)
Definition: maptool.h:107
int experimental
Definition: maptool.c:62
void bbox_extend(struct coord *c, struct rect *r)
Definition: misc.c:56
void item_bin_remove_attr(struct item_bin *ib, void *ptr)
Definition: itembin.c:168
int attr_bin_write_data(struct attr_bin *ab, enum attr_type type, void *data, int size)
Definition: itembin.c:121
int zip_add_member(struct zip_info *info)
Definition: zip.c:294
Definition: maptool.h:418
GHashTable * tile_hash2
Definition: tile.c:51
FILE * tilesdir_out
Definition: maptool.h:56
struct relations * relations_new(void)
Definition: osm_relations.c:59
struct item_bin_sink_func * file_writer_new(FILE *out)
Definition: sourcesink.c:124
struct item_bin * ib
Definition: maptool.h:146
struct relations_func * relations_func_new(void(*func)(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv), void *func_priv)
Definition: osm_relations.c:70
void item_bin_write_clipped(struct item_bin *ib, struct tile_parameter *param, struct item_bin_sink *out)
Definition: itembin.c:286
GList * boundary_find_matches(GList *bl, struct coord *c)
Definition: boundaries.c:163
void osm_xml_decode_entities(char *buffer)
Definition: osm_xml.c:75