]> git.street.me.uk Git - andy/viking.git/blob - src/file.h
70fe1238282fcbb745e4932f8740728304a57d75
[andy/viking.git] / src / file.h
1 /*
2  * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3  *
4  * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
5  * Copyright (C) 2012, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef _VIKING_FILE_H
24 #define _VIKING_FILE_H
25
26 #include <glib.h>
27
28 #include "vikaggregatelayer.h"
29 #include "viktrwlayer.h"
30 #include "vikviewport.h"
31
32 G_BEGIN_DECLS
33
34 typedef enum {
35 FILE_TYPE_GPSPOINT=1,
36 FILE_TYPE_GPSMAPPER=2,
37 FILE_TYPE_GPX=3,
38 FILE_TYPE_KML=4,
39 FILE_TYPE_GEOJSON=5,
40 } VikFileType_t;
41
42 gboolean a_file_check_ext ( const gchar *filename, const gchar *fileext );
43
44 /*
45  * Function to determine if a filename is a 'viking' type file
46  */
47 gboolean check_file_magic_vik ( const gchar *filename );
48
49 typedef enum {
50   LOAD_TYPE_READ_FAILURE,
51   LOAD_TYPE_GPSBABEL_FAILURE,
52   LOAD_TYPE_GPX_FAILURE,
53   LOAD_TYPE_UNSUPPORTED_FAILURE,
54   LOAD_TYPE_VIK_FAILURE_NON_FATAL,
55   LOAD_TYPE_VIK_SUCCESS,
56   LOAD_TYPE_OTHER_SUCCESS,
57 } VikLoadType_t;
58
59 gchar *append_file_ext ( const gchar *filename, VikFileType_t type );
60
61 VikLoadType_t a_file_load ( VikAggregateLayer *top, VikViewport *vp, const gchar *filename );
62 gboolean a_file_save ( VikAggregateLayer *top, gpointer vp, const gchar *filename );
63 /* Only need to define VikTrack if the file type is FILE_TYPE_GPX_TRACK */
64 gboolean a_file_export ( VikTrwLayer *vtl, const gchar *filename, VikFileType_t file_type, VikTrack *trk, gboolean write_hidden );
65 gboolean a_file_export_babel ( VikTrwLayer *vtl, const gchar *filename, const gchar *format,
66     gboolean tracks, gboolean routes, gboolean waypoints );
67
68 void file_write_layer_param ( FILE *f, const gchar *name, VikLayerParamType type, VikLayerParamData data );
69
70 char *file_realpath ( const char *path, char *real );
71
72 char *file_realpath_dup ( const char *path );
73
74 const gchar *file_GetRelativeFilename ( gchar *currentDirectory, gchar *absoluteFilename );
75
76 G_END_DECLS
77
78 #endif