]> git.street.me.uk Git - andy/viking.git/blame - src/viktrack.h
Fix <GTK 2.24 combo box usage.
[andy/viking.git] / src / viktrack.h
CommitLineData
50a14534
EB
1/*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3 *
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef _VIKING_TRACK_H
23#define _VIKING_TRACK_H
24
a25c4c50
GB
25#include <time.h>
26#include <glib.h>
21700912 27#include <gtk/gtk.h>
a25c4c50
GB
28
29#include "vikcoord.h"
30
50a14534
EB
31/* todo important: put these in their own header file, maybe.probably also rename */
32
33#define VIK_TRACK(x) ((VikTrack *)(x))
34#define VIK_TRACKPOINT(x) ((VikTrackpoint *)(x))
35
36typedef struct _VikTrackpoint VikTrackpoint;
37struct _VikTrackpoint {
38 VikCoord coord;
39 gboolean newsegment;
40 gboolean has_timestamp;
41 time_t timestamp;
2d920ee9 42 gdouble altitude; /* VIK_DEFAULT_ALTITUDE if data unavailable */
2d920ee9
T
43 gdouble speed; /* NAN if data unavailable */
44 gdouble course; /* NAN if data unavailable */
45 guint nsats; /* number of satellites used. 0 if data unavailable */
a2817d3c
QT
46#define VIK_GPS_MODE_NOT_SEEN 0 /* mode update not seen yet */
47#define VIK_GPS_MODE_NO_FIX 1 /* none */
48#define VIK_GPS_MODE_2D 2 /* good for latitude/longitude */
49#define VIK_GPS_MODE_3D 3 /* good for altitude/climb too */
2d920ee9
T
50 gint fix_mode; /* VIK_GPS_MODE_NOT_SEEN if data unavailable */
51 gdouble hdop; /* VIK_DEFAULT_DOP if data unavailable */
52 gdouble vdop; /* VIK_DEFAULT_DOP if data unavailable */
53 gdouble pdop; /* VIK_DEFAULT_DOP if data unavailable */
50a14534
EB
54};
55
56typedef struct _VikTrack VikTrack;
57struct _VikTrack {
58 GList *trackpoints;
59 gboolean visible;
60 gchar *comment;
61 guint8 ref_count;
21700912 62 GtkWidget *property_dialog;
50a14534
EB
63};
64
65VikTrack *vik_track_new();
66void vik_track_set_comment(VikTrack *wp, const gchar *comment);
67void vik_track_ref(VikTrack *tr);
68void vik_track_free(VikTrack *tr);
69VikTrack *vik_track_copy ( const VikTrack *tr );
70void vik_track_set_comment_no_copy(VikTrack *tr, gchar *comment);
71VikTrackpoint *vik_trackpoint_new();
72void vik_trackpoint_free(VikTrackpoint *tp);
73VikTrackpoint *vik_trackpoint_copy(VikTrackpoint *tp);
74gdouble vik_track_get_length(const VikTrack *tr);
75gdouble vik_track_get_length_including_gaps(const VikTrack *tr);
76gulong vik_track_get_tp_count(const VikTrack *tr);
77guint vik_track_get_segment_count(const VikTrack *tr);
78VikTrack **vik_track_split_into_segments(VikTrack *tr, guint *ret_len);
79void vik_track_reverse(VikTrack *tr);
80
81gulong vik_track_get_dup_point_count ( const VikTrack *vt );
82void vik_track_remove_dup_points ( VikTrack *vt );
83
84gdouble vik_track_get_max_speed(const VikTrack *tr);
85gdouble vik_track_get_average_speed(const VikTrack *tr);
86
87void vik_track_convert ( VikTrack *tr, VikCoordMode dest_mode );
88gdouble *vik_track_make_elevation_map ( const VikTrack *tr, guint16 num_chunks );
89void vik_track_get_total_elevation_gain(const VikTrack *tr, gdouble *up, gdouble *down);
ddc2372e
QT
90VikTrackpoint *vik_track_get_closest_tp_by_percentage_dist ( VikTrack *tr, gdouble reldist, gdouble *meters_from_start );
91VikTrackpoint *vik_track_get_closest_tp_by_percentage_time ( VikTrack *tr, gdouble reldist, time_t *seconds_from_start );
03e7da75 92VikTrackpoint *vik_track_get_tp_by_max_speed ( const VikTrack *tr );
c28faca8
RN
93VikTrackpoint *vik_track_get_tp_by_max_alt ( const VikTrack *tr );
94VikTrackpoint *vik_track_get_tp_by_min_alt ( const VikTrack *tr );
25e44eac 95gdouble *vik_track_make_speed_map ( const VikTrack *tr, guint16 num_chunks );
926c8140 96gdouble *vik_track_make_distance_map ( const VikTrack *tr, guint16 num_chunks );
8de26632 97gdouble *vik_track_make_elevation_time_map ( const VikTrack *tr, guint16 num_chunks );
7b624086 98gdouble *vik_track_make_speed_dist_map ( const VikTrack *tr, guint16 num_chunks );
b42a25ba 99gboolean vik_track_get_minmax_alt ( const VikTrack *tr, gdouble *min_alt, gdouble *max_alt );
ddc47a46
AF
100void vik_track_marshall ( VikTrack *tr, guint8 **data, guint *len);
101VikTrack *vik_track_unmarshall (guint8 *data, guint datalen);
24d5c7e2 102
55906514 103void vik_track_apply_dem_data ( VikTrack *tr);
e85535ea
RN
104/*
105 * Apply DEM data (if available) - to only the last trackpoint
106 */
107void vik_track_apply_dem_data_last_trackpoint ( VikTrack *tr );
bddd2056
EB
108
109/* appends t2 to t1, leaving t2 with no trackpoints */
110void vik_track_steal_and_append_trackpoints ( VikTrack *t1, VikTrack *t2 );
ad0a8c2d 111
c3deba01 112/* starting at the end, looks backwards for the last "double point", a duplicate trackpoint.
7ff7d728
RN
113 * If there is no double point, deletes all the trackpoints.
114 * Returns the new end of the track (or the start if there are no double points
c3deba01
EB
115 */
116VikCoord *vik_track_cut_back_to_double_point ( VikTrack *tr );
117
21700912
QT
118void vik_track_set_property_dialog(VikTrack *tr, GtkWidget *dialog);
119void vik_track_clear_property_dialog(VikTrack *tr);
ad0a8c2d 120
50a14534 121#endif