-
-
- gpx_gather_waypoints_passalong_t passalong;
- passalong.n_wps = g_hash_table_size ( vik_trw_layer_get_waypoints ( vtl ) );
- passalong.i = 0;
- passalong.wps = g_new(gpx_waypoint_and_name,passalong.n_wps);
- g_hash_table_foreach ( vik_trw_layer_get_waypoints ( vtl ), (GHFunc) gpx_collect_waypoint, &passalong );
- /* gather waypoints in a list, then sort */
- qsort(passalong.wps, passalong.n_wps, sizeof(gpx_waypoint_and_name), gpx_waypoint_and_name_compar);
- for ( i = 0; i < passalong.n_wps; i++ )
- gpx_write_waypoint ( passalong.wps[i].name, passalong.wps[i].wp, &context);
- g_free ( passalong.wps );
-
- gpx_gather_tracks_passalong_t passalong_tracks;
- passalong_tracks.n_trks = g_hash_table_size ( vik_trw_layer_get_tracks (vtl) );
- passalong_tracks.i = 0;
- passalong_tracks.trks = g_new(gpx_track_and_timestamp,passalong_tracks.n_trks);
- g_hash_table_foreach (vik_trw_layer_get_tracks(vtl), (GHFunc) gpx_collect_track, &passalong_tracks);
- /* Sort by timestamp */
- qsort(passalong_tracks.trks, passalong_tracks.n_trks, sizeof(gpx_track_and_timestamp), gpx_track_and_timestamp_compar);
- for (i=0;i<passalong_tracks.n_trks; i++)
- {
- gpx_write_track(passalong_tracks.trks[i].name, (VikTrack *)g_hash_table_lookup(vik_trw_layer_get_tracks(vtl), passalong_tracks.trks[i].name), &context);
- }
- g_free ( passalong_tracks.trks );