void ch_generate_tiles(char *map_suffix, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info) { struct tile_info info; FILE *in,*ref,*ddsg_coords,*ddsg; FILE **graphfiles; info.write=0; info.maxlen=0; info.suffix=suffix; info.tiles_list=NULL; info.tilesdir_out=tilesdir_out; graphfiles=g_alloca(sizeof(FILE*)*(ch_levels+1)); ch_create_tempfiles(suffix, graphfiles, ch_levels, 1); in=tempfile(map_suffix,"ways_split",0); ref=tempfile(map_suffix,"ways_split_ref",0); ddsg_coords=tempfile(suffix,"ddsg_coords",1); ddsg=tempfile(suffix,"ddsg",1); ch_generate_ddsg(in, ref, ddsg_coords, ddsg); fclose(in); fclose(ref); fclose(ddsg_coords); fclose(ddsg); ch_generate_sgr(suffix); ch_setup(suffix); ch_process(graphfiles, ch_levels, 0); ch_close_tempfiles(graphfiles, ch_levels); tile_hash=g_hash_table_new(g_str_hash, g_str_equal); ch_copy_to_tiles(suffix, ch_levels, &info, NULL); merge_tiles(&info); write_tilesdir(&info, zip_info, tilesdir_out); }
static int phase34(struct tile_info *info, struct zip_info *zip_info, FILE **in, FILE **reference, int in_count, int with_range) { int i; processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0; bytes_read=0; sig_alrm(0); if (! info->write) tile_hash=g_hash_table_new(g_str_hash, g_str_equal); for (i = 0 ; i < in_count ; i++) { if (in[i]) { if (with_range) phase34_process_file_range(info, in[i], reference ? reference[i]:NULL); else phase34_process_file(info, in[i], reference ? reference[i]:NULL); } } if (! info->write) merge_tiles(info); sig_alrm(0); sig_alrm_end(); write_tilesdir(info, zip_info, info->tilesdir_out); return 0; }