navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
route.h File Reference

Contains exported code for route.c. More...

Go to the source code of this file.

Data Structures

struct  route_crossing
 
struct  route_crossings
 
struct  street_data
 Information about a street. More...
 

Enumerations

enum  route_path_flags { route_path_flag_none =0, route_path_flag_cancel =1, route_path_flag_async =2, route_path_flag_no_rebuild =4 }
 
enum  route_status {
  route_status_no_destination =0, route_status_destination_set =1, route_status_not_found =1|2, route_status_building_path =1|4,
  route_status_building_graph =1|4|8, route_status_path_done_new =1|16, route_status_path_done_incremental =1|32
}
 

Functions

struct routeroute_new (struct attr *parent, struct attr **attrs)
 Creates a completely new route structure. More...
 
struct routeroute_dup (struct route *orig)
 Duplicates a route object. More...
 
void route_set_mapset (struct route *this_, struct mapset *ms)
 Sets the mapset of the route passwd. More...
 
void route_set_profile (struct route *this_, struct vehicleprofile *prof)
 Sets the vehicle profile of a route. More...
 
struct mapsetroute_get_mapset (struct route *this_)
 Returns the mapset of the route passed. More...
 
struct route_inforoute_get_pos (struct route *this_)
 Returns the current position within the route passed. More...
 
struct route_inforoute_get_dst (struct route *this_)
 Returns the destination of the route passed. More...
 
int route_get_path_set (struct route *this_)
 Checks if the path is calculated for the route passed. More...
 
int route_contains (struct route *this_, struct item *item)
 Checks if the route passed contains a certain item within the route path. More...
 
int route_destination_reached (struct route *this_)
 Checks if a route has reached its destination. More...
 
void route_set_position (struct route *this_, struct pcoord *pos)
 This sets the current position of the route passed. More...
 
void route_set_position_from_tracking (struct route *this_, struct tracking *tracking, enum projection pro)
 Sets a route's current position based on coordinates from tracking. More...
 
struct map_selectionroute_rect (int order, struct coord *c1, struct coord *c2, int rel, int abs)
 Returns a single map selection. More...
 
void route_set_destinations (struct route *this_, struct pcoord *dst, int count, int async)
 Sets the destination of a route. More...
 
int route_get_destinations (struct route *this_, struct pcoord *pc, int count)
 
int route_get_destination_count (struct route *this_)
 Get the destinations count for the route. More...
 
void route_get_distances (struct route *this_, struct coord *c, int count, int *distances)
 
void route_set_destination (struct route *this_, struct pcoord *dst, int async)
 Start a route given set of coordinates. More...
 
void route_append_destination (struct route *this_, struct pcoord *dst, int async)
 Append a waypoint to the route. More...
 
void route_remove_nth_waypoint (struct route *this_, int n)
 Remove the nth waypoint of the route. More...
 
void route_remove_waypoint (struct route *this_)
 
char * route_get_destination_description (struct route *this_, int n)
 Returns a description for a waypoint as (type or street_name_systematic) + (label or WayID[osm_wayid]) More...
 
struct coord route_get_coord_dist (struct route *this_, int dist)
 Returns a coordinate at a given distance. More...
 
struct street_datastreet_get_data (struct item *item)
 Gets street data for an item. More...
 
struct street_datastreet_data_dup (struct street_data *orig)
 Copies street data. More...
 
void street_data_free (struct street_data *sd)
 Frees street data. More...
 
void route_info_free (struct route_info *inf)
 Destroys a route_info. More...
 
struct street_dataroute_info_street (struct route_info *rinf)
 Returns street data for a route info. More...
 
struct maproute_get_map (struct route *this_)
 Returns a new map containing the route path. More...
 
struct maproute_get_graph_map (struct route *this_)
 Returns a new map containing the route graph. More...
 
enum route_path_flags route_get_flags (struct route *this_)
 Returns the flags for the route. More...
 
int route_has_graph (struct route *this_)
 Whether the route has a valid graph. More...
 
void route_set_projection (struct route *this_, enum projection pro)
 
int route_set_attr (struct route *this_, struct attr *attr)
 
int route_add_attr (struct route *this_, struct attr *attr)
 
int route_remove_attr (struct route *this_, struct attr *attr)
 
struct attr_iterroute_attr_iter_new (void)
 
void route_attr_iter_destroy (struct attr_iter *iter)
 
int route_get_attr (struct route *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 
void route_init (void)
 
void route_destroy (struct route *this_)
 

Detailed Description

Contains exported code for route.c.

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

This file contains code that works together with route.c and that is exported to other modules.

Enumeration Type Documentation

Enumerator
route_path_flag_none 
route_path_flag_cancel 
route_path_flag_async 
route_path_flag_no_rebuild 
Enumerator
route_status_no_destination 
route_status_destination_set 
route_status_not_found 
route_status_building_path 
route_status_building_graph 
route_status_path_done_new 
route_status_path_done_incremental 

Function Documentation

int route_add_attr ( struct route this_,
struct attr attr 
)
void route_append_destination ( struct route this,
struct pcoord dst,
int  async 
)

Append a waypoint to the route.

This appends a waypoint to the current route, targetting the street nearest to the coordinates passed, and updates the route.

Parameters
thisThe route to set the destination for
dstCoordinates of the new waypoint
asyncIf set, do routing asynchronously

References pcoord::pro, route_find_nearest_street(), route_get_dst(), route_graph_destroy(), route_info_distances(), route_path_update(), and route_set_destinations().

Referenced by navit_set_destination().

void route_attr_iter_destroy ( struct attr_iter iter)
struct attr_iter* route_attr_iter_new ( void  )
int route_contains ( struct route this,
struct item item 
)

Checks if the route passed contains a certain item within the route path.

This function checks if a certain items exists in the path that navit will guide the user to his destination. It does not check if this item exists in the route graph!

Parameters
thisThe route to check for this item
itemThe item to search for
Returns
True if the item was found, false if the item was not found or the route was not calculated

References item_hash_lookup(), item_is_equal, and startup::pos.

Referenced by tracking_is_on_route().

int route_destination_reached ( struct route this)

Checks if a route has reached its destination.

Parameters
thisThe route to be checked
Returns
True if the destination is "reached", false otherwise.

References AF_ONEWAY, AF_ONEWAYREV, street_data::flags, street_data::item, item_is_equal, route_info::lenneg, route_info::lenpos, route_info::lp, startup::pos, projection_none, route_next_destination(), route_projection(), route_info::street, and transform_distance().

Referenced by navit_vehicle_update_position().

struct route* route_dup ( struct route orig)

Duplicates a route object.

Returns
The duplicated route

References callback_list_new(), route::cbl2, route::destination_distance, route::flags, route::ms, navit_object_ref(), route_func, and route::vehicleprofile.

Referenced by request_route_dup().

struct coord route_get_coord_dist ( struct route this_,
int  dist 
)

Returns a coordinate at a given distance.

This function returns the coordinate, where the user will be if he follows the current route for a certain distance.

Parameters
this_The route we're driving upon
distThe distance in meters
Returns
The coordinate where the user will be in that distance

References route_path_segment::c, route_info::c, route_path_segment::data, int(), route_segment_data::len, route_path_segment::ncoords, route_path_segment::next, projection_none, route_get_dst(), route_projection(), transform_polyline_length(), coord::x, and coord::y.

int route_get_destination_count ( struct route this)

Get the destinations count for the route.

Parameters
thisThe route instance
Returns
destination count for the route

Referenced by navit_get_destination_count(), navit_remove_nth_waypoint(), navit_remove_waypoint(), navit_set_destination(), and navit_vehicle_update_position().

char* route_get_destination_description ( struct route this,
int  n 
)

Returns a description for a waypoint as (type or street_name_systematic) + (label or WayID[osm_wayid])

Parameters
thisThe route instance
nThe nth waypoint
Returns
The description

References _, attr_to_text(), item::id_hi, item::id_lo, item, street_data::item, item_attr_get(), item_to_name(), label, item::map, map_rect_destroy(), map_rect_get_item_byid(), map_rect_new(), route_info::street, item::type, type, and attr::type.

Referenced by navit_get_destination_description(), and navit_vehicle_update_position().

int route_get_destinations ( struct route this_,
struct pcoord pc,
int  count 
)
void route_get_distances ( struct route this_,
struct coord c,
int  count,
int distances 
)
struct route_info* route_get_dst ( struct route this)

Returns the destination of the route passed.

Parameters
thisThe route to get the destination for
Returns
The destination of the route passed

Referenced by rm_coord_get(), rm_rect_new(), route_append_destination(), route_get_attr(), route_get_coord_dist(), route_projection(), route_remove_nth_waypoint(), and route_set_destinations().

enum route_path_flags route_get_flags ( struct route this_)

Returns the flags for the route.

References route::flags.

Referenced by navigation_update().

struct map* route_get_graph_map ( struct route this_)

Returns a new map containing the route graph.

This function returns a new map containing the route graph.

Do not map_destroy() this!

Parameters
this_The route to get the map of
Returns
A new map containing the route graph

References route::graph_map, and route_get_map_helper().

Referenced by navigation_itm_new(), and navit_init().

struct map* route_get_map ( struct route this_)

Returns a new map containing the route path.

This function returns a new map containing the route path.

Do not map_destroy() this!

Parameters
this_The route to get the map of
Returns
A new map containing the route path

References route::map, and route_get_map_helper().

Referenced by gui_internal_cmd2_route_height_profile(), gui_internal_select_waypoint(), navigation_update(), navit_init(), navit_zoom_to_route(), route_get_attr(), route_get_map_py(), and vehicle_demo_timer().

struct mapset* route_get_mapset ( struct route this)

Returns the mapset of the route passed.

Parameters
thisThe route to get the mapset of
Returns
The mapset of the route passed
int route_get_path_set ( struct route this)

Checks if the path is calculated for the route passed.

Parameters
thisThe route to check
Returns
True if the path is calculated, false if not

Referenced by navit_check_route().

struct route_info* route_get_pos ( struct route this)

Returns the current position within the route passed.

Parameters
thisThe route to get the position for
Returns
The position within the route passed

References startup::pos.

Referenced by rm_rect_new().

int route_has_graph ( struct route this_)

Whether the route has a valid graph.

Returns
True if the route has a graph, false if not.

References route::graph.

Referenced by navigation_update_idle().

void route_info_free ( struct route_info inf)
struct street_data* route_info_street ( struct route_info rinf)

Returns street data for a route info.

Parameters
rinfThe route info to return the street data for
Returns
Street data for the route info

References route_info::street.

void route_init ( void  )

References route_graph_map_new(), and route_map_new().

Referenced by main_real().

struct route* route_new ( struct attr parent,
struct attr **  attrs 
)

Creates a completely new route structure.

Parameters
attrsNot used
Returns
The newly created route

References attr_generic_get_attr(), callback_list_new(), navit_object_ref(), attr::num, route_func, and attr::u.

int route_remove_attr ( struct route this_,
struct attr attr 
)
void route_remove_nth_waypoint ( struct route this,
int  n 
)

Remove the nth waypoint of the route.

Parameters
thisThe route instance
nThe waypoint to remove
Returns
nothing

References route_get_dst(), route_graph_destroy(), route_info_free(), and route_path_update().

Referenced by navit_remove_nth_waypoint().

void route_set_destination ( struct route this,
struct pcoord dst,
int  async 
)

Start a route given set of coordinates.

Parameters
thisThe route instance
dstThe coordinate to start routing to
asyncSet to 1 to do route calculation asynchronously
Returns
nothing

References route_set_destinations().

Referenced by navit_add_former_destinations_from_file(), navit_set_destination(), and route_set_attr().

void route_set_destinations ( struct route this_,
struct pcoord dst,
int  count,
int  async 
)

Sets the destination of a route.

This sets the destination of a route to the street nearest to the coordinates passed and updates the route.

Parameters
thisThe route to set the destination for
dstPoints to an array of coordinates to set as destinations, which will be visited in the order in which they appear in the array (the last one is the final destination)
countNumber of items in
dst
, 0 to clear all destinations
asyncIf set, do routing asynchronously

References callback_list_call_attr_1, attr::num, pcoord::pro, profile, route_clear_destinations(), route_find_nearest_street(), route_get_dst(), route_graph_destroy(), route_info_distances(), route_path_update(), route_set_attr(), route_status_destination_set, route_status_no_destination, attr::type, and attr::u.

Referenced by NGQProxyRoute::addDestination(), navit_add_former_destinations_from_file(), navit_set_destinations(), route_append_destination(), route_set_destination(), and route_set_profile().

void route_set_mapset ( struct route this,
struct mapset ms 
)

Sets the mapset of the route passwd.

Parameters
thisThe route to set the mapset for
msThe mapset to set for this route

Referenced by navit_init().

void route_set_position ( struct route this,
struct pcoord pos 
)

This sets the current position of the route passed.

This will set the current position of the route passed to the street that is nearest to the passed coordinates. It also automatically updates the route.

Parameters
thisThe route to set the position of
posCoordinates to set as position

References route_path_flag_async, and route_set_position_flags().

Referenced by navit_set_position(), navit_vehicle_update_position(), and route_set_attr().

void route_set_position_from_tracking ( struct route this,
struct tracking tracking,
enum projection  pro 
)
void route_set_profile ( struct route this,
struct vehicleprofile prof 
)

Sets the vehicle profile of a route.

Parameters
thisThe route to set the profile for
profThe vehicle profile

References route_get_destinations(), and route_set_destinations().

Referenced by navit_set_vehicle(), and navit_set_vehicleprofile().

void route_set_projection ( struct route this_,
enum projection  pro 
)

Referenced by navit_init().

struct street_data* street_data_dup ( struct street_data orig)

Copies street data.

Parameters
origThe street data to copy
Returns
The copied street data

References size.

Referenced by route_set_position_from_tracking().

struct street_data* street_get_data ( struct item item)

Gets street data for an item.

Parameters
itemThe item to get the data for
Returns
Street data for the item

References AF_SPEED_LIMIT, street_data::c, c, street_data::count, street_data::flags, item, street_data::item, item_attr_get(), item_coord_get(), item_get_default_flags(), street_data::maxspeed, attr::num, item::type, and attr::u.

Referenced by route_find_nearest_street().