Parent Directory | Revision Log
Link handling
1 | /* |
2 | * Copyright (C) 2008 Till Harbaum <till@harbaum.org>. |
3 | * |
4 | * This file is part of GPXView. |
5 | * |
6 | * GPXView 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 3 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * GPXView 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 GPXView. If not, see <http://www.gnu.org/licenses/>. |
18 | */ |
19 | |
20 | #ifndef GPX_H |
21 | #define GPX_H |
22 | |
23 | #ifndef NAN |
24 | #define NAN (0.0/0.0) |
25 | #endif |
26 | |
27 | #define WPT_SYM_UNKNOWN -1 |
28 | #define WPT_SYM_MULTISTAGE 0 |
29 | #define WPT_SYM_PARKING 1 |
30 | #define WPT_SYM_FINAL 2 |
31 | #define WPT_SYM_QUESTION 3 |
32 | #define WPT_SYM_TRAILHEAD 4 |
33 | #define WPT_SYM_REFPOINT 5 |
34 | #define WPT_SYM_MAX (WPT_SYM_REFPOINT) |
35 | |
36 | #define CACHE_TYPE_UNKNOWN -1 |
37 | #define CACHE_TYPE_TRADITIONAL 0 |
38 | #define CACHE_TYPE_MULTI 1 |
39 | #define CACHE_TYPE_MYSTERY 2 |
40 | #define CACHE_TYPE_VIRTUAL 3 |
41 | #define CACHE_TYPE_WEBCAM 4 |
42 | #define CACHE_TYPE_EVENT 5 |
43 | #define CACHE_TYPE_LETTERBOX 6 |
44 | #define CACHE_TYPE_EARTHCACHE 7 |
45 | #define CACHE_TYPE_WHERIGO 8 |
46 | #define CACHE_TYPE_MEGA_EVENT 9 |
47 | #define CACHE_TYPE_CITO 10 |
48 | #define CACHE_TYPE_MAX (CACHE_TYPE_CITO) |
49 | |
50 | #define CACHE_CONT_UNKNOWN -1 |
51 | #define CACHE_CONT_REGULAR 0 |
52 | #define CACHE_CONT_SMALL 1 |
53 | #define CACHE_CONT_MICRO 2 |
54 | #define CACHE_CONT_OTHER 3 |
55 | #define CACHE_CONT_NOT_CHOSEN 4 |
56 | #define CACHE_CONT_LARGE 5 |
57 | #define CACHE_CONT_VIRTUAL 6 |
58 | #define CACHE_CONT_MAX (CACHE_CONT_VIRTUAL) |
59 | |
60 | #define LOG_TYPE_UNKNOWN -1 |
61 | #define LOG_TYPE_FOUND 0 |
62 | #define LOG_TYPE_NOT_FOUND 1 |
63 | #define LOG_TYPE_MAINTENANCE 2 |
64 | #define LOG_TYPE_WRITE_NOTE 3 |
65 | #define LOG_TYPE_REVIEWER_NOTE 4 |
66 | #define LOG_TYPE_ENABLE_LISTING 5 |
67 | #define LOG_TYPE_PUBLISH_LISTING 6 |
68 | #define LOG_TYPE_WILL_ATTEND 7 |
69 | #define LOG_TYPE_ATTENDED 8 |
70 | #define LOG_TYPE_PHOTO 9 |
71 | #define LOG_TYPE_TEMP_DISABLE 10 |
72 | #define LOG_TYPE_NEEDS_MAIN 11 |
73 | #define LOG_TYPE_UPDATED_COORDINATES 12 |
74 | #define LOG_TYPE_UNARCHIVE 13 |
75 | #define LOG_TYPE_NEEDS_ARCHIVED 14 |
76 | #define LOG_TYPE_ARCHIVE 15 |
77 | #define LOG_TYPE_MAX (LOG_TYPE_ARCHIVE) |
78 | |
79 | typedef struct { |
80 | char *name; |
81 | unsigned int id; |
82 | } user_t; |
83 | |
84 | typedef struct tb { |
85 | char *name; |
86 | char *ref; |
87 | unsigned int id; |
88 | struct tb *next; |
89 | } tb_t; |
90 | |
91 | typedef struct log { |
92 | int day, month, year; |
93 | int type; |
94 | user_t *finder; |
95 | unsigned int id; |
96 | char *text; |
97 | |
98 | struct log *next; |
99 | } log_t; |
100 | |
101 | typedef struct pos { |
102 | float lat; |
103 | float lon; |
104 | } pos_t; |
105 | |
106 | typedef struct wpt { |
107 | char *id; |
108 | pos_t pos; |
109 | char *cmt; |
110 | char *desc; |
111 | int sym; |
112 | |
113 | struct wpt *next; |
114 | } wpt_t; |
115 | |
116 | typedef struct { |
117 | char *text; |
118 | pos_t pos; |
119 | gboolean override; |
120 | gboolean found; |
121 | gboolean logged; |
122 | time_t ftime; |
123 | } notes_t; |
124 | |
125 | typedef struct cache { |
126 | /* cache information */ |
127 | char *id; |
128 | char *name; |
129 | |
130 | user_t *owner; |
131 | |
132 | int container; |
133 | int type; |
134 | char *short_description, *long_description; |
135 | int short_is_html, long_is_html; |
136 | float difficulty, terrain; |
137 | pos_t pos; |
138 | char *hint; |
139 | int hint_is_html; |
140 | int logs_are_html; |
141 | char *url; |
142 | int available, archived; |
143 | |
144 | notes_t *notes; /* user provides data. Doesn't come from gpx file */ |
145 | wpt_t *wpt; /* pointer to list of waypoints */ |
146 | log_t *log; /* pointer to list of logs */ |
147 | tb_t *tb; /* pointer to list of travelbugs */ |
148 | struct cache *next; /* pointer to next cache in list */ |
149 | } cache_t; |
150 | |
151 | typedef struct gpx { |
152 | char *filename; |
153 | char *name; |
154 | char *desc; |
155 | int day, month, year; |
156 | int notes_loaded; /* notes are loaded on demand to keep reponse fast */ |
157 | int closed; /* true if entry is "closed" */ |
158 | cache_t *cache; |
159 | |
160 | /* pointer to next gpx in list */ |
161 | struct gpx *next; |
162 | } gpx_t; |
163 | |
164 | typedef struct { |
165 | GtkWidget *dialog; |
166 | GtkWidget *label, *pbar; |
167 | } gpx_dialog_t; |
168 | |
169 | #define GPX_SORT_BY_DISTANCE 0 |
170 | #define GPX_SORT_BY_ID 1 |
171 | #define GPX_SORT_BY_NAME 2 |
172 | |
173 | gpx_dialog_t *gpx_busy_dialog_new(GtkWidget *parent); |
174 | void gpx_busy_dialog_destroy(gpx_dialog_t *); |
175 | |
176 | gpx_t *gpx_parse(gpx_dialog_t *dialog, char *filename); |
177 | gpx_t *gpx_parse_dir(gpx_dialog_t *dialog, char *dirname); |
178 | void gpx_free(gpx_t *gpx); |
179 | void gpx_free_all(gpx_t *gpx); |
180 | void gpx_free_caches(gpx_t *gpx); |
181 | void gpx_display_all(gpx_t *gpx); |
182 | int gpx_total_caches(gpx_t *gpx); |
183 | void gpx_sort(gpx_t *gpx, int by, pos_t *refpos); |
184 | float gpx_pos_get_bearing(pos_t p1, pos_t p2); |
185 | float gpx_pos_get_distance(pos_t p1, pos_t p2, int miles); |
186 | int gpx_number_of_waypoints(wpt_t *wpt); |
187 | void gpx_pos_get_distance_str(char *str, int l, pos_t p1, pos_t p2, int mil); |
188 | int gpx_number_of_logs(log_t *log); |
189 | int gpx_number_of_tbs(tb_t *tb); |
190 | gpx_t *gpx_cache2gpx(gpx_t *gpx, cache_t *cache); |
191 | pos_t gpx_cache_pos(cache_t *cache); |
192 | |
193 | #endif /* GPX_H */ |