/[zanavi_public1]/navit/navit/route.h
ZANavi

Contents of /navit/navit/route.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (show annotations) (download)
Sun Jun 17 08:12:47 2012 UTC (7 years, 7 months ago) by zoff99
File MIME type: text/plain
File size: 6591 byte(s)
lots of new stuff and fixes
1 /**
2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 /** @file
21 *
22 * @brief Contains exported code for route.c
23 *
24 * This file contains code that works together with route.c and that is exported to
25 * other modules.
26 */
27
28 #ifndef NAVIT_ROUTE_H
29 #define NAVIT_ROUTE_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 enum route_status {
35 route_status_no_destination=0,
36 route_status_destination_set=1,
37 route_status_not_found=1|2,
38 route_status_building_path=1|4,
39 route_status_building_graph=1|4|8,
40 route_status_path_done_new=1|16,
41 route_status_path_done_incremental=1|32,
42 };
43
44 struct route_crossing {
45 long segid;
46 int dir;
47 };
48
49 struct route_crossings {
50 int count;
51 struct route_crossing crossing[0];
52 };
53
54 /**
55 * @brief Information about a street
56 *
57 * This contains information about a certain street
58 */
59 struct street_data {
60 struct item item; /**< The map item for this street */
61 int count; /**< Number of coordinates this street has */
62 int flags;
63 int maxspeed; /**< Maximum speed allowed on this street. */
64 struct coord c[0]; /**< Pointer to the coordinates of this street.
65 * DO NOT INSERT FIELDS AFTER THIS. */
66 };
67
68 /* prototypes */
69 enum attr_type;
70 enum projection;
71 struct attr;
72 struct attr_iter;
73 struct coord;
74 struct item;
75 struct map;
76 struct map_selection;
77 struct mapset;
78 struct pcoord;
79
80
81 struct route {
82 struct mapset *ms; /**< The mapset this route is built upon */
83 unsigned flags;
84 struct route_info *pos; /**< Current position within this route */
85 GList *destinations; /**< Destinations of the route */
86 struct route_info *current_dst; /**< Current destination */
87
88 struct route_graph *graph; /**< Pointer to the route graph */
89 struct route_path *path2; /**< Pointer to the route path */
90 struct map *map;
91 struct map *graph_map;
92 struct callback * route_graph_done_cb ; /**< Callback when route graph is done */
93 struct callback * route_graph_flood_done_cb ; /**< Callback when route graph flooding is done */
94 struct callback_list *cbl2; /**< Callback list to call when route changes */
95 int destination_distance; /**< Distance to the destination at which the destination is considered "reached" */
96 struct vehicleprofile *vehicleprofile; /**< Routing preferences */
97 int route_status; /**< Route Status */
98 int route_status_was_updated; /**< Route Status was updated and needs to be read */
99 int link_path; /**< Link paths over multiple waypoints together */
100 struct pcoord pc;
101 struct vehicle *v;
102 int try_harder;
103 };
104
105
106 /**
107 * @brief Usually represents a destination or position
108 *
109 * This struct usually represents a destination or position
110 */
111 struct route_info
112 {
113 struct coord c; /**< The actual destination / position */
114 struct coord lp; /**< The nearest point on a street to c */
115 int pos; /**< The position of lp within the coords of the street */
116 int lenpos; /**< Distance between lp and the end of the street */
117 int lenneg; /**< Distance between lp and the start of the street */
118 int lenextra; /**< Distance between lp and c */
119 int percent; /**< ratio of lenneg to lenght of whole street in percent */
120 struct street_data *street; /**< The street lp is on */
121 int street_direction; /**< Direction of vehicle on street -1 = Negative direction, 1 = Positive direction, 0 = Unknown */
122 int dir; /**< Direction to take when following the route -1 = Negative direction, 1 = Positive direction */
123 };
124
125 struct street_data;
126 struct tracking;
127 struct vehicleprofile;
128 struct route *route_new(struct attr *parent, struct attr **attrs);
129 void route_set_mapset(struct route *this_, struct mapset *ms);
130 void route_set_profile(struct route *this_, struct vehicleprofile *prof);
131 struct mapset *route_get_mapset(struct route *this_);
132 struct route_info *route_get_pos(struct route *this_);
133 struct route_info *route_get_dst(struct route *this_);
134 int route_get_path_set(struct route *this_);
135 int route_contains(struct route *this_, struct item *item);
136 int route_destination_reached(struct route *this_);
137 void route_set_position(struct route *this_, struct pcoord *pos);
138 void route_set_position_from_tracking(struct route *this_, struct tracking *tracking, enum projection pro);
139 struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs);
140 void route_set_destinations(struct route *this_, struct pcoord *dst, int count, int async);
141 void route_add_destination(struct route *this, struct pcoord *dst, int async);
142 int route_get_destinations(struct route *this_, struct pcoord *pc, int count);
143 void route_set_destination(struct route *this_, struct pcoord *dst, int async);
144 void route_remove_waypoint(struct route *this_);
145 struct coord route_get_coord_dist(struct route *this_, int dist);
146 struct street_data *street_get_data(struct item *item);
147 struct street_data *street_data_dup(struct street_data *orig);
148 void street_data_free(struct street_data *sd);
149 void route_info_free(struct route_info *inf);
150 struct street_data *route_info_street(struct route_info *rinf);
151 struct map *route_get_map(struct route *this_);
152 struct map *route_get_graph_map(struct route *this_);
153 void route_set_projection(struct route *this_, enum projection pro);
154 void route_set_destinations(struct route *this_, struct pcoord *dst, int count, int async);
155 int route_set_attr(struct route *this_, struct attr *attr);
156 int route_add_attr(struct route *this_, struct attr *attr);
157 int route_remove_attr(struct route *this_, struct attr *attr);
158 struct attr_iter * route_attr_iter_new(void);
159 void route_attr_iter_destroy(struct attr_iter *iter);
160 int route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
161 void route_init(void);
162 void route_destroy(struct route *this_);
163 void route_path_destroy(struct route_path *this, int recurse);
164 void route_graph_destroy(struct route_graph *this);
165 void route_path_update(struct route *this, int cancel, int async);
166 /* end of prototypes */
167 #ifdef __cplusplus
168 }
169 #endif
170
171 #endif
172

   
Visit the ZANavi Wiki