]>
Commit | Line | Data |
---|---|---|
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> | |
27 | ||
28 | #include "vikcoord.h" | |
29 | ||
50a14534 EB |
30 | /* todo important: put these in their own header file, maybe.probably also rename */ |
31 | ||
32 | #define VIK_TRACK(x) ((VikTrack *)(x)) | |
33 | #define VIK_TRACKPOINT(x) ((VikTrackpoint *)(x)) | |
34 | ||
35 | typedef struct _VikTrackpoint VikTrackpoint; | |
36 | struct _VikTrackpoint { | |
37 | VikCoord coord; | |
38 | gboolean newsegment; | |
39 | gboolean has_timestamp; | |
40 | time_t timestamp; | |
a2817d3c QT |
41 | gdouble altitude; /* only in 3D fixes */ |
42 | /* Most GPSs provide this in realtime mode (NMEA) but not in data mode */ | |
43 | gboolean extended; | |
44 | gdouble speed; /* only in 3D fixes */ | |
45 | gdouble course; | |
46 | guint nsats; /* number of satellites used */ | |
47 | #define VIK_GPS_MODE_NOT_SEEN 0 /* mode update not seen yet */ | |
48 | #define VIK_GPS_MODE_NO_FIX 1 /* none */ | |
49 | #define VIK_GPS_MODE_2D 2 /* good for latitude/longitude */ | |
50 | #define VIK_GPS_MODE_3D 3 /* good for altitude/climb too */ | |
51 | gint fix_mode; | |
50a14534 EB |
52 | }; |
53 | ||
54 | typedef struct _VikTrack VikTrack; | |
55 | struct _VikTrack { | |
56 | GList *trackpoints; | |
57 | gboolean visible; | |
58 | gchar *comment; | |
59 | guint8 ref_count; | |
60 | }; | |
61 | ||
62 | VikTrack *vik_track_new(); | |
63 | void vik_track_set_comment(VikTrack *wp, const gchar *comment); | |
64 | void vik_track_ref(VikTrack *tr); | |
65 | void vik_track_free(VikTrack *tr); | |
66 | VikTrack *vik_track_copy ( const VikTrack *tr ); | |
67 | void vik_track_set_comment_no_copy(VikTrack *tr, gchar *comment); | |
68 | VikTrackpoint *vik_trackpoint_new(); | |
69 | void vik_trackpoint_free(VikTrackpoint *tp); | |
70 | VikTrackpoint *vik_trackpoint_copy(VikTrackpoint *tp); | |
71 | gdouble vik_track_get_length(const VikTrack *tr); | |
72 | gdouble vik_track_get_length_including_gaps(const VikTrack *tr); | |
73 | gulong vik_track_get_tp_count(const VikTrack *tr); | |
74 | guint vik_track_get_segment_count(const VikTrack *tr); | |
75 | VikTrack **vik_track_split_into_segments(VikTrack *tr, guint *ret_len); | |
76 | void vik_track_reverse(VikTrack *tr); | |
77 | ||
78 | gulong vik_track_get_dup_point_count ( const VikTrack *vt ); | |
79 | void vik_track_remove_dup_points ( VikTrack *vt ); | |
80 | ||
81 | gdouble vik_track_get_max_speed(const VikTrack *tr); | |
82 | gdouble vik_track_get_average_speed(const VikTrack *tr); | |
83 | ||
84 | void vik_track_convert ( VikTrack *tr, VikCoordMode dest_mode ); | |
85 | gdouble *vik_track_make_elevation_map ( const VikTrack *tr, guint16 num_chunks ); | |
86 | void vik_track_get_total_elevation_gain(const VikTrack *tr, gdouble *up, gdouble *down); | |
ddc2372e QT |
87 | VikTrackpoint *vik_track_get_closest_tp_by_percentage_dist ( VikTrack *tr, gdouble reldist, gdouble *meters_from_start ); |
88 | VikTrackpoint *vik_track_get_closest_tp_by_percentage_time ( VikTrack *tr, gdouble reldist, time_t *seconds_from_start ); | |
25e44eac | 89 | gdouble *vik_track_make_speed_map ( const VikTrack *tr, guint16 num_chunks ); |
b42a25ba | 90 | gboolean vik_track_get_minmax_alt ( const VikTrack *tr, gdouble *min_alt, gdouble *max_alt ); |
ddc47a46 AF |
91 | void vik_track_marshall ( VikTrack *tr, guint8 **data, guint *len); |
92 | VikTrack *vik_track_unmarshall (guint8 *data, guint datalen); | |
24d5c7e2 | 93 | |
55906514 | 94 | void vik_track_apply_dem_data ( VikTrack *tr); |
bddd2056 EB |
95 | |
96 | /* appends t2 to t1, leaving t2 with no trackpoints */ | |
97 | void vik_track_steal_and_append_trackpoints ( VikTrack *t1, VikTrack *t2 ); | |
ad0a8c2d | 98 | |
c3deba01 EB |
99 | /* starting at the end, looks backwards for the last "double point", a duplicate trackpoint. |
100 | * this is indicative of magic scissors continued use. If there is no double point, | |
101 | * deletes all the trackpoints. returns new end of the track (or the start if | |
102 | * there are no double points) | |
103 | */ | |
104 | VikCoord *vik_track_cut_back_to_double_point ( VikTrack *tr ); | |
105 | ||
ad0a8c2d | 106 | |
50a14534 | 107 | #endif |