GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
defs/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. More...
 
int Vedit_connect_lines (struct Map_info *, struct ilist *, double)
 Connect lines in given threshold. More...
 
int Vedit_extend_lines (struct Map_info *, struct ilist *, int, int, double)
 Extend lines in given threshold. More...
 
int Vedit_modify_cats (struct Map_info *, struct ilist *, int, int, struct cat_list *)
 Add / remove categories. More...
 
int Vedit_copy_lines (struct Map_info *, struct Map_info *, struct ilist *)
 Copy selected primitives. More...
 
int Vedit_chtype_lines (struct Map_info *, struct ilist *)
 Change primitive type. More...
 
int Vedit_delete_lines (struct Map_info *, struct ilist *)
 Delete selected features. More...
 
int Vedit_delete_area_centroid (struct Map_info *, int)
 Delete area (centroid and set of boundaries) by centroid. More...
 
int Vedit_delete_area (struct Map_info *, int)
 Delete area (centroid + set of boundaries) by id. More...
 
int Vedit_delete_areas_cat (struct Map_info *, int, int)
 Delete vector areas of given category. More...
 
double Vedit_get_min_distance (struct line_pnts *, struct line_pnts *, int, int *)
 Calculate distances between two lines. More...
 
int Vedit_flip_lines (struct Map_info *, struct ilist *)
 Flip direction of selected lines. More...
 
int Vedit_merge_lines (struct Map_info *, struct ilist *)
 Merge lines/boundaries. More...
 
int Vedit_move_lines (struct Map_info *, struct Map_info **, int, struct ilist *, double, double, double, int, double)
 Move selected primitives. More...
 
struct robject_listVedit_render_map (struct Map_info *, struct bound_box *, int, double, double, int, int, double)
 Render vector features into list. More...
 
int Vedit_select_by_query (struct Map_info *, int, int, double, int, struct ilist *)
 
int Vedit_snap_point (struct Map_info *, int, double *, double *, double *, double, int)
 Snap given point to the nearest primitive. More...
 
int Vedit_snap_line (struct Map_info *, struct Map_info **, int, int, struct line_pnts *, double, int)
 Snap selected primitive to its nearest primitive. More...
 
int Vedit_snap_lines (struct Map_info *, struct Map_info **, int, struct ilist *, double, int)
 Snap lines/boundaries. More...
 
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) More...
 
int Vedit_add_vertex (struct Map_info *Map, struct ilist *, struct line_pnts *, double)
 Add new vertex to line. More...
 
int Vedit_remove_vertex (struct Map_info *, struct ilist *, struct line_pnts *, double)
 Remove vertex from line. More...
 
int Vedit_bulk_labeling (struct Map_info *, struct ilist *, double, double, double, double, double, double)
 Lines z-bulk labeling. More...
 

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.

◆ 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
point_start_endstaring and ending point
startstarting value
stepstep value
Returns
number of modified features
-1 on error

Definition at line 32 of file zbulk.c.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

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 on error

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

◆ 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 ilist::n_values, and Vect_new_list().

◆ 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.

◆ 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(), line_pnts::n_points, Vect_points_distance(), line_pnts::x, line_pnts::y, and line_pnts::z.

◆ Vedit_merge_lines()

int Vedit_merge_lines ( struct Map_info Map,
struct ilist List 
)

Merge lines/boundaries.

At least two lines need to be given.

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

Definition at line 47 of file merge.c.

◆ 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.

◆ 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
BgMap,nbgmapslist of background vector maps used for snapping
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)
Returns
number of modified primitives
-1 on error

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

◆ 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.

◆ 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.

◆ 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 list.

◆ Vedit_select_by_query()

int Vedit_select_by_query ( struct Map_info ,
int  ,
int  ,
double  ,
int  ,
struct ilist  
)

◆ 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.

◆ 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.

◆ 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.

◆ 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 l.