From 931889b8daf18a31a2281e5a291b23e3a8aeec01 Mon Sep 17 00:00:00 2001 From: martin-s Date: Wed, 15 Oct 2008 14:11:45 +0000 Subject: Add:Core:Added function to dump map into textfile git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1472 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/map.c | 24 ++++++++++++++++++++++++ navit/navit/map.h | 1 + 2 files changed, 25 insertions(+) (limited to 'navit/navit') diff --git a/navit/navit/map.c b/navit/navit/map.c index d8a8e199e..dbb25e755 100644 --- a/navit/navit/map.c +++ b/navit/navit/map.c @@ -577,3 +577,27 @@ map_priv_is(struct map *map, struct map_priv *priv) { return (map->priv == priv); } + +void +map_dump(struct map *map) +{ + struct map_rect *mr=map_rect_new(map, NULL); + struct item *item; + int i,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); + if (item->type < type_line) + printf("mg:0x%x 0x%x ", ca[0].x, ca[0].y); + printf("%s", item_to_name(item->type)); + while (item_attr_get(item, attr_any, &attr)) + printf(" %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1)); + printf("\n"); + if (item->type >= type_line) + for (i = 0 ; i < count ; i++) + printf("mg:0x%x 0x%x\n", ca[i].x, ca[i].y); + } + map_rect_destroy(mr); +} diff --git a/navit/navit/map.h b/navit/navit/map.h index 586ff3ede..4026ab6b7 100644 --- a/navit/navit/map.h +++ b/navit/navit/map.h @@ -251,6 +251,7 @@ struct map_selection *map_selection_dup(struct map_selection *sel); void map_selection_destroy(struct map_selection *sel); int map_selection_contains_item_rect(struct map_selection *sel, struct item *item); int map_priv_is(struct map *map, struct map_priv *priv); +void map_dump(struct map *map); /* end of prototypes */ #endif -- cgit v1.2.1