if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
_track.tail = _track.head;
+ _track.length=_track.avgspeed=0.0;
+ _track.points=0;
map_force_redraw();
}
gtk_widget_destroy(confirm);
ty1 = unit2y(_track.tail->unity);
tx2 = unit2x(gps->unitx);
ty2 = unit2y(gps->unity);
+
+ /* XXX: This should not be here... */
gtk_widget_queue_draw_area(_map_widget,
MIN(tx1, tx2) - _draw_width,
MIN(ty1, ty2) - _draw_width,
}
}
+ if (_track.tail->unity && _track.tail->unitx) {
+ gdouble lat, lon;
+
+ unit2latlon(_track.tail->unitx, _track.tail->unity, lat, lon);
+ _track.length += calculate_distance(lat, lon, gps->lat, gps->lon);
+ _track.tspeed+=gps->speed;
+ if (_track.points>0)
+ _track.avgspeed=_track.tspeed/_track.points;
+ else
+ _track.avgspeed=0.0;
+ g_debug("TRACK: %f %f (%d)", _track.length, _track.avgspeed, _track.points);
+ }
+
MACRO_PATH_INCREMENT_TAIL(_track);
_track.tail->unitx=gps->unitx;
_track.tail->unity=gps->unity;
_track.tail->time=gps->time;
_track.tail->altitude=gps->altitude;
+ _track.points++;
}
if (_autoroute_data.enabled && !_autoroute_data.in_progress && _near_point_dist_squared > 400) {