Logo Search packages:      
Sourcecode: navit version File versions

struct map* map_new ( struct attr *  parent,
struct attr **  attrs 
) [read]

Opens a new map.

This function opens a new map based on the attributes passed. This function takes the attribute "attr_type" to determine which type of map to open and passes all attributes to the map plugin's function that was specified in the plugin_register_new_map_type()-call.

Note that every plugin should accept an attribute of type "attr_data" to be passed with the filename of the map to be opened as value.

attrs Attributes specifying which map to open, see description
The opened map or NULL on failure

Definition at line 91 of file map.c.

References map::attr_cbl, map::attrs, map::meth, and map::priv.

      struct map *m;
      struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs);
      struct attr *type=attr_search(attrs, NULL, attr_type);

      if (! type) {
            dbg(0,"missing type\n");
            return NULL;
      if (! maptype_new) {
            dbg(0,"invalid type '%s'\n", type->u.str);
            return NULL;

      m=g_new0(struct map, 1);
      m->priv=maptype_new(&m->meth, attrs);
      if (! m->priv) {
      if (m)
      return m;

Generated by  Doxygen 1.6.0   Back to index