GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73679
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
net_build.c File Reference

Vector library - related fns for vector network building. More...

#include <grass/dbmi.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Include dependency graph for net_build.c:

Go to the source code of this file.

Functions

int Vect_net_ttb_build_graph (struct Map_info *Map, int ltype, int afield, int nfield, int tfield, int tucfield, const char *afcol, const char *abcol, const char *ncol, int geo, int algorithm)
 Build network graph with turntable. More...
 
int Vect_net_build_graph (struct Map_info *Map, int ltype, int afield, int nfield, const char *afcol, const char *abcol, const char *ncol, int geo, int version)
 Build network graph. More...
 

Detailed Description

Vector library - related fns for vector network building.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2009, 2014 by 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.

Author
Radim Blazek
Stepan Turek stepan.turek seznam.cz (turns support)

Definition in file net_build.c.

Function Documentation

int Vect_net_build_graph ( struct Map_info Map,
int  ltype,
int  afield,
int  nfield,
const char *  afcol,
const char *  abcol,
const char *  ncol,
int  geo,
int  version 
)

Build network graph.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000 and for lengths LL without geo flag by 1000000. The same multiplication factor is used for nodes. Costs in database column may be 'integer' or 'double precision' number >= 0 or -1 for infinity i.e. arc or node is closed and cannot be traversed If record in table is not found for arcs, arc is skip. If record in table is not found for node, costs for node are set to 0.

Parameters
Mapvector map
ltypeline type for arcs
afieldarc costs field (if 0, use length)
nfieldnode costs field (if 0, do not use node costs)
afcolcolumn with forward costs for arc
abcolcolumn with backward costs for arc (if NULL, back costs = forward costs),
ncolcolumn with costs for nodes (if NULL, do not use node costs),
geouse geodesic calculation for length (LL),
versiongraph version to create (1, 2, 3)
Returns
0 on success, 1 on error

Definition at line 695 of file net_build.c.

References _, bound_box::B, cat, Graph_info::cost_multip, field_info::database, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, db_CatValArray_free(), db_CatValArray_get_value_double(), db_CatValArray_get_value_int(), db_CatValArray_init(), db_close_database_shutdown_driver(), db_get_column(), db_get_column_sqltype(), db_init_handle(), db_init_string(), DB_OK, db_select_CatValArray(), db_sqltype_to_Ctype(), db_start_driver_open_database(), dglAddEdge(), dglFlatten(), dglGetNode(), dglInitialize(), dglInitializeSPCache(), dglNodeSet_Attr(), Map_info::dgraph, field_info::driver, bound_box::E, Graph_info::edge_bcosts, Graph_info::edge_fcosts, G_debug(), G_fatal_error(), G_message(), G_percent(), G_projection(), G_warning(), Graph_info::graph_s, GV_BOUNDARY, GV_LINE, GV_POINT, boxlist::id, field_info::key, Graph_info::line_type, bound_box::N, boxlist::n_values, Graph_info::node_costs, NULL, bound_box::S, Graph_info::spCache, bound_box::T, field_info::table, Vect_cat_get(), Vect_destroy_boxlist(), Vect_get_field(), Vect_get_line_nodes(), Vect_get_node_coor(), Vect_get_num_lines(), Vect_get_num_nodes(), Vect_line_geodesic_length(), Vect_line_length(), Vect_new_boxlist(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_select_lines_by_box(), bound_box::W, and x.

int Vect_net_ttb_build_graph ( struct Map_info Map,
int  ltype,
int  afield,
int  nfield,
int  tfield,
int  tucfield,
const char *  afcol,
const char *  abcol,
const char *  ncol,
int  geo,
int  algorithm 
)

Build network graph with turntable.

Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000 and for lengths LL without geo flag by 1000000. The same multiplication factor is used for nodes. Costs in database column may be 'integer' or 'double precision' number >= 0 or -1 for infinity i.e. arc or node is closed and cannot be traversed If record in table is not found for arcs, costs for arc are set to 0. If record in table is not found for node, costs for node are set to 0.

Parameters
Mapvector map
ltypeline type for arcs
afieldarc costs field (if 0, use length)
nfieldnode costs field (if 0, do not use node costs)
tfieldfield where turntable is attached
tucfieldfield with unique categories used in the turntable
afcolcolumn with forward costs for arc
abcolcolumn with backward costs for arc (if NULL, back costs = forward costs),
ncolcolumn with costs for nodes (if NULL, do not use node costs),
geouse geodesic calculation for length (LL),
algorithmnot used (in future code for algorithm)
Returns
0 on success, 1 on error

Definition at line 48 of file net_build.c.

References _, bound_box::B, cat, Graph_info::cost_multip, field_info::database, DB_C_TYPE_DOUBLE, DB_C_TYPE_INT, db_CatValArray_free(), db_CatValArray_get_value_double(), db_CatValArray_get_value_int(), db_CatValArray_init(), db_close_database_shutdown_driver(), db_get_column(), db_get_column_sqltype(), db_init_handle(), db_init_string(), DB_OK, db_select_CatValArray(), db_sqltype_to_Ctype(), db_start_driver_open_database(), dglAddEdge(), dglFlatten(), dglGetNode(), dglInitialize(), dglInitializeSPCache(), dglNodeSet_Attr(), Map_info::dgraph, field_info::driver, bound_box::E, Graph_info::edge_bcosts, Graph_info::edge_fcosts, G_debug(), G_fatal_error(), G_message(), G_percent(), G_projection(), G_warning(), Graph_info::graph_s, GV_BOUNDARY, GV_LINE, GV_POINT, boxlist::id, if(), field_info::key, Graph_info::line_type, bound_box::N, boxlist::n_values, Graph_info::node_costs, NULL, bound_box::S, Graph_info::spCache, t, bound_box::T, field_info::table, Vect_cat_get(), Vect_cidx_find_next(), Vect_cidx_get_field_index(), Vect_destroy_boxlist(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_find_node(), Vect_get_field(), Vect_get_line_nodes(), Vect_get_node_coor(), Vect_get_node_line(), Vect_get_node_n_lines(), Vect_get_num_lines(), Vect_get_num_nodes(), Vect_line_geodesic_length(), Vect_line_length(), Vect_new_boxlist(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_select_lines_by_box(), bound_box::W, WITHOUT_Z, x, line_pnts::x, line_pnts::y, and line_pnts::z.