static void navit_cursor_update(struct cursor *cursor, void *this__p) { struct navit *this_=this__p; struct coord *cursor_c=cursor_pos_get(cursor); int dir=cursor_get_dir(cursor); if (this_->track) { struct coord c=*cursor_c; if (track_update(this_->track, &c, dir)) { cursor_c=&c; cursor_pos_set(cursor, cursor_c); if (this_->route && this_->update_curr == 1) route_set_position_from_track(this_->route, this_->track); } } else { if (this_->route && this_->update_curr == 1) route_set_position(this_->route, cursor_c); } if (this_->route && this_->update_curr == 1) navigation_update(this_->navigation, this_->route); if (this_->cursor_flag) { if (this_->follow_curr == 1) navit_set_center_cursor(this_, cursor_c, dir, 50, 80); } if (this_->follow_curr > 1) this_->follow_curr--; else this_->follow_curr=this_->follow; if (this_->update_curr > 1) this_->update_curr--; else this_->update_curr=this_->update; }
static void navit_cursor_update(struct navit *this_, struct cursor *cursor) { struct point pnt; struct coord *cursor_c=cursor_pos_get(cursor); int dir=cursor_get_dir(cursor); int speed=cursor_get_speed(cursor); enum projection pro; int border=30; if (!this_->vehicle || this_->vehicle->cursor != cursor) return; cursor_c=cursor_pos_get(cursor); dir=cursor_get_dir(cursor); speed=cursor_get_speed(cursor); pro=vehicle_projection(this_->vehicle); if (!transform(this_->trans, pro, cursor_c, &pnt) || !transform_within_border(this_->trans, &pnt, border)) { if (!this_->cursor_flag) return; if (this_->orient_north_flag) navit_set_center_cursor(this_, cursor_c, 0, 50 - 30.*sin(M_PI*dir/180.), 50 + 30.*cos(M_PI*dir/180.)); else navit_set_center_cursor(this_, cursor_c, dir, 50, 80); transform(this_->trans, pro, cursor_c, &pnt); } if (this_->pid && speed > 2) kill(this_->pid, SIGWINCH); if (this_->tracking && this_->tracking_flag) { struct coord c=*cursor_c; if (tracking_update(this_->tracking, &c, dir)) { cursor_c=&c; cursor_pos_set(cursor, cursor_c); if (this_->route && this_->vehicle->update_curr == 1) route_set_position_from_tracking(this_->route, this_->tracking); } } else { if (this_->route && this_->vehicle->update_curr == 1) route_set_position(this_->route, cursor_c); } if (this_->route && this_->vehicle->update_curr == 1) navigation_update(this_->navigation, this_->route); if (this_->cursor_flag) { if (this_->vehicle->follow_curr == 1) navit_set_center_cursor(this_, cursor_c, dir, 50, 80); } if (this_->vehicle->follow_curr > 1) this_->vehicle->follow_curr--; else this_->vehicle->follow_curr=this_->vehicle->follow; if (this_->vehicle->update_curr > 1) this_->vehicle->update_curr--; else this_->vehicle->update_curr=this_->vehicle->update; callback_list_call_2(this_->vehicle_cbl, this_, this_->vehicle->vehicle); }
void navit_set_position(struct navit *this_, struct coord *c) { if (this_->route) { route_set_position(this_->route, c); if (this_->navigation) { navigation_update(this_->navigation, this_->route); } } navit_draw(this_); }
void vTask_9() { navigation_update(); send_nav_values(); course_run(); }