GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
Network Analysis library - timetables. More...
#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
#include <grass/dgl/graph.h>
#include <grass/neta.h>
Go to the source code of this file.
Data Structures | |
struct | neta_heap_data |
Functions | |
int | NetA_init_distinct (dbDriver *driver, dbString *sql, int **lengths, int **ids) |
Get number of distinct elements. More... | |
int | NetA_init_timetable_from_db (struct Map_info *In, int route_layer, int walk_layer, char *route_id, char *times, char *to_stop, char *walk_length, neta_timetable *timetable, int **route_ids, int **stop_ids) |
Initialises timetable from a database. More... | |
void | NetA_update_dijkstra (int old_conns, int new_conns, int to, int new_dst, int v, int route, int rows, int update, neta_timetable_result *result, dglHeap_s *heap) |
Update Dijkstra structures. More... | |
int | NetA_timetable_shortest_path (neta_timetable *timetable, int from_stop, int to_stop, int start_time, int min_change, int max_changes, int walking_change, neta_timetable_result *result) |
Computes the earliest arrival time. More... | |
int | NetA_timetable_get_route_time (neta_timetable *timetable, int stop, int route) |
Get time. More... | |
void | NetA_timetable_result_release (neta_timetable_result *result) |
Free neta_timetable_result structure. More... | |
Network Analysis library - timetables.
Network Analysis library - utils.
Shortest path using timetables.
(C) 2009-2010 by Daniel Bundala, and the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Utils subroutines.
(C) 2009-2010 by Daniel Bundala, and the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file timetables.c.
Get number of distinct elements.
driver | DB driver | |
sql | SQl string | |
[out] | list | of lengths |
[out] | list | of ids |
Definition at line 36 of file timetables.c.
References count, db_close_cursor(), db_fetch(), db_get_column_value(), db_get_cursor_table(), db_get_string(), db_get_table_column(), db_get_value_int(), db_open_select_cursor(), G_warning(), and value.
Referenced by NetA_init_timetable_from_db().
int NetA_init_timetable_from_db | ( | struct Map_info * | In, |
int | route_layer, | ||
int | walk_layer, | ||
char * | route_id, | ||
char * | times, | ||
char * | to_stop, | ||
char * | walk_length, | ||
neta_timetable * | timetable, | ||
int ** | route_ids, | ||
int ** | stop_ids | ||
) |
Initialises timetable from a database.
In | pointer to Map_info structure |
route_layer | layer number of routes |
walk_layer | layer number of walkers |
route_id | id of route |
times | list of timestamps |
to_stop | ? |
walk_length | walk length as string |
timetable | pointer to neta_timetable |
route_ids | list of route ids |
stop_ids | lits of stop ids |
Definition at line 113 of file timetables.c.
References buf, db_close_cursor(), db_close_database_shutdown_driver(), db_fetch(), db_get_column_value(), db_get_cursor_table(), db_get_string(), db_get_table_column(), db_get_value_int(), db_init_string(), db_open_select_cursor(), db_set_string(), db_start_driver_open_database(), driver, G_fatal_error(), G_warning(), NetA_init_distinct(), NULL, sprintf(), value, and Vect_get_field().
Get time.
Get time when route "route" arrives at stop "stop" or -1.
timetable | pointer to neta_timetable structure |
stop | 'stop' node id |
route | route id |
Definition at line 534 of file timetables.c.
void NetA_timetable_result_release | ( | neta_timetable_result * | result | ) |
Free neta_timetable_result structure.
result | pointer to neta_timetable_result structure |
Definition at line 550 of file timetables.c.
References G_free().
int NetA_timetable_shortest_path | ( | neta_timetable * | timetable, |
int | from_stop, | ||
int | to_stop, | ||
int | start_time, | ||
int | min_change, | ||
int | max_changes, | ||
int | walking_change, | ||
neta_timetable_result * | result | ||
) |
Computes the earliest arrival time.
Computes the earliest arrival time to to_stop from from_stop starting at start_time, or -1 if no path exists
timetable | pointer to neta_timetable structure | |
from_stop | 'from' node | |
to_stop | 'to' stop | |
start_time | start timestamp | |
min_change | ? | |
max_changes | ? | |
walking_change | ? | |
[out] | result | pointer to neta_timetable_result |
Definition at line 392 of file timetables.c.
References dglHeapExtractMin(), dglHeapFree(), dglHeapInit(), dglHeapInsertMin(), G_warning(), _dglHeapNode::key, NetA_update_dijkstra(), NULL, _dglHeapData::pv, dialogs::update(), and _dglHeapNode::value.
void NetA_update_dijkstra | ( | int | old_conns, |
int | new_conns, | ||
int | to, | ||
int | new_dst, | ||
int | v, | ||
int | route, | ||
int | rows, | ||
int | update, | ||
neta_timetable_result * | result, | ||
dglHeap_s * | heap | ||
) |
Update Dijkstra structures.
olc_conns | old connection | |
new_conns | new connection | |
to | old 'to' node | |
new_dst | new 'to' node | |
v | ? | |
route | id of route | |
rows | ? | |
update | ? | |
[out] | result | pointer to neta_timetable_result structure |
heap | ? |
Definition at line 355 of file timetables.c.
References dglHeapInsertMin(), and _dglHeapData::pv.
Referenced by NetA_timetable_shortest_path().