34 int nbgmaps,
struct ilist *List,
35 struct line_pnts *coord,
double thresh_coords,
36 double thresh_snap,
double move_x,
double move_y,
37 double move_z,
int move_first,
int snap)
39 int nvertices_moved, nlines_modified, nvertices_snapped;
42 int line, type, rewrite;
44 double east, north, dist;
52 nvertices_moved = nvertices_snapped = 0;
59 for (i = 0; i < List->
n_values; i++) {
60 line = List->
value[i];
85 for (j = 0; j < coord->
n_points; j++) {
90 for (k = 0; k < Points->
n_points; k++) {
94 if (dist <= thresh_coords) {
96 "Vedit_move_vertex(): line=%d; x=%f, y=%f -> x=%f, y=%f",
97 line, x[k], y[k], x[k] + move_x,
106 G_debug(3,
"Vedit_move_vertex(): line=%d, point=%d",
111 (Map, line, &x[k], &y[k], &z[k], thresh_snap,
116 for (bgi = 0; bgi < nbgmaps; bgi++) {
118 (BgMap[bgi], -1, &x[k], &y[k],
140 if ((type & GV_LINES) &&
142 x[npoints - 1], y[npoints - 1],
147 x[0] = x[npoints - 1];
148 y[0] = y[npoints - 1];
150 z[0] = z[npoints - 1];
152 else if (moved[npoints - 1] == 1) {
153 x[npoints - 1] = x[0];
154 y[npoints - 1] = y[0];
156 z[npoints - 1] = z[0];
176 return nvertices_moved;
199 int nlines_modified, nvertices_added, rewrite;
200 double east, north, dist;
212 for (i = 0; i < List->
n_values; i++) {
213 line = List->
value[i];
223 G_debug(3,
"Vedit_add_vertex(): line = %d, thresh = %f",
230 for (j = 0; j < coord->
n_points; j++) {
239 if (dist <= thresh &&
246 G_debug(3,
"Vedit_add_vertex(): line=%d; x=%f, y=%f, index=%d",
268 return nvertices_added;
289 int nvertices_removed, rewrite, nlines_modified;
297 nvertices_removed = nlines_modified = 0;
302 for (i = 0; i < List->
n_values; i++) {
303 line = List->
value[i];
317 for (j = 0; j < coord->
n_points; j++) {
321 for (k = 0; k < Points->
n_points; k++) {
324 if (dist <= thresh) {
328 "Vedit_remove_vertex(): line=%d; x=%f, y=%f, index=%d",
329 line, x[k], y[k], k);
351 return nvertices_removed;
off_t Vect_rewrite_line(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
Rewrites existing feature (topological level required)
int n_points
Number of points.
int n_values
Number of values in the list.
int Vect_line_distance(const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
Calculate distance of point to line.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
double Vect_points_distance(double, double, double, double, double, double, int)
Calculate distance of 2 points.
int Vedit_remove_vertex(struct Map_info *Map, struct ilist *List, struct line_pnts *coord, double thresh)
Remove vertex from line.
double * x
Array of X coordinates.
Feature geometry info - coordinates.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
#define WITHOUT_Z
2D/3D vector data
double * y
Array of Y coordinates.
int Vect_is_3d(const struct Map_info *)
Check if vector map is 3D.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vedit_add_vertex(struct Map_info *Map, struct ilist *List, struct line_pnts *coord, double thresh)
Add new vertex to line.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
int Vect_line_insert_point(struct line_pnts *, int, double, double, double)
Insert new point at index position and move all old points at that position and above up...
int Vect_line_alive(const struct Map_info *, int)
Check if feature is alive or dead (topological level required)
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)
double * z
Array of Z coordinates.
int * value
Array of values.
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int Vedit_snap_point(struct Map_info *, int, double *, double *, double *, double, int)
Snap given point to the nearest primitive.
int G_debug(int, const char *,...) __attribute__((format(printf
int Vect_line_delete_point(struct line_pnts *, int)
Delete point at given index and move all points above down.