- else
- fprintf ( f, "type=\"track\" name=\"%s\"%s\n", name, t->visible ? "" : " visible=\"n\"" );
- g_list_foreach ( t->trackpoints, (GFunc) a_gpspoint_write_trackpoint, f );
- fprintf ( f, "type=\"trackend\"\n" );
+
+ if ( trk->description ) {
+ gchar *tmp = slashdup(trk->description);
+ fprintf ( f, " description=\"%s\"", tmp );
+ g_free ( tmp );
+ }
+
+ if ( trk->has_color ) {
+ fprintf ( f, " color=#%.2x%.2x%.2x", (int)(trk->color.red/256),(int)(trk->color.green/256),(int)(trk->color.blue/256));
+ }
+
+ if ( trk->draw_name_mode > 0 )
+ fprintf ( f, " draw_name_mode=\"%d\"", trk->draw_name_mode );
+
+ if ( trk->max_number_dist_labels > 0 )
+ fprintf ( f, " number_dist_labels=\"%d\"", trk->max_number_dist_labels );
+
+ if ( ! trk->visible ) {
+ fprintf ( f, " visible=\"n\"" );
+ }
+ fprintf ( f, "\n" );
+
+ TP_write_info_type tp_write_info = { f, trk->is_route };
+ g_list_foreach ( trk->trackpoints, (GFunc) a_gpspoint_write_trackpoint, &tp_write_info );
+ fprintf ( f, "type=\"%send\"\n", trk->is_route ? "route" : "track" );