Parent Directory | Revision Log
Added missing icon
1 | harbaum | 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 | harbaum | 293 | // gpx 1.0.1 attributes |
80 | #define ATT_UNKNOWN 0 | ||
81 | #define ATT_DOGS 1 | ||
82 | #define ATT_FEE 2 | ||
83 | #define ATT_RAPPELLING 3 | ||
84 | #define ATT_BOAT 4 | ||
85 | #define ATT_SCUBA 5 | ||
86 | #define ATT_KIDS 6 | ||
87 | #define ATT_ONEHOUR 7 | ||
88 | #define ATT_SCENIC 8 | ||
89 | #define ATT_HIKING 9 | ||
90 | #define ATT_CLIMBING 10 | ||
91 | #define ATT_WADING 11 | ||
92 | #define ATT_SWIMMING 12 | ||
93 | #define ATT_AVAILABLE 13 | ||
94 | #define ATT_NIGHT 14 | ||
95 | #define ATT_WINTER 15 | ||
96 | #define ATT_UNKNOWN0 16 // <-- ??? | ||
97 | #define ATT_POISONOAK 17 | ||
98 | #define ATT_SNAKES 18 | ||
99 | #define ATT_TICKS 19 | ||
100 | #define ATT_MINE 20 | ||
101 | #define ATT_CLIFF 21 | ||
102 | #define ATT_HUNTING 22 | ||
103 | #define ATT_DANGER 23 | ||
104 | #define ATT_WHEELCHAIR 24 | ||
105 | #define ATT_PARKING 25 | ||
106 | #define ATT_PUBLIC 26 | ||
107 | #define ATT_WATER 27 | ||
108 | #define ATT_RESTROOMS 28 | ||
109 | #define ATT_PHONE 29 | ||
110 | #define ATT_PICNIC 30 | ||
111 | #define ATT_CAMPING 31 | ||
112 | #define ATT_BICYCLES 32 | ||
113 | #define ATT_MOTORCYCLES 33 | ||
114 | #define ATT_QUADS 34 | ||
115 | #define ATT_JEEPS 35 | ||
116 | #define ATT_SNOWMOBILES 36 | ||
117 | #define ATT_HORSES 37 | ||
118 | #define ATT_CAMPFIRES 38 | ||
119 | #define ATT_THORN 39 | ||
120 | #define ATT_STEALTH 40 | ||
121 | #define ATT_STROLLER 41 | ||
122 | #define ATT_FIRSTAID 42 | ||
123 | #define ATT_COW 43 | ||
124 | #define ATT_FLASHLIGHT 44 | ||
125 | // august 2010 attributes | ||
126 | #define ATT_LANDF 45 | ||
127 | harbaum | 302 | #define ATT_RV 46 |
128 | harbaum | 293 | #define ATT_FIELD_PUZZLE 47 |
129 | #define ATT_UV 48 | ||
130 | #define ATT_SNOWSHOES 49 | ||
131 | #define ATT_SKIIS 50 | ||
132 | #define ATT_S_TOOL 51 | ||
133 | #define ATT_NIGHTCACHE 52 | ||
134 | #define ATT_PARKNGRAB 53 | ||
135 | #define ATT_ABANDONEDBUILDING 54 | ||
136 | #define ATT_HIKE_SHORT 55 | ||
137 | #define ATT_HIKE_MED 56 | ||
138 | #define ATT_HIKE_LONG 57 | ||
139 | #define ATT_FUEL 58 | ||
140 | #define ATT_FOOD 59 | ||
141 | harbaum | 294 | #define ATT_MAX (ATT_FOOD) |
142 | harbaum | 293 | |
143 | typedef struct attribute { | ||
144 | char *name; | ||
145 | unsigned int id; | ||
146 | gboolean inc; | ||
147 | struct attribute *next; | ||
148 | } attribute_t; | ||
149 | |||
150 | harbaum | 134 | typedef struct { |
151 | char *name; | ||
152 | unsigned int id; | ||
153 | } user_t; | ||
154 | harbaum | 1 | |
155 | typedef struct tb { | ||
156 | char *name; | ||
157 | char *ref; | ||
158 | harbaum | 133 | unsigned int id; |
159 | harbaum | 1 | struct tb *next; |
160 | } tb_t; | ||
161 | |||
162 | typedef struct log { | ||
163 | int day, month, year; | ||
164 | int type; | ||
165 | harbaum | 137 | user_t *finder; |
166 | harbaum | 138 | unsigned int id; |
167 | harbaum | 1 | char *text; |
168 | |||
169 | struct log *next; | ||
170 | } log_t; | ||
171 | |||
172 | typedef struct pos { | ||
173 | float lat; | ||
174 | float lon; | ||
175 | } pos_t; | ||
176 | |||
177 | typedef struct wpt { | ||
178 | char *id; | ||
179 | pos_t pos; | ||
180 | char *cmt; | ||
181 | char *desc; | ||
182 | int sym; | ||
183 | |||
184 | struct wpt *next; | ||
185 | } wpt_t; | ||
186 | |||
187 | typedef struct { | ||
188 | char *text; | ||
189 | pos_t pos; | ||
190 | gboolean override; | ||
191 | gboolean found; | ||
192 | gboolean logged; | ||
193 | time_t ftime; | ||
194 | } notes_t; | ||
195 | |||
196 | typedef struct cache { | ||
197 | /* cache information */ | ||
198 | char *id; | ||
199 | char *name; | ||
200 | harbaum | 134 | |
201 | user_t *owner; | ||
202 | |||
203 | harbaum | 1 | int container; |
204 | int type; | ||
205 | char *short_description, *long_description; | ||
206 | int short_is_html, long_is_html; | ||
207 | float difficulty, terrain; | ||
208 | pos_t pos; | ||
209 | char *hint; | ||
210 | int hint_is_html; | ||
211 | int logs_are_html; | ||
212 | char *url; | ||
213 | int available, archived; | ||
214 | harbaum | 204 | gboolean found; /* determined by log */ |
215 | harbaum | 205 | gboolean mine; |
216 | harbaum | 1 | |
217 | harbaum | 293 | notes_t *notes; /* user provides data. Doesn't come from gpx file */ |
218 | wpt_t *wpt; /* pointer to list of waypoints */ | ||
219 | log_t *log; /* pointer to list of logs */ | ||
220 | tb_t *tb; /* pointer to list of travelbugs */ | ||
221 | attribute_t *attribute; /* pointer to list of attributes */ | ||
222 | struct cache *next; /* pointer to next cache in list */ | ||
223 | harbaum | 1 | } cache_t; |
224 | |||
225 | typedef struct gpx { | ||
226 | char *filename; | ||
227 | char *name; | ||
228 | char *desc; | ||
229 | int day, month, year; | ||
230 | int notes_loaded; /* notes are loaded on demand to keep reponse fast */ | ||
231 | int closed; /* true if entry is "closed" */ | ||
232 | cache_t *cache; | ||
233 | |||
234 | /* pointer to next gpx in list */ | ||
235 | struct gpx *next; | ||
236 | } gpx_t; | ||
237 | |||
238 | typedef struct { | ||
239 | GtkWidget *dialog; | ||
240 | GtkWidget *label, *pbar; | ||
241 | } gpx_dialog_t; | ||
242 | |||
243 | #define GPX_SORT_BY_DISTANCE 0 | ||
244 | #define GPX_SORT_BY_ID 1 | ||
245 | #define GPX_SORT_BY_NAME 2 | ||
246 | |||
247 | gpx_dialog_t *gpx_busy_dialog_new(GtkWidget *parent); | ||
248 | void gpx_busy_dialog_destroy(gpx_dialog_t *); | ||
249 | |||
250 | harbaum | 204 | gpx_t *gpx_parse(gpx_dialog_t *dialog, char *filename, char *username); |
251 | gpx_t *gpx_parse_dir(gpx_dialog_t *dialog, char *dirname, char *username); | ||
252 | harbaum | 1 | void gpx_free(gpx_t *gpx); |
253 | void gpx_free_all(gpx_t *gpx); | ||
254 | void gpx_free_caches(gpx_t *gpx); | ||
255 | void gpx_display_all(gpx_t *gpx); | ||
256 | int gpx_total_caches(gpx_t *gpx); | ||
257 | harbaum | 152 | int gpx_total_caches_global(gpx_t *gpx); |
258 | harbaum | 1 | void gpx_sort(gpx_t *gpx, int by, pos_t *refpos); |
259 | float gpx_pos_get_bearing(pos_t p1, pos_t p2); | ||
260 | float gpx_pos_get_distance(pos_t p1, pos_t p2, int miles); | ||
261 | int gpx_number_of_waypoints(wpt_t *wpt); | ||
262 | void gpx_pos_get_distance_str(char *str, int l, pos_t p1, pos_t p2, int mil); | ||
263 | int gpx_number_of_logs(log_t *log); | ||
264 | int gpx_number_of_tbs(tb_t *tb); | ||
265 | gpx_t *gpx_cache2gpx(gpx_t *gpx, cache_t *cache); | ||
266 | pos_t gpx_cache_pos(cache_t *cache); | ||
267 | |||
268 | #endif /* GPX_H */ |