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

Contents of /navit/navit/route.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (show annotations) (download)
Wed Jun 22 07:33:35 2016 UTC (7 years, 9 months ago) by zoff99
File MIME type: text/plain
File size: 10754 byte(s)
v2.0.51
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 length 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
126 /**
127 * @brief A segment in the route graph or path
128 *
129 * This is a segment in the route graph or path. A segment represents a driveable way.
130 */
131 struct route_segment_data
132 {
133 struct item item; /**< The item (e.g. street) that this segment represents. */
134 int flags;
135 int len; /**< Length of this segment */
136 /*NOTE: After a segment, various fields may follow, depending on what flags are set. Order of fields:
137 1.) maxspeed Maximum allowed speed on this segment. Present if NAVIT_AF_SPEED_LIMIT is set.
138 2.) offset If the item is segmented (i.e. represented by more than one segment), this
139 indicates the position of this segment in the item. Present if NAVIT_AF_SEGMENTED is set.
140 */
141 };
142
143 struct size_weight_limit
144 {
145 int width;
146 int length;
147 int height;
148 int weight;
149 int axle_weight;
150 };
151
152
153 /**
154 * @brief A point in the route graph
155 *
156 * This represents a point in the route graph. A point usually connects two or more segments,
157 * but there are also points which don't do that (e.g. at the end of a dead-end).
158 */
159 struct route_graph_point
160 {
161 struct route_graph_point *hash_next; /**< Pointer to a chained hashlist of all route_graph_points with this hash */
162 struct route_graph_segment *start; /**< Pointer to a list of segments of which this point is the start. The links
163 * of this linked-list are in route_graph_segment->start_next.*/
164 struct route_graph_segment *end; /**< Pointer to a list of segments of which this pointer is the end. The links
165 * of this linked-list are in route_graph_segment->end_next. */
166 // struct route_graph_segment *seg; /**< Pointer to the segment one should use to reach the destination at
167 // * least costs */
168 // struct fibheap_el *el; /**< When this point is put on a Fibonacci heap, this is a pointer
169 // * to this point's heap-element */
170 // int value; /**< The cost at which one can reach the destination from this point on */
171 struct coord c; /**< Coordinates of this point */
172 int flags; /**< Flags for this point (eg traffic distortion) */
173
174 // struct route_graph_segment *seg_rev;
175
176 /*
177 Dijkstra values:
178 ================
179 seg -> what segment to use
180 value -> cost to reach destination
181 */
182 };
183
184
185 struct route_graph_segment_data
186 {
187 struct item *item;
188 int offset;
189 int flags;
190 int len;
191 int maxspeed;
192 struct size_weight_limit size_weight;
193 int dangerous_goods;
194 };
195
196 /**
197 * @brief A segment in the route graph
198 *
199 * This is a segment in the route graph. A segment represents a driveable way.
200 */
201 struct route_graph_segment
202 {
203 struct route_graph_segment *next; /**< Linked-list pointer to a list of all route_graph_segments */
204 struct route_graph_segment *start_next; /**< Pointer to the next element in the list of segments that start at the
205 * same point. Start of this list is in route_graph_point->start. */
206 struct route_graph_segment *end_next; /**< Pointer to the next element in the list of segments that end at the
207 * same point. Start of this list is in route_graph_point->end. */
208 struct route_graph_point *start; /**< Pointer to the point this segment starts at. */
209 struct route_graph_point *end; /**< Pointer to the point this segment ends at. */
210
211
212 // -- NEW --
213 struct coord c_start_plus_1; // second coord
214 struct coord c_end_minus_1; // second to last coord
215 // -- NEW --
216
217
218 // -- NEW -- jandgr --
219 int seg_start_out_cost;
220 int seg_end_out_cost;
221 struct route_graph_segment *start_from_seg;
222 struct route_graph_segment *end_from_seg;
223 struct fibheap_el *el_start;
224 struct fibheap_el *el_end;
225 // -- NEW -- jandgr --
226
227
228 struct route_segment_data data; /**< The segment data */
229 };
230
231
232
233
234
235
236
237
238 struct street_data;
239 struct tracking;
240 struct vehicleprofile;
241 struct route *route_new(struct attr *parent, struct attr **attrs);
242 void route_set_mapset(struct route *this_, struct mapset *ms);
243 void route_set_profile(struct route *this_, struct vehicleprofile *prof);
244 struct mapset *route_get_mapset(struct route *this_);
245 struct route_info *route_get_pos(struct route *this_);
246 struct route_info *route_get_dst(struct route *this_);
247 int route_get_path_set(struct route *this_);
248 int route_contains(struct route *this_, struct item *item);
249 int route_destination_reached(struct route *this_);
250 void route_set_position(struct route *this_, struct pcoord *pos);
251 void route_set_position_from_tracking(struct route *this_, struct tracking *tracking, enum projection pro);
252 struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs);
253 void route_set_destinations(struct route *this_, struct pcoord *dst, int count, int async);
254 void route_add_destination(struct route *this, struct pcoord *dst, int async);
255 int route_get_destinations(struct route *this_, struct pcoord *pc, int count);
256 void route_set_destination(struct route *this_, struct pcoord *dst, int async);
257 void route_remove_waypoint(struct route *this_);
258 struct coord route_get_coord_dist(struct route *this_, int dist);
259 struct street_data *street_get_data(struct item *item);
260 struct street_data *street_data_dup(struct street_data *orig);
261 void street_data_free(struct street_data *sd);
262 void route_info_free(struct route_info *inf);
263 struct street_data *route_info_street(struct route_info *rinf);
264 struct map *route_get_map(struct route *this_);
265 struct map *route_get_graph_map(struct route *this_);
266 void route_set_projection(struct route *this_, enum projection pro);
267 void route_set_destinations(struct route *this_, struct pcoord *dst, int count, int async);
268 int route_set_attr(struct route *this_, struct attr *attr);
269 int route_add_attr(struct route *this_, struct attr *attr);
270 int route_remove_attr(struct route *this_, struct attr *attr);
271 struct attr_iter * route_attr_iter_new(void);
272 void route_attr_iter_destroy(struct attr_iter *iter);
273 int route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
274 void route_init(void);
275 void route_destroy(struct route *this_);
276 void route_path_destroy(struct route_path *this, int recurse);
277 void route_graph_destroy(struct route_graph *this);
278 void route_path_update(struct route *this, int cancel, int async);
279 int route_get_real_oneway_mask(int road_flag, int mask);
280 struct route_graph_segment *route_graph_get_segment(struct route_graph *graph, struct street_data *sd, struct route_graph_segment *last);
281 void route_after_destination_start_calc(struct route *this, int async);
282 void route_set_destination_no_calc(struct route *this, struct pcoord *dst, int async);
283 void route_add_destination_no_calc(struct route *this, struct pcoord *dst, int async);
284 void route_find_next_lowest_segment_and_pin_it(struct route_graph_point *p, struct route_graph_segment *s, int min_value, int penalty);
285
286 /* end of prototypes */
287 #ifdef __cplusplus
288 }
289 #endif
290
291 #endif
292

   
Visit the ZANavi Wiki