GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
vedit.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int Vedit_split_lines (struct Map_info *, struct ilist *, struct line_pnts *, double, struct ilist *)
 Split selected lines on given position.
 
int Vedit_connect_lines (struct Map_info *, struct ilist *, double)
 Connect lines in given threshold.
 
int Vedit_extend_lines (struct Map_info *, struct ilist *, int, int, double)
 Extend lines in given threshold.
 
int Vedit_modify_cats (struct Map_info *, struct ilist *, int, int, struct cat_list *)
 Add / remove categories.
 
int Vedit_copy_lines (struct Map_info *, struct Map_info *, struct ilist *)
 Copy selected primitives.
 
int Vedit_chtype_lines (struct Map_info *, struct ilist *)
 Change primitive type.
 
int Vedit_delete_lines (struct Map_info *, struct ilist *)
 Delete selected features.
 
int Vedit_delete_area_centroid (struct Map_info *, int)
 Delete area (centroid and set of boundaries) by centroid.
 
int Vedit_delete_area (struct Map_info *, int)
 Delete area (centroid + set of boundaries) by id.
 
int Vedit_delete_areas_cat (struct Map_info *, int, int)
 Delete vector areas of given category.
 
double Vedit_get_min_distance (struct line_pnts *, struct line_pnts *, int, int *)
 Calculate distances between two lines.
 
int Vedit_flip_lines (struct Map_info *, struct ilist *)
 Flip direction of selected lines.
 
int Vedit_merge_lines (struct Map_info *, struct ilist *)
 Merge lines/boundaries.
 
int Vedit_move_lines (struct Map_info *, struct Map_info **, int, struct ilist *, double, double, double, int, double)
 Move selected primitives.
 
struct robject_listVedit_render_map (struct Map_info *, struct bound_box *, int, double, double, int, int, double)
 Render vector features into list.
 
int Vedit_select_by_query (struct Map_info *, int, int, double, int, struct ilist *)
 Select primitives by query (based on geometry properties)
 
int Vedit_snap_point (struct Map_info *, int, double *, double *, double *, double, int)
 Snap given point to the nearest primitive.
 
int Vedit_snap_line (struct Map_info *, struct Map_info **, int, int, struct line_pnts *, double, int)
 Snap selected primitive to its nearest primitive.
 
int Vedit_snap_lines (struct Map_info *, struct Map_info **, int, struct ilist *, double, int)
 Snap lines/boundaries.
 
int Vedit_move_vertex (struct Map_info *, struct Map_info **, int, struct ilist *, struct line_pnts *, double, double, double, double, double, int, int)
 Move all vertices in bounding box(es)
 
int Vedit_add_vertex (struct Map_info *Map, struct ilist *, struct line_pnts *, double)
 Add new vertex to line.
 
int Vedit_remove_vertex (struct Map_info *, struct ilist *, struct line_pnts *, double)
 Remove vertex from line.
 
int Vedit_bulk_labeling (struct Map_info *, struct ilist *, double, double, double, double, double, double)
 Lines z-bulk labeling.
 

Function Documentation

◆ Vedit_add_vertex()

int Vedit_add_vertex ( struct Map_info Map,
struct ilist List,
struct line_pnts coord,
double  thresh 
)

Add new vertex to line.

Shape of line is not changed.

Todo:
3D
Parameters
Mappointer to Map_info
Listlist of lines
coordpoints location
threshfind line in given threshold
Returns
number of add vertices
-1 on error

Definition at line 189 of file vertex.c.

References FALSE, G_debug(), GV_LINES, NULL, TRUE, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_line_distance(), Vect_line_insert_point(), Vect_line_prune(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_points_distance(), Vect_read_line(), Vect_rewrite_line(), WITHOUT_Z, line_pnts::x, x, line_pnts::y, and line_pnts::z.

◆ Vedit_bulk_labeling()

int Vedit_bulk_labeling ( struct Map_info Map,
struct ilist List,
double  x1,
double  y1,
double  x2,
double  y2,
double  start,
double  step 
)

Lines z-bulk labeling.

Automated labeling (z coordinate assignment) of vector lines (iso-lines).

Parameters
Mappointer to Map_info
Listlist of selected lines
x1,y1,x2,y2staring and ending point
startstarting value
stepstep value
Returns
number of modified features
-1 on error

Definition at line 32 of file zbulk.c.

References dbCatVal::cat, dbCatValArray::ctype, DB_C_TYPE_DOUBLE, db_CatValArray_alloc(), db_CatValArray_free(), db_CatValArray_sort_by_value(), GV_LINE, line_pnts::n_points, dbCatValArray::n_values, NULL, PORT_DOUBLE_MAX, dbCatVal::val, dbCatValArray::value, Vect_append_point(), Vect_delete_line(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_line_box(), Vect_line_check_intersection(), Vect_line_intersection(), Vect_line_length(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_rewrite_line(), Vect_write_line(), WITH_Z, WITHOUT_Z, and line_pnts::z.

◆ Vedit_chtype_lines()

int Vedit_chtype_lines ( struct Map_info Map,
struct ilist List 
)

Change primitive type.

Supported conversions:

  • point <-> centroid
  • line <-> boundary
Parameters
Mappointer to Map_info
Listlist of selected primitives
Returns
number of modified primitives
-1 on error

Definition at line 29 of file chtype.c.

References G_debug(), GV_BOUNDARY, GV_CENTROID, GV_LINE, GV_POINT, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), and Vect_rewrite_line().

◆ Vedit_connect_lines()

int Vedit_connect_lines ( struct Map_info Map,
struct ilist List,
double  thresh 
)

Connect lines in given threshold.

\ \
id1 \ -> \
\
id2 --------- -----+---

If two lines are selected and thresh is -1, no limit is applied.

Parameters
Mappointer to Map_info
Listlist of selected lines
threshthreshold value
Returns
number of modified lines
-1 on error

Definition at line 158 of file break.c.

References G_debug(), GV_LINES, GV_POINTS, Vect_destroy_list(), Vect_find_line_list(), Vect_get_line_nodes(), Vect_get_line_type(), Vect_get_node_coor(), Vect_line_alive(), Vect_list_append(), Vect_new_list(), Vect_reset_list(), WITHOUT_Z, and x.

◆ Vedit_copy_lines()

int Vedit_copy_lines ( struct Map_info Map,
struct Map_info FromMap,
struct ilist List 
)

Copy selected primitives.

Parameters
Mappointer to Map_info copy to
FromMapvector map copy from (if not given use Map)
Listlist of selected primitives (to be copied)
Returns
number of copied primitives
-1 on error

Definition at line 27 of file vector/vedit/copy.c.

References G_debug(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), and Vect_write_line().

◆ Vedit_delete_area()

int Vedit_delete_area ( struct Map_info Map,
int  area 
)

Delete area (centroid + set of boundaries) by id.

Parameters
Mappointer to Map_info struct
areaid
Returns
0 no area deleted
1 area deleted

Definition at line 92 of file vector/vedit/delete.c.

References _, G_debug(), G_warning(), Vect_delete_line(), Vect_destroy_list(), Vect_get_area_boundaries(), Vect_get_area_centroid(), Vect_get_line_areas(), and Vect_new_list().

Referenced by Vedit_delete_area_centroid(), and Vedit_delete_areas_cat().

◆ Vedit_delete_area_centroid()

int Vedit_delete_area_centroid ( struct Map_info Map,
int  centroid 
)

Delete area (centroid and set of boundaries) by centroid.

Parameters
Mappointer to Map_info struct
centroid
Returns
0 no area deleted
1 area deleted

Definition at line 64 of file vector/vedit/delete.c.

References _, G_debug(), G_warning(), Vect_get_centroid_area(), and Vedit_delete_area().

◆ Vedit_delete_areas_cat()

int Vedit_delete_areas_cat ( struct Map_info Map,
int  field,
int  cat 
)

Delete vector areas of given category.

Parameters
Mappointer to Map_info struct
fieldlayer number
catcategory number
Returns
number of deleted areas

Definition at line 139 of file vector/vedit/delete.c.

References G_debug(), Vect_area_alive(), Vect_get_area_cat(), Vect_get_num_areas(), and Vedit_delete_area().

◆ Vedit_delete_lines()

int Vedit_delete_lines ( struct Map_info Map,
struct ilist List 
)

Delete selected features.

Parameters
Mappointer to Map_info
Listlist of features to be deleted
Returns
number of deleted features
-1 on error

Definition at line 29 of file vector/vedit/delete.c.

References _, G_debug(), G_warning(), Vect_delete_line(), and Vect_line_alive().

◆ Vedit_extend_lines()

int Vedit_extend_lines ( struct Map_info Map,
struct ilist List,
int  nodes,
int  parallel,
double  thresh 
)

Extend lines in given threshold.

1. Extend first line only
\ \
id1 \ -> \
\
id2 ---------- -----+----
2. Extend both lines
\ \
id1 \ -> \
\
id2 --- +----
3. Extend first line when both are on the same line
id1 --- --- id2 -> -----+----
4. Connect two parallel lines (parallel=1)
id1 ------ -------
-> /
id2 ------ +-----
5. Don't connect two parallel lines (parallel=0)
id1 ------ ------
->
id2 ------ ------
double t
Definition r_raster.c:39
Parameters
Mappointer to Map_info
Listlist of selected lines
nodes1 for start node, 2 for end node, other for both
parallelconnect parallel lines
threshthreshold value
Returns
number of modified lines

Definition at line 68 of file extend.c.

References G_debug(), GV_LINES, GV_POINTS, Vect_destroy_list(), Vect_find_line_list(), Vect_get_line_nodes(), Vect_get_line_type(), Vect_get_node_coor(), Vect_line_alive(), Vect_list_append(), Vect_new_list(), Vect_reset_list(), WITHOUT_Z, and x.

◆ Vedit_flip_lines()

int Vedit_flip_lines ( struct Map_info Map,
struct ilist List 
)

Flip direction of selected lines.

Parameters
Mappointer to Map_info
Listlist of selected lines
Returns
number of modified lines
-1 on error

Definition at line 25 of file flip.c.

References G_debug(), GV_LINES, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_line_reverse(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), and Vect_rewrite_line().

◆ Vedit_get_min_distance()

double Vedit_get_min_distance ( struct line_pnts Points1,
struct line_pnts Points2,
int  with_z,
int mindistidx 
)

Calculate distances between two lines.

Todo:
LL projection
Parameters
Points1first line geometry
Points2second line geometry
with_zWITH_Z for 3D data
[out]mindistidxindex of minimal distance
Returns
minimal distance between two lines (their nodes)

Definition at line 28 of file vector/vedit/distance.c.

References G_debug(), and Vect_points_distance().

◆ Vedit_merge_lines()

int Vedit_merge_lines ( struct Map_info Map,
struct ilist List 
)

◆ Vedit_modify_cats()

int Vedit_modify_cats ( struct Map_info Map,
struct ilist List,
int  layer,
int  del,
struct cat_list Clist 
)

Add / remove categories.

Parameters
Mappointer to Map_info
Listlist of selected primitives
layerlayer number
delaction (non-zero for delete otherwise add)
Clistlist of category numbers
Returns
number of modified primitives
-1 on error

Definition at line 30 of file vector/vedit/cats.c.

References _, G_warning(), Vect_cat_set(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_field_cat_del(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), and Vect_rewrite_line().

◆ Vedit_move_lines()

int Vedit_move_lines ( struct Map_info Map,
struct Map_info **  BgMap,
int  nbgmaps,
struct ilist List,
double  move_x,
double  move_y,
double  move_z,
int  snap,
double  thresh 
)

Move selected primitives.

Parameters
Mappointer to Map_info
BgMaplist of background vector maps used for snapping
nbgmapsNumber of background vector maps in BgMap
Listlist of primitives to be moved
move_x,move_y,move_zdirection (move_z used only if map is 3D)
snapenable snapping (see globals.h)
threshsnapping threshold (>0)
Returns
number of modified primitives
-1 on error

Definition at line 31 of file vector/vedit/move.c.

References G_debug(), line_pnts::n_points, NO_SNAP, SNAPVERTEX, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_is_3d(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_rewrite_line(), Vedit_snap_point(), line_pnts::x, x, line_pnts::y, and line_pnts::z.

◆ Vedit_move_vertex()

int Vedit_move_vertex ( struct Map_info Map,
struct Map_info **  BgMap,
int  nbgmaps,
struct ilist List,
struct line_pnts coord,
double  thresh_coords,
double  thresh_snap,
double  move_x,
double  move_y,
double  move_z,
int  move_first,
int  snap 
)

Move all vertices in bounding box(es)

Parameters
Mappointer to Map_info
BgMap,nbgmapslist of background vector maps for snapping
Listlist of selected lines
coordpoints location
thresh_coordsthreshold value for selecting lines
thresh_snapthreshold value used for snapping
move_x,move_y,move_zdirection (move_z is used when map is 3D)
move_firstmove only first vertex found in the bounding box
snapsnapping mode (see vedit.h)
Returns
number of moved vertices
-1 on error

Definition at line 33 of file vertex.c.

References G_debug(), G_free(), G_realloc, G_zero(), GV_LINES, line_pnts::n_points, NO_SNAP, NULL, SNAPVERTEX, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_is_3d(), Vect_line_alive(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_points_distance(), Vect_read_line(), Vect_rewrite_line(), Vedit_snap_point(), WITHOUT_Z, line_pnts::x, x, line_pnts::y, and line_pnts::z.

◆ Vedit_remove_vertex()

int Vedit_remove_vertex ( struct Map_info Map,
struct ilist List,
struct line_pnts coord,
double  thresh 
)

Remove vertex from line.

Todo:
3D
Parameters
Mappointer to Map_info
Listlist of selected lines
coordpoints location
threshthreshold value to find a line
Returns
number of removed vertices
-1 on error

Definition at line 276 of file vertex.c.

References G_debug(), GV_LINES, line_pnts::n_points, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_line_delete_point(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_points_distance(), Vect_read_line(), Vect_rewrite_line(), WITHOUT_Z, line_pnts::x, x, line_pnts::y, and line_pnts::z.

◆ Vedit_render_map()

struct robject_list * Vedit_render_map ( struct Map_info Map,
struct bound_box box,
int  draw_flag,
double  center_easting,
double  center_northing,
int  map_width,
int  map_height,
double  map_res 
)

Render vector features into list.

Parameters
Mappointer to Map_info structure
boxbounding box of region to be rendered
draw_flagtypes of objects to be rendered (see vedit.h)
center_easing,center_northing,map_width,map_height,map_resvalues used for conversion en->xy
Returns
pointer to robject_list structure

Definition at line 59 of file vector/vedit/render.c.

References DRAW_AREA, DRAW_DIRECTION, DRAW_NODEONE, DRAW_NODETWO, DRAW_VERTEX, bound_box::E, robject::fid, G_debug(), G_malloc, G_realloc, GV_LINES, GV_POINTS, bound_box::N, NULL, bound_box::S, state, Vect_destroy_boxlist(), Vect_new_boxlist(), Vect_select_areas_by_box(), Vect_select_lines_by_box(), and bound_box::W.

◆ Vedit_select_by_query()

int Vedit_select_by_query ( struct Map_info Map,
int  type,
int  layer,
double  thresh,
int  query,
struct ilist List 
)

Select primitives by query (based on geometry properties)

Currently supported:

  • QUERY_LENGTH, select all lines longer than threshold (or shorter if threshold is < 0)
  • QUERY_DANGLE, select all dangles longer than threshold (or shorter if threshold is < 0)

Perform global query if List is empty otherwise query only selected vector objects.

Parameters
Mappointer to Map_info
typefeature type
layerlayer number (unused)
threshthreshold value (< 0 for 'shorter', > 0 for 'longer')
queryquery (length, dangle, ...)
[in,out]Listlist of selected features
Returns
number of selected primitives

Definition at line 44 of file vector/vedit/select.c.

References G_debug(), QUERY_DANGLE, QUERY_LENGTH, Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_destroy_list(), Vect_get_num_lines(), Vect_list_append(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_new_list(), Vect_select_dangles(), and Vect_val_in_list().

◆ Vedit_snap_line()

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 97 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, line_pnts::x, x, line_pnts::y, and line_pnts::z.

Referenced by Vedit_snap_lines().

◆ 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 170 of file vedit/snap.c.

References GV_LINES, GV_POINT, 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().

◆ Vedit_snap_point()

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, AMI_STREAM< T >::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().

◆ Vedit_split_lines()

int Vedit_split_lines ( struct Map_info Map,
struct ilist List,
struct line_pnts coord,
double  thresh,
struct ilist List_updated 
)

Split selected lines on given position.

Parameters
Mappointer to Map_info
Listlist of selected lines
coordpoints location
threshthreshold
[out]List_updatedlist of rewritten features (or NULL)
Returns
number of modified lines
-1 on error

Definition at line 32 of file break.c.

References G_debug(), GV_LINES, l, line_pnts::n_points, NULL, Vect_append_point(), Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_line_alive(), Vect_line_distance(), Vect_line_length(), Vect_list_append(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_reset_line(), Vect_rewrite_line(), Vect_write_line(), WITHOUT_Z, line_pnts::x, x, line_pnts::y, and line_pnts::z.