summaryrefslogtreecommitdiff
path: root/navit/track.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-03-10 12:10:34 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-03-10 12:10:34 +0000
commit46fa1c1bc075f5e88512fdf7ed8517230bcceed1 (patch)
tree17646c9856aae26fa504451352c8577295927502 /navit/track.c
parent65fdfb74ba0ad25f99e76bde7627af7680074191 (diff)
downloadnavit-46fa1c1bc075f5e88512fdf7ed8517230bcceed1.tar.gz
Add:core:Better attribute support for tracking
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2990 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/track.c')
-rw-r--r--navit/track.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/navit/track.c b/navit/track.c
index 769fa144e..21ecb2283 100644
--- a/navit/track.c
+++ b/navit/track.c
@@ -35,6 +35,7 @@
#include "vehicleprofile.h"
#include "vehicle.h"
#include "util.h"
+#include "config.h"
struct tracking_line
{
@@ -338,6 +339,9 @@ tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr
case attr_position_speed:
attr->u.numd=&_this->speed;
return 1;
+ case attr_directed:
+ attr->u.num=_this->street_direction;
+ return 1;
case attr_position_coord_geo:
if (!_this->coord_geo_valid) {
struct coord c;
@@ -348,6 +352,11 @@ tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr
}
attr->u.coord_geo=&_this->coord_geo;
return 1;
+ case attr_current_item:
+ if (! _this->curr_line || ! _this->curr_line->street)
+ return 0;
+ attr->u.item=&_this->curr_line->street->item;
+ return 1;
default:
if (! _this->curr_line || ! _this->curr_line->street)
return 0;
@@ -549,11 +558,15 @@ tracking_is_no_stop(struct coord *c1, struct coord *c2)
static int
tracking_is_on_route(struct route *rt, struct item *item)
{
+#ifdef USE_ROUTING
if (! rt)
return 0;
if (route_contains(rt, item))
return 0;
return route_pref;
+#else
+ return 0;
+#endif
}
static int
@@ -668,6 +681,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
dbg(1,"update end\n");
}
+ tr->street_direction=0;
t=tr->lines;
tr->curr_line=NULL;
min=INT_MAX/2;
@@ -706,6 +720,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
if (!tr->curr_line || min > offroad_limit_pref) {
tr->curr_out=tr->curr_in;
tr->coord_geo_valid=0;
+ tr->street_direction=0;
}
dbg(1,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y);
}