GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-847944e18e
|
Network Analysis library - utils. More...
#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include <grass/dbmi.h>
#include <grass/neta.h>
Go to the source code of this file.
Functions | |
void | NetA_add_point_on_node (struct Map_info *In, struct Map_info *Out, int node, struct line_cats *Cats) |
Writes point. More... | |
void | NetA_points_to_nodes (struct Map_info *In, struct ilist *point_list) |
Finds node. More... | |
int | NetA_get_node_costs (struct Map_info *In, int layer, char *column, int *node_costs) |
Get node cost. More... | |
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. More... | |
int | NetA_initialise_varray (struct Map_info *In, int layer, int mask_type, char *where, char *cat, struct varray **varray) |
Initialize varray. More... | |
Network Analysis library - utils.
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 utils.c.
int NetA_get_node_costs | ( | struct Map_info * | In, |
int | layer, | ||
char * | column, | ||
int * | node_costs | ||
) |
Get node cost.
For each node in the map, finds the category of the point on it (if there is any) and stores the value associated with this category in the array node_costs. If there is no point with a category, node_costs=0.
node_costs are multiplied by the graph's cost multiplier and truncated to integers (as is done in Vect_net_build_graph)
In | pointer to Map_info structure | |
layer | layer number | |
column | name of column | |
[out] | node_costs | list of node costs |
int NetA_initialise_varray | ( | struct Map_info * | In, |
int | layer, | ||
int | mask_type, | ||
char * | where, | ||
char * | cat, | ||
struct varray ** | varray | ||
) |
Initialize varray.
In | pointer to Map_info structure | |
layer | layer number | |
mask_type | ? | |
where | where statement | |
cat | ? | |
[out] | pointer | to varray structure |
Definition at line 239 of file utils.c.
References _, line_cats::cat, G_fatal_error(), G_warning(), NULL, Vect_cat_get(), Vect_destroy_cats_struct(), Vect_get_num_lines(), Vect_new_cats_struct(), Vect_new_varray(), Vect_read_line(), Vect_set_varray_from_cat_string(), and Vect_set_varray_from_db().
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.
Returns the list of all nodes on features selected by varray. nodes_to_features contains the index of a feature adjacent to each node or -1 if no such feature specified by varray exists. Nodes_to_features might be NULL, in which case it is left unitialised. Nodes_to_features will be wrong if several lines connect to the same node.
map | pointer to Map_info structure | |
varray | pointer to varray structure | |
[out] | nodes | list of node ids |
[out] | nodes_to_features | maps nodes to features |