3 #include <glib/gprintf.h>
7 #include "projection.h"
14 struct mapset *mapset_new(void)
18 ms=g_new0(struct mapset, 1);
23 void mapset_add(struct mapset *ms, struct map *m)
25 ms->maps=g_list_append(ms->maps, m);
29 static void mapset_maps_free(struct mapset *ms)
35 void mapset_destroy(struct mapset *ms)
40 struct mapset_handle {
44 struct mapset_handle *
45 mapset_open(struct mapset *ms)
47 struct mapset_handle *ret;
49 ret=g_new(struct mapset_handle, 1);
55 struct map * mapset_next(struct mapset_handle *msh, int active)
63 msh->l=g_list_next(msh->l);
64 if (!active || map_get_active(ret))
70 mapset_close(struct mapset_handle *msh)
75 struct mapset_search {
77 struct map_search *ms;
79 struct attr *search_attr;
83 struct mapset_search *
84 mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial)
86 struct mapset_search *this;
87 dbg(1,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
88 this=g_new0(struct mapset_search,1);
91 this->search_attr=search_attr;
92 this->partial=partial;
93 this->ms=map_search_new(this->map->data, item, search_attr, partial);
98 mapset_search_get_item(struct mapset_search *this)
101 while (!(ret=map_search_get_item(this->ms))) {
102 if (this->search_attr->type >= attr_country_all && this->search_attr->type <= attr_country_name)
105 this->map=g_list_next(this->map);
106 } while (this->map && ! map_get_active(this->map->data));
109 map_search_destroy(this->ms);
110 this->ms=map_search_new(this->map->data, this->item, this->search_attr, this->partial);
116 mapset_search_destroy(struct mapset_search *this)
118 map_search_destroy(this->ms);