Navit SVN
Classes | Enumerations | Functions

/work/compile/navit/src/navit/route.h File Reference

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

Go to the source code of this file.

Classes

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

Enumerations

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.
void route_set_mapset (struct route *this_, struct mapset *ms)
 Sets the mapset of the route passwd.
void route_set_profile (struct route *this_, struct vehicleprofile *prof)
 Sets the vehicle profile of a route.
struct mapsetroute_get_mapset (struct route *this_)
 Returns the mapset of the route passed.
struct route_inforoute_get_pos (struct route *this_)
 Returns the current position within the route passed.
struct route_inforoute_get_dst (struct route *this_)
 Returns the destination of the route passed.
int route_get_path_set (struct route *this_)
 Checks if the path is calculated for the route passed.
int route_contains (struct route *this_, struct item *item)
 Checks if the route passed contains a certain item within the route path.
int route_destination_reached (struct route *this_)
 Checks if a route has reached its destination.
void route_set_position (struct route *this_, struct pcoord *pos)
 This sets the current position of the route passed.
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.
struct map_selectionroute_rect (int order, struct coord *c1, struct coord *c2, int rel, int abs)
 Returns a single map selection.
void route_set_destinations (struct route *this_, struct pcoord *dst, int count, int async)
 Sets the destination of a route.
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.
void route_set_destination (struct route *this_, struct pcoord *dst, int async)
 Start a route given set of coordinates.
void route_append_destination (struct route *this_, struct pcoord *dst, int async)
 Append a given set of coordinates for route computing.
void route_remove_nth_waypoint (struct route *this_, int n)
 Remove the nth waypoint of the route.
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])
struct coord route_get_coord_dist (struct route *this_, int dist)
 Returns a coordinate at a given distance.
struct street_datastreet_get_data (struct item *item)
 Gets street data for an item.
struct street_datastreet_data_dup (struct street_data *orig)
 Copies street data.
void street_data_free (struct street_data *sd)
 Frees street data.
void route_info_free (struct route_info *inf)
 Destroys a route_info.
struct street_dataroute_info_street (struct route_info *rinf)
 Returns street data for a route info.
struct maproute_get_map (struct route *this_)
 Returns a new map containing the route path.
struct maproute_get_graph_map (struct route *this_)
 Returns a new map containing the route graph.
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.


Function Documentation

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

Append a given set of coordinates for route computing.

Parameters:
thisThe route instance
cThe coordinate to start routing to
async1 for async
Returns:
nothing

References route_get_dst(), and route_set_destinations().

Referenced by navit_set_destination().

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 route_info::pos.

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 street_data::item, route_info::lenneg, route_info::lenpos, route_info::lp, route_info::pos, and route_info::street.

struct coord route_get_coord_dist ( struct route this_,
int  dist 
) [read]

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_info::c, route_path_segment::c, route_path_segment::data, route_segment_data::len, route_path_segment::ncoords, route_path_segment::next, route_get_dst(), 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_set_destination().

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 street_data::item, map_rect_destroy(), map_rect_get_item_byid(), map_rect_new(), and route_info::street.

struct route_info* route_get_dst ( struct route this) [read]

Returns the destination of the route passed.

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

Referenced by route_append_destination(), route_get_coord_dist(), route_remove_nth_waypoint(), and route_set_destinations().

struct map* route_get_graph_map ( struct route this_) [read]

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
struct map* route_get_map ( struct route this_) [read]

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
struct mapset* route_get_mapset ( struct route this) [read]

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) [read]

Returns the current position within the route passed.

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

References route_info::pos.

void route_info_free ( struct route_info inf)

Destroys a route_info.

Parameters:
infoThe route info to be destroyed

References route_info::street, and street_data_free().

Referenced by route_remove_nth_waypoint(), route_set_position(), and route_set_position_from_tracking().

struct street_data* route_info_street ( struct route_info rinf) [read]

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.

struct route* route_new ( struct attr parent,
struct attr **  attrs 
) [read]

Creates a completely new route structure.

Parameters:
attrsNot used
Returns:
The newly created route
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(), and route_info_free().

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

Start a route given set of coordinates.

Parameters:
thisThe route instance
cThe coordinate to start routing to
async1 for async
Returns:
nothing

References route_set_destinations().

Referenced by navit_set_destination().

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
dstCoordinates to set as destination
count,:Number of destinations (last one is final)
async,:If set, do routing asynchronously

References route_get_dst().

Referenced by 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
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_info_free().

Referenced by navit_set_position().

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.

Parameters:
thisThe route to set the current position of
trackingThe tracking to get the coordinates from

References street_data::c, route_info::c, street_data::count, street_data::item, route_info::lenneg, route_info::lenpos, route_info::lp, route_info::pos, route_info_free(), route_info::street, street_data_dup(), route_info::street_direction, coord::x, and coord::y.

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_set_destinations().

struct street_data* street_data_dup ( struct street_data orig) [read]

Copies street data.

Parameters:
origThe street data to copy
Returns:
The copied street data

Referenced by route_set_position_from_tracking().

void street_data_free ( struct street_data sd)

Frees street data.

Parameters:
sdStreet data to be freed

Referenced by route_info_free().

struct street_data* street_get_data ( struct item item) [read]

Gets street data for an item.

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

References street_data::c, street_data::count, street_data::item, and street_data::maxspeed.