diff options
author | OLFDB <olf@eisenzelt.de> | 2021-03-07 09:40:47 +0100 |
---|---|---|
committer | OLFDB <olf@eisenzelt.de> | 2021-03-07 09:40:47 +0100 |
commit | e03f0acb5f5c0c3066d080edded2b38babf94f2d (patch) | |
tree | 06a0db55ae3904684aa2faaa40a39d31a9273c91 | |
parent | e64c4b5e6ed7d0f5f14735b6a182cc4ded8aea0f (diff) | |
download | navit-e03f0acb5f5c0c3066d080edded2b38babf94f2d.tar.gz |
Use tracking_get_current_tunnel to access tracking object
-rw-r--r-- | navit/navit.c | 11 | ||||
-rw-r--r-- | navit/track.c | 63 | ||||
-rw-r--r-- | navit/track.h | 58 |
3 files changed, 66 insertions, 66 deletions
diff --git a/navit/navit.c b/navit/navit.c index a4ab0b62f..14b5f26b1 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -3499,7 +3499,7 @@ void navit_layout_switch(struct navit *n) { int year, month, day; int after_sunrise = FALSE; int after_sunset = FALSE; - int *streetflags = tracking_get_current_flags(n->tracking); + int tunnel = tracking_get_current_tunnel(n->tracking); if (navit_get_attr(n,attr_layout,&layout_attr,NULL)!=1) { return; //No layout - nothing to switch @@ -3522,9 +3522,7 @@ void navit_layout_switch(struct navit *n) { return; if (n->tunnel_nightlayout) { - - if (n->tracking->tunnel) { - + if (tunnel) { // store the current layout name if(!strcmp(n->layout_before_tunnel, "")) n->layout_before_tunnel = n->layout_current->name; @@ -3534,13 +3532,10 @@ void navit_layout_switch(struct navit *n) { navit_set_layout_by_name(n, l->nightname); dbg(lvl_debug, "tunnel -> nightlayout"); } - return; } else { - if (l->dayname) { - if (!strcmp(l->dayname, n->layout_before_tunnel)) { // restore previous layout navit_set_layout_by_name(n, l->dayname); @@ -3550,10 +3545,8 @@ void navit_layout_switch(struct navit *n) { // We were in nightlayout before the tunnel, keep it n->layout_before_tunnel=""; return; - } } - } if (currTs-(n->prevTs)<60) { diff --git a/navit/track.c b/navit/track.c index fafefef22..b729c329a 100644 --- a/navit/track.c +++ b/navit/track.c @@ -61,6 +61,64 @@ struct cdf_speed { time_t time; }; +/** + * @brief Contains data for the CDF + * + * This structure holds all data needed by the + * cumulative displacement filter. + */ +struct cdf_data { + int extrapolating; + int available; + int first_pos; + int poscount; + int hist_size; + struct cdf_speed *speed_hist; + struct pcoord *pos_hist; + int *dir_hist; + double last_dist; + struct pcoord last_out; + int last_dir; +}; + +struct tracking { + NAVIT_OBJECT + struct callback_list *callback_list; /**< Callbacks which will be called whenever the position changes */ + struct mapset *ms; /**< The mapset */ + struct route *rt; /**< The route */ + struct map *map; /**< The tracking map which holds our past movements */ + struct vehicle *vehicle; /**< The vehicle from which we are obtaining location data */ + struct vehicleprofile *vehicleprofile; /**< The current vehicle profile */ + struct coord last_updated; + struct tracking_line *lines; + struct tracking_line *curr_line; + int pos; + struct coord curr[2], curr_in, curr_out; + int curr_angle; + struct coord last[2], last_in, last_out; + struct cdf_data cdf; + struct attr *attr; + int valid; /**< Whether we have valid location data */ + int time; + double direction, direction_matched; + double speed; /**< Current speed */ + int coord_geo_valid; + struct coord_geo coord_geo; + enum projection pro; + int street_direction; + int no_gps; + int tunnel; /**< Whether we are in a tunnel */ + int angle_pref; + int connected_pref; + int nostop_pref; + int offroad_limit_pref; + int route_pref; + int overspeed_pref; + int overspeed_percent_pref; + int tunnel_extrapolation; +}; + + static void tracking_init_cdf(struct cdf_data *cdf, int hist_size) { cdf->extrapolating = 0; cdf->available = 0; @@ -340,6 +398,10 @@ int *tracking_get_current_flags(struct tracking *_this) { return &_this->curr_line->street->flags; } +int tracking_get_current_tunnel(struct tracking *_this) { + return _this->tunnel; +} + static void tracking_get_angles(struct tracking_line *tl) { int i; struct street_data *sd=tl->street; @@ -793,6 +855,7 @@ tracking_new(struct attr *parent, struct attr **attrs) { this->offroad_limit_pref=5000; this->route_pref=300; this->callback_list=callback_list_new(); + this->tunnel=0; if (! attr_generic_get_attr(attrs, NULL, attr_cdf_histsize, &hist_size, NULL)) { diff --git a/navit/track.h b/navit/track.h index fd214b7c6..5713ea4a6 100644 --- a/navit/track.h +++ b/navit/track.h @@ -26,63 +26,6 @@ extern "C" { #endif -/** - * @brief Contains data for the CDF - * - * This structure holds all data needed by the - * cumulative displacement filter. - */ -struct cdf_data { - int extrapolating; - int available; - int first_pos; - int poscount; - int hist_size; - struct cdf_speed *speed_hist; - struct pcoord *pos_hist; - int *dir_hist; - double last_dist; - struct pcoord last_out; - int last_dir; -}; - -struct tracking { - NAVIT_OBJECT - struct callback_list *callback_list; - struct mapset *ms; - struct route *rt; - struct map *map; - struct vehicle *vehicle; - struct vehicleprofile *vehicleprofile; - struct coord last_updated; - struct tracking_line *lines; - struct tracking_line *curr_line; - int pos; - struct coord curr[2], curr_in, curr_out; - int curr_angle; - struct coord last[2], last_in, last_out; - struct cdf_data cdf; - struct attr *attr; - int valid; - int time; - double direction, direction_matched; - double speed; - int coord_geo_valid; - struct coord_geo coord_geo; - enum projection pro; - int street_direction; - int no_gps; - int tunnel; - int angle_pref; - int connected_pref; - int nostop_pref; - int offroad_limit_pref; - int route_pref; - int overspeed_pref; - int overspeed_percent_pref; - int tunnel_extrapolation; -}; - /* prototypes */ enum attr_type; enum projection; @@ -105,6 +48,7 @@ struct street_data *tracking_get_street_data(struct tracking *tr); int tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr, struct attr_iter *attr_iter); struct item *tracking_get_current_item(struct tracking *_this); int *tracking_get_current_flags(struct tracking *_this); +int tracking_get_current_tunnel(struct tracking *_this); void tracking_flush(struct tracking *tr); void tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *vehicleprofile, enum projection pro); int tracking_set_attr(struct tracking *tr, struct attr *attr); |