Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /branches/libroutino/src/routino.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1756 - (show annotations) (download) (as text)
Mon Jul 20 18:33:06 2015 UTC (9 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 6271 byte(s)
Add options to the routing function to allow selection of the type of
output files generated.

1 /***************************************
2 Routino library header file.
3
4 Part of the Routino routing software.
5 ******************/ /******************
6 This file Copyright 2015 Andrew M. Bishop
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
17
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ***************************************/
21
22
23 #ifndef ROUTINO_H
24 #define ROUTINO_H /*+ To stop multiple inclusions. +*/
25
26 /* Limit the exported symbols in the library */
27
28 #if defined(_MSC_VER)
29 #ifdef LIBROUTINO
30 #define DLL_PUBLIC __declspec(dllexport)
31 #else
32 #define DLL_PUBLIC __declspec(dllimport)
33 #endif
34 #endif
35
36 #if defined(__GNUC__) && __GNUC__ >= 4
37 #if defined(__MINGW32__) || defined(__CYGWIN__)
38 #ifdef LIBROUTINO
39 #define DLL_PUBLIC __attribute__ ((dllexport))
40 #else
41 #define DLL_PUBLIC __attribute__ ((dllimport))
42 #endif
43 #else
44 #ifdef LIBROUTINO
45 #define DLL_PUBLIC __attribute__ ((visibility ("default")))
46 #endif
47 #endif
48 #endif
49
50 #ifndef DLL_PUBLIC
51 #define DLL_PUBLIC
52 #endif
53
54
55 /* Handle compilation with a C++ compiler */
56
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61
62
63 /* Routino error constants */
64
65 #define ROUTINO_ERROR_NONE 0 /*+ No error. +*/
66
67 #define ROUTINO_ERROR_NO_DATABASE 1 /*+ A function was called without the database variable set. +*/
68 #define ROUTINO_ERROR_NO_PROFILE 2 /*+ A function was called without the profile variable set. +*/
69 #define ROUTINO_ERROR_NO_TRANSLATION 3 /*+ A function was called without the translation variable set. +*/
70
71 #define ROUTINO_ERROR_NO_DATABASE_FILES 11 /*+ The specified database to load did not exist. +*/
72 #define ROUTINO_ERROR_BAD_DATABASE_FILES 12 /*+ The specified database could not be loaded. +*/
73 #define ROUTINO_ERROR_NO_PROFILES_XML 13 /*+ The specified profiles XML file did not exist. +*/
74 #define ROUTINO_ERROR_BAD_PROFILES_XML 14 /*+ The specified profiles XML file could not be loaded. +*/
75 #define ROUTINO_ERROR_NO_TRANSLATIONS_XML 11 /*+ The specified translations XML file did not exist. +*/
76 #define ROUTINO_ERROR_BAD_TRANSLATIONS_XML 12 /*+ The specified translations XML file could not be loaded. +*/
77
78 #define ROUTINO_ERROR_NO_SUCH_PROFILE 21 /*+ The requested profile name does not exist in the loaded XML file. +*/
79 #define ROUTINO_ERROR_NO_SUCH_TRANSLATION 22 /*+ The requested translation language does not exist in the loaded XML file. +*/
80
81 #define ROUTINO_ERROR_NO_NEARBY_HIGHWAY 31 /*+ There is no highway near the coordinates to place a waypoint. +*/
82
83 #define ROUTINO_ERROR_PROFILE_DATABASE_ERR 41 /*+ The profile and database do not work together. +*/
84 #define ROUTINO_ERROR_NOTVALID_PROFILE 42 /*+ The profile being used has not been validated. +*/
85
86 #define ROUTINO_ERROR_BAD_OPTIONS 51 /*+ The routing options specified are not consistent with each other. +*/
87
88 #define ROUTINO_ERROR_NO_ROUTE_1 1001 /*+ A route could not be found to waypoint 1. +*/
89 #define ROUTINO_ERROR_NO_ROUTE_2 1002 /*+ A route could not be found to waypoint 2. +*/
90 #define ROUTINO_ERROR_NO_ROUTE_3 1003 /*+ A route could not be found to waypoint 3. +*/
91 /* Higher values of the error number refer to later waypoints. */
92
93
94 /* Routino routing option constants */
95
96 #define ROUTINO_ROUTE_SHORTEST 0 /*+ Calculate the shortest route. +*/
97 #define ROUTINO_ROUTE_QUICKEST 1 /*+ Calculate the quickest route. +*/
98
99 #define ROUTINO_ROUTE_FILE_HTML 2 /*+ Output an HTML route file. +*/
100 #define ROUTINO_ROUTE_FILE_GPX_TRACK 4 /*+ Output a GPX track file. +*/
101 #define ROUTINO_ROUTE_FILE_GPX_ROUTE 8 /*+ Output a GPX route file. +*/
102 #define ROUTINO_ROUTE_FILE_TEXT 16 /*+ Output a text file with important junctions. +*/
103 #define ROUTINO_ROUTE_FILE_TEXT_ALL 32 /*+ Output a text file with all nodes and segments. +*/
104
105 #define ROUTINO_ROUTE_FILE_STDOUT 64 /*+ Output a single file type to stdout. +*/
106
107
108 /* Routino error number variable */
109
110 /*+ Contains the error number of the most recent Routino error. +*/
111 extern int Routino_errno;
112
113
114 /* Routino types */
115
116 typedef struct _Routino_Database Routino_Database;
117 typedef struct _Routino_Waypoint Routino_Waypoint;
118
119 #ifdef LIBROUTINO
120 typedef struct _Profile Routino_Profile;
121 typedef struct _Translation Routino_Translation;
122 #else
123 typedef struct _Routino_Profile Routino_Profile;
124 typedef struct _Routino_Translation Routino_Translation;
125 #endif
126
127
128 /* Routino library functions */
129
130 DLL_PUBLIC Routino_Database *Routino_LoadDatabase(const char *dirname,const char *prefix);
131 DLL_PUBLIC void Routino_UnloadDatabase(Routino_Database *database);
132
133 DLL_PUBLIC int Routino_ParseXMLProfiles(const char *filename);
134 DLL_PUBLIC char **Routino_GetProfileNames(void);
135 DLL_PUBLIC Routino_Profile *Routino_GetProfile(const char *name);
136 DLL_PUBLIC void Routino_FreeXMLProfiles(void);
137
138 DLL_PUBLIC int Routino_ParseXMLTranslations(const char *filename);
139 DLL_PUBLIC char **Routino_GetTranslationLanguages(void);
140 DLL_PUBLIC Routino_Translation *Routino_GetTranslation(const char *language);
141 DLL_PUBLIC void Routino_FreeXMLTranslations(void);
142
143 DLL_PUBLIC int Routino_ValidateProfile(Routino_Database *database,Routino_Profile *profile);
144
145 DLL_PUBLIC Routino_Waypoint *Routino_FindWaypoint(Routino_Database *database,Routino_Profile *profile,double latitude,double longitude);
146
147 DLL_PUBLIC int Routino_CalculateRoute(Routino_Database *database,Routino_Profile *profile,Routino_Translation *translation,
148 Routino_Waypoint **waypoints,int nwaypoints,int options);
149
150
151 /* Handle compilation with a C++ compiler */
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif /* ROUTINO_H */