diff options
author | zaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-10 21:19:42 +0000 |
---|---|---|
committer | zaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-10 21:19:42 +0000 |
commit | 1a6398e9ec4eeaf0f521e017f6f24eae2585aae8 (patch) | |
tree | 74e33cd04245c228866f1656dc9ce95ad0c4a86b | |
parent | 3419e90421993f98c4968d48fdfbc141d6963f45 (diff) | |
download | navit-1a6398e9ec4eeaf0f521e017f6f24eae2585aae8.tar.gz |
Add:garmin:Get object group for type conversion and add option flags
in config to set the debugmask which will be used to enable
experimental code.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1452 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/data/garmin/gar2navit.c | 3 | ||||
-rw-r--r-- | navit/data/garmin/garmin.c | 25 |
2 files changed, 21 insertions, 7 deletions
diff --git a/navit/data/garmin/gar2navit.c b/navit/data/garmin/gar2navit.c index aa7d93c20..7c4450401 100644 --- a/navit/data/garmin/gar2navit.c +++ b/navit/data/garmin/gar2navit.c @@ -156,6 +156,8 @@ enum item_type g2n_get_type(struct gar2nav_conv *c, unsigned int type, unsigned { struct gar2navit *def = NULL; int group; + group = (type >> G2N_KIND_SHIFT); + type &= ~G2N_KIND_MASK; if (type == G2N_POINT) def = c->points; else if (type == G2N_POLYLINE) @@ -172,7 +174,6 @@ enum item_type g2n_get_type(struct gar2nav_conv *c, unsigned int type, unsigned return type_none; } - group = (type >> G2N_KIND_SHIFT); while (def) { if (def->group == group && ((!def->maxid && def->id == id) || diff --git a/navit/data/garmin/garmin.c b/navit/data/garmin/garmin.c index c9b038192..aa5588b09 100644 --- a/navit/data/garmin/garmin.c +++ b/navit/data/garmin/garmin.c @@ -437,8 +437,10 @@ static struct item_methods methods_garmin_poly = { static struct item * garmin_poi2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype) { - if (mr->mpriv->conv) - mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POINT, otype); + if (mr->mpriv->conv) { + int mask = gar_object_group(o) << G2N_KIND_SHIFT; + mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POINT|mask, otype); + } mr->item.meth = &methods_garmin_point; return &mr->item; } @@ -446,8 +448,10 @@ garmin_poi2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otyp static struct item * garmin_pl2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype) { - if (mr->mpriv->conv) - mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYLINE, otype); + if (mr->mpriv->conv) { + int mask = gar_object_group(o) << G2N_KIND_SHIFT; + mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYLINE|mask, otype); + } mr->item.meth = &methods_garmin_poly; return &mr->item; } @@ -455,8 +459,10 @@ garmin_pl2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype static struct item * garmin_pg2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype) { - if (mr->mpriv->conv) - mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYGONE, otype); + if (mr->mpriv->conv) { + int mask = gar_object_group(o) << G2N_KIND_SHIFT; + mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYGONE|mask, otype); + } mr->item.meth = &methods_garmin_poly; return &mr->item; } @@ -745,10 +751,12 @@ gmap_new(struct map_methods *meth, struct attr **attrs) struct map_priv *m; struct attr *data; struct attr *debug; + struct attr *flags; char buf[PATH_MAX]; struct stat st; int dl = 1; struct gar_config cfg; + int debugmask = 0; data=attr_search(attrs, NULL, attr_data); if (! data) @@ -759,6 +767,10 @@ gmap_new(struct map_methods *meth, struct attr **attrs) if (!dl) dl = 1; } + flags=attr_search(attrs, NULL, attr_flags); + if (flags) { + debugmask = flags->u.num; + } m=g_new(struct map_priv, 1); m->id=++map_id; m->filename = strdup(data->u.str); @@ -769,6 +781,7 @@ gmap_new(struct map_methods *meth, struct attr **attrs) memset(&cfg, 0, sizeof(struct gar_config)); cfg.opm = OPM_GPS; cfg.debuglevel = dl; + cfg.debugmask = debugmask; garmin_debug = dl; m->g = gar_init_cfg(NULL, logfn, &cfg); if (!m->g) { |