GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72996
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vector/Vlib/find.c File Reference

Vector library - Find nearest vector feature. More...

#include <stdlib.h>
#include <math.h>
#include <grass/vector.h>
Include dependency graph for vector/Vlib/find.c:

Go to the source code of this file.

Macros

#define HUGE_VAL   9999999999999.0
 

Functions

int Vect_find_node (struct Map_info *Map, double ux, double uy, double uz, double maxdist, int with_z)
 Find the nearest node. More...
 
int Vect_find_line (struct Map_info *map, double ux, double uy, double uz, int type, double maxdist, int with_z, int exclude)
 Find the nearest line. More...
 
int Vect_find_line_list (struct Map_info *map, double ux, double uy, double uz, int type, double maxdist, int with_z, const struct ilist *exclude, struct ilist *found)
 Find the nearest line(s). More...
 
int Vect_find_area (struct Map_info *Map, double x, double y)
 Find the nearest area. More...
 
int Vect_find_island (struct Map_info *Map, double x, double y)
 Find the nearest island. More...
 

Detailed Description

Vector library - Find nearest vector feature.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2009 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
Original author CERL, probably Dave Gerdes or Mike Higgins.
Update to GRASS 5.7 Radim Blazek and David D. Gray.

Definition in file vector/Vlib/find.c.

Macro Definition Documentation

#define HUGE_VAL   9999999999999.0

Definition at line 22 of file vector/Vlib/find.c.

Referenced by Vect_find_line_list(), and Vect_find_node().

Function Documentation

int Vect_find_island ( struct Map_info Map,
double  x,
double  y 
)
int Vect_find_line ( struct Map_info map,
double  ux,
double  uy,
double  uz,
int  type,
double  maxdist,
int  with_z,
int  exclude 
)

Find the nearest line.

Parameters
mapvector map
ux,uy,uzpoints coordinates
typefeature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
excludeif > 0 number of line which should be excluded from selection. May be useful if we need line nearest to other one.
Returns
number of nearest line
0 if not found

Definition at line 129 of file vector/Vlib/find.c.

References NULL, Vect_destroy_list(), Vect_find_line_list(), Vect_list_append(), and Vect_new_list().

Referenced by Vect_net_nearest_nodes(), and Vedit_snap_point().

int Vect_find_line_list ( struct Map_info map,
double  ux,
double  uy,
double  uz,
int  type,
double  maxdist,
int  with_z,
const struct ilist exclude,
struct ilist found 
)

Find the nearest line(s).

Parameters
mapvector map
ux,uy,uzpoints coordinates
typefeature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
excludelist of lines which should be excluded from selection
foundlist of found lines (or NULL)
Returns
number of nearest line
0 if not found

Definition at line 164 of file vector/Vlib/find.c.

References bound_box::B, bound_box::E, G_debug(), HUGE_VAL, boxlist::id, bound_box::N, boxlist::n_values, NULL, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, Vect_destroy_boxlist(), Vect_line_distance(), Vect_list_append(), Vect_new_boxlist(), Vect_new_line_struct(), Vect_read_line(), Vect_reset_list(), Vect_select_lines_by_box(), Vect_val_in_list(), and bound_box::W.

Referenced by Vect_find_line(), Vedit_connect_lines(), Vedit_extend_lines(), and Vedit_merge_lines().

int Vect_find_node ( struct Map_info Map,
double  ux,
double  uy,
double  uz,
double  maxdist,
int  with_z 
)

Find the nearest node.

Parameters
Mapvector map
ux,uy,uzpoint coordinates
maxdistmax distance from the line
with_z3D (WITH_Z, WITHOUT_Z)
Returns
number of nearest node
0 if not found

Definition at line 58 of file vector/Vlib/find.c.

References bound_box::B, bound_box::E, G_debug(), HUGE_VAL, bound_box::N, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, ilist::value, Vect_get_node_coor(), Vect_new_list(), Vect_points_distance(), Vect_select_nodes_by_box(), bound_box::W, and x.

Referenced by NetA_points_to_nodes(), NetA_varray_to_nodes(), and Vect_net_ttb_build_graph().