示例#1
0
文件: misc.c 项目: Jalakas/navit
void
phase1_map(GList *maps, FILE *out_ways, FILE *out_nodes)
{
	struct map_rect *mr;
	struct item *item;
	int count;
	struct coord ca[phase1_coord_max];
	struct attr attr;
	struct item_bin *item_bin;

	while (maps) {
		mr=map_rect_new(maps->data, NULL);
		while ((item = map_rect_get_item(mr))) {
			count=item_coord_get(item, ca, item->type < type_line ? 1: phase1_coord_max);
			item_bin=init_item(item->type);
			item_bin_add_coord(item_bin, ca, count);
			while (item_attr_get(item, attr_any, &attr)) {
				if (attr.type >= attr_type_string_begin && attr.type <= attr_type_string_end) {
					attr.u.str=map_convert_string(maps->data, attr.u.str);
					if (attr.u.str) {
						item_bin_add_attr(item_bin, &attr);
						map_convert_free(attr.u.str);
					}
				} else 
					item_bin_add_attr(item_bin, &attr);
			}
			if (item->type >= type_line) 
				item_bin_write(item_bin, out_ways);
			else
				item_bin_write(item_bin, out_nodes);
		}
		map_rect_destroy(mr);
		maps=g_list_next(maps);
	}
}
示例#2
0
文件: misc.c 项目: justinzane/navit
void
phase1_map(struct map *map, FILE *out_ways, FILE *out_nodes)
{
	struct map_rect *mr=map_rect_new(map, NULL);
	struct item *item;
	int count,max=16384;
	struct coord ca[max];
	struct attr attr;

	while ((item = map_rect_get_item(mr))) {
		count=item_coord_get(item, ca, item->type < type_line ? 1: max);
		item_bin_init(item_bin, item->type);
		item_bin_add_coord(item_bin, ca, count);
		while (item_attr_get(item, attr_any, &attr)) {
			if (attr.type >= attr_type_string_begin && attr.type <= attr_type_string_end) {
				attr.u.str=map_convert_string(map, attr.u.str);
				item_bin_add_attr(item_bin, &attr);
				map_convert_free(attr.u.str);
			} else 
				item_bin_add_attr(item_bin, &attr);
		}
		if (item->type >= type_line) 
			item_bin_write(item_bin, out_ways);
		else
			item_bin_write(item_bin, out_nodes);
	}
	map_rect_destroy(mr);
}
示例#3
0
文件: itembin.c 项目: Jalakas/navit
void
item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val)
{
	struct attr attr;
	attr.type=type;
	attr.u.num64=&val;
	item_bin_add_attr(ib, &attr);
}
示例#4
0
文件: itembin.c 项目: Jalakas/navit
void
item_bin_add_attr_int(struct item_bin *ib, enum attr_type type, int val)
{
	struct attr attr;
	attr.type=type;
	attr.u.num=val;
	item_bin_add_attr(ib, &attr);
}
示例#5
0
文件: itembin.c 项目: Jalakas/navit
void
item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max)
{
	struct attr attr;
	attr.type=type;
	attr.u.range.min=min;
	attr.u.range.max=max;
	item_bin_add_attr(ib, &attr);
}
示例#6
0
文件: itembin.c 项目: Jalakas/navit
void
item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str)
{
	struct attr attr;
	if (! str)
		return;
	attr.type=type;
	attr.u.str=str;
	item_bin_add_attr(ib, &attr);
}
示例#7
0
void
index_init(struct zip_info *info, int version)
{
    struct item_bin *item_bin;
    int i;
    map_information_attrs[0].type=attr_version;
    map_information_attrs[0].u.num=version;
    item_bin=init_item(type_map_information);
    for (i = 0 ; i < 32 ; i++) {
        if (!map_information_attrs[i].type)
            break;
        item_bin_add_attr(item_bin, &map_information_attrs[i]);
    }
    item_bin_write(item_bin, zip_get_index(info));
}