Fix:Core:Further cleanups
[profile/ivi/navit.git] / navit / navit / route.h
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 struct route_crossing {
32         long segid;
33         int dir;
34 };
35
36 struct route_crossings {
37         int count;
38         struct route_crossing crossing[0];
39 };
40
41 /**
42  * @brief Information about a street
43  *
44  * This contains information about a certain street
45  */
46 struct street_data {
47         struct item item;       /**< The map item for this street */
48         int count;                      /**< Number of coordinates this street has */
49         int flags;
50         struct coord c[0];      /**< Pointer to the coordinates of this street */
51 };
52
53 #define route_item_first type_street_0
54 #define route_item_last type_ferry
55
56 /* prototypes */
57 enum item_type;
58 struct coord;
59 struct displaylist;
60 struct item;
61 struct map_selection;
62 struct mapset;
63 struct route;
64 struct route_info;
65 struct route_info_handle;
66 struct route_path_coord_handle;
67 struct route_path_handle;
68 struct route_path_segment;
69 struct street_data;
70 struct tracking;
71 struct transformation;
72 struct route *route_new(struct attr *parent, struct attr **attrs);
73 void route_set_mapset(struct route *this, struct mapset *ms);
74 struct mapset *route_get_mapset(struct route *this);
75 struct route_info *route_get_pos(struct route *this);
76 struct route_info *route_get_dst(struct route *this);
77 int *route_get_speedlist(struct route *this);
78 int route_get_path_set(struct route *this);
79 int route_set_speed(struct route *this, enum item_type type, int value);
80 int route_contains(struct route *this, struct item *item);
81 void route_set_position(struct route *this, struct pcoord *pos);
82 void route_set_position_from_tracking(struct route *this, struct tracking *tracking);
83 struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs);
84 void route_set_destination(struct route *this, struct pcoord *dst);
85 struct route_path_handle *route_path_open(struct route *this);
86 struct route_path_segment *route_path_get_segment(struct route_path_handle *h);
87 struct coord *route_path_segment_get_start(struct route_path_segment *s);
88 struct coord *route_path_segment_get_end(struct route_path_segment *s);
89 struct item *route_path_segment_get_item(struct route_path_segment *s);
90 int route_path_segment_get_length(struct route_path_segment *s);
91 int route_path_segment_get_time(struct route_path_segment *s);
92 void route_path_close(struct route_path_handle *h);
93 struct route_path_coord_handle *route_path_coord_open(struct route *this);
94 struct coord *route_path_coord_get(struct route_path_coord_handle *h);
95 void route_path_coord_close(struct route_path_coord_handle *h);
96 int route_time(int *speedlist, struct item *item, int len);
97 int route_info_length(struct route_info *pos, struct route_info *dst, int dir);
98 struct street_data *street_get_data(struct item *item);
99 struct street_data *street_data_dup(struct street_data *orig);
100 void street_data_free(struct street_data *sd);
101 void route_info_free(struct route_info *inf);
102 struct street_data *route_info_street(struct route_info *rinf);
103 struct coord *route_info_point(struct route_info *rinf, int point);
104 struct route_info_handle *route_info_open(struct route_info *start, struct route_info *end, int dir);
105 struct coord *route_info_get(struct route_info_handle *h);
106 void route_info_close(struct route_info_handle *h);
107 void route_draw(struct route *this, struct transformation *t, struct displaylist *dsp);
108 struct map *route_get_map(struct route *route);
109 struct map *route_get_graph_map(struct route *route);
110 void route_toggle_routegraph_display(struct route *route);
111 void route_set_projection(struct route *this_, enum projection pro);
112 int route_destination_reached(struct route *this);
113 void route_init(void);
114 /* end of prototypes */
115
116 #endif
117