78 for (i = 0; i < point_list->
n_values; i++) {
82 point_list->
value[i] = node;
109 int i, nlines, nnodes;
119 G_fatal_error(
_(
"Database connection not defined for layer %d"), layer);
128 for (i = 1; i <= nnodes; i++)
143 for (i = 1; i <= nlines; i++) {
155 node_costs[node] = -1;
184 struct ilist *nodes,
int *nodes_to_features)
186 int nlines, nnodes, i;
191 if (nodes_to_features)
192 for (i = 1; i <= nnodes; i++)
193 nodes_to_features[i] = -1;
195 for (i = 1; i <= nlines; i++) {
206 if (nodes_to_features)
207 nodes_to_features[node] = i;
210 G_warning(
_(
"Point %d is not connected!"), i);
218 if (nodes_to_features)
219 nodes_to_features[node1] = nodes_to_features[node2] = i;
254 G_warning(
_(
"'where' and 'cats' parameters were supplied, cat will "
258 G_warning(
_(
"Unable to load data from database"));
266 G_warning(
_(
"Problem loading category values"));
277 for (i = 1; i <= n; i++) {
280 if (!(ltype & mask_type))
void db_CatValArray_free(dbCatValArray *)
Free allocated dbCatValArray.
void db_CatValArray_init(dbCatValArray *)
Initialize dbCatValArray.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
int db_close_database_shutdown_driver(dbDriver *)
Close driver/database connection.
int db_select_CatValArray(dbDriver *, const char *, const char *, const char *, const char *, dbCatValArray *)
Select pairs key/value to array, values are sorted by key (must be integer)
int db_CatValArray_get_value_double(dbCatValArray *, int, double *)
Find value (double) by key.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
int Vect_get_line_nodes(struct Map_info *, int, int *, int *)
Get line nodes.
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
plus_t Vect_get_num_lines(struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
int Vect_set_varray_from_db(struct Map_info *, int, const char *, int, int, struct varray *)
Set values in 'varray' to 'value' from DB (where statement)
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
struct varray * Vect_new_varray(int)
Create new struct varray and allocate space for given number of items.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
struct field_info * Vect_get_field(struct Map_info *, int)
Get information about link to database (by layer number)
void Vect_destroy_field_info(struct field_info *)
Free a struct field_info and all memory associated with it.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
plus_t Vect_get_num_nodes(struct Map_info *)
Get number of nodes in vector map.
int Vect_set_varray_from_cat_string(struct Map_info *, int, const char *, int, int, struct varray *)
Set values in 'varray' to 'value' from category string.
int Vect_find_node(struct Map_info *, double, double, double, double, int)
Find the nearest node.
void Vect_reset_line(struct line_pnts *)
Reset line.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
#define GV_POINT
Feature types used in memory on run time (may change)
const struct driver * driver
int cost_multip
Edge and node costs multiplicator.
struct Graph_info dgraph
Graph info (built for network analysis)
Layer (old: field) information.
char * table
Name of DB table.
char * driver
Name of DB driver ('sqlite', 'dbf', ...)
char * key
Name of key column (usually 'cat')
int n_values
Number of values in the list.
int * value
Array of values.
int * cat
Array of categories.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
double * z
Array of Z coordinates.
void NetA_points_to_nodes(struct Map_info *In, struct ilist *point_list)
Finds node.
void NetA_add_point_on_node(struct Map_info *In, struct Map_info *Out, int node, struct line_cats *Cats)
Writes point.
void NetA_varray_to_nodes(struct Map_info *map, struct varray *varray, struct ilist *nodes, int *nodes_to_features)
Get list of nodes from varray.
int NetA_initialise_varray(struct Map_info *In, int layer, int mask_type, char *where, char *cat, struct varray **varray)
Initialize varray.
int NetA_get_node_costs(struct Map_info *In, int layer, char *column, int *node_costs)
Get node cost.