GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vedit/snap.c File Reference

Vedit library - snapping. More...

#include <grass/vedit.h>
Include dependency graph for vedit/snap.c:

Go to the source code of this file.

Functions

int Vedit_snap_point (struct Map_info *Map, int line, double *x, double *y, double *z, double thresh, int vertex)
 Snap given point to the nearest primitive. More...
 
int Vedit_snap_line (struct Map_info *Map, struct Map_info **BgMap, int nbgmaps, int line, struct line_pnts *Points, double thresh, int to_vertex)
 Snap selected primitive to its nearest primitive. More...
 
int Vedit_snap_lines (struct Map_info *Map, struct Map_info **BgMap, int nbgmaps, struct ilist *List, double thresh, int to_vertex)
 Snap lines/boundaries. More...
 

Detailed Description

Vedit library - snapping.

(C) 2007-2008 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
Martin Landa <landa.martin gmail.com>

Definition in file vedit/snap.c.

Function Documentation

int Vedit_snap_line ( struct Map_info Map,
struct Map_info **  BgMap,
int  nbgmaps,
int  line,
struct line_pnts Points,
double  thresh,
int  to_vertex 
)

Snap selected primitive to its nearest primitive.

Parameters
Mappointer to Map_info
BgMap,nbgmapslist of background maps used for snapping
lineline id to be snapped (if already written, otherwise -1)
Pointsline geometry
layerlayer number
threshthreshold value used for snapping (>0)
to_vertexallow snapping also to vertex
Returns
1 line snapped
0 line not snapped
-1 line is dead (if 'line' is > 0)

Definition at line 99 of file vedit/snap.c.

References G_debug(), line_pnts::n_points, Vect_destroy_cats_struct(), Vect_line_alive(), Vect_new_cats_struct(), Vect_points_distance(), Vedit_snap_point(), WITHOUT_Z, x, line_pnts::x, line_pnts::y, and line_pnts::z.

Referenced by Vedit_snap_lines().

int Vedit_snap_lines ( struct Map_info Map,
struct Map_info **  BgMap,
int  nbgmaps,
struct ilist List,
double  thresh,
int  to_vertex 
)

Snap lines/boundaries.

Parameters
Mappointer to Map_info
BgMap,nbgmapslist of background maps used for snapping
Listlist of lines to be snapped
layerlayer number
threshthreshold value used for snapping (>0)
to_vertexallow snapping also to vertex
Returns
number of snapped lines
-1 on error

Definition at line 175 of file vedit/snap.c.

References GV_LINES, GV_POINT, ilist::n_values, ilist::value, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_rewrite_line(), and Vedit_snap_line().

int Vedit_snap_point ( struct Map_info Map,
int  line,
double *  x,
double *  y,
double *  z,
double  thresh,
int  vertex 
)

Snap given point to the nearest primitive.

Parameters
Mappointer to Map_info
lineline to be excluded (point on line)
x,y,zpoint on line to be snapped
threshsnapping threshold (>0)
vertexsnap also to vertex (non-zero)
Returns
1 snapped
0 not snapped

Definition at line 28 of file vedit/snap.c.

References G_debug(), line_pnts::n_points, Map_info::name, NULL, Vect_destroy_line_struct(), Vect_find_line(), Vect_line_alive(), Vect_new_line_struct(), Vect_points_distance(), Vect_read_line(), WITHOUT_Z, line_pnts::x, line_pnts::y, and line_pnts::z.

Referenced by Vedit_move_lines(), Vedit_move_vertex(), and Vedit_snap_line().