35 double thresh_coords,
double thresh_snap,
double move_x,
36 double move_y,
double move_z,
int move_first,
int snap)
38 int nvertices_moved, nvertices_snapped;
41 int line, type, rewrite;
43 double east, north, dist;
50 nvertices_moved = nvertices_snapped = 0;
56 for (i = 0; i < List->
n_values; i++) {
57 line = List->
value[i];
82 for (j = 0; j < coord->
n_points; j++) {
87 for (k = 0; k < Points->
n_points; k++) {
91 if (dist <= thresh_coords) {
93 "Vedit_move_vertex(): line=%d; x=%f, y=%f -> "
95 line,
x[k], y[k],
x[k] + move_x, y[k] + move_y);
103 G_debug(3,
"Vedit_move_vertex(): line=%d, point=%d",
108 Map, line, &
x[k], &y[k], &z[k], thresh_snap,
113 for (bgi = 0; bgi < nbgmaps; bgi++) {
115 BgMap[bgi], -1, &
x[k], &y[k], &z[k],
139 y[npoints - 1], z[npoints - 1],
143 x[0] =
x[npoints - 1];
144 y[0] = y[npoints - 1];
146 z[0] = z[npoints - 1];
148 else if (moved[npoints - 1] == 1) {
149 x[npoints - 1] =
x[0];
150 y[npoints - 1] = y[0];
152 z[npoints - 1] = z[0];
159 nvertices_moved = -1;
171 return nvertices_moved;
194 int nvertices_added, rewrite;
195 double east, north, dist;
206 for (i = 0; i < List->
n_values; i++) {
207 line = List->
value[i];
217 G_debug(3,
"Vedit_add_vertex(): line = %d, thresh = %f", line, thresh);
223 for (j = 0; j < coord->
n_points; j++) {
233 if (dist <= thresh &&
240 G_debug(3,
"Vedit_add_vertex(): line=%d; x=%f, y=%f, index=%d",
260 return nvertices_added;
281 int nvertices_removed, rewrite, nlines_modified;
289 nvertices_removed = nlines_modified = 0;
294 for (i = 0; i < List->
n_values; i++) {
295 line = List->
value[i];
309 for (j = 0; j < coord->
n_points; j++) {
313 for (k = 0; k < Points->
n_points; k++) {
316 if (dist <= thresh) {
321 "Vedit_remove_vertex(): line=%d; x=%f, y=%f, index=%d",
322 line,
x[k], y[k], k);
344 return nvertices_removed;
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
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)
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int Vect_line_distance(const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
Calculate distance of point to line.
double Vect_points_distance(double, double, double, double, double, double, int)
Calculate distance of 2 points.
int Vect_line_alive(struct Map_info *, int)
Check if feature is alive or dead (topological level required)
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.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_line_delete_point(struct line_pnts *, int)
Delete point at given index and move all points above down.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_is_3d(struct Map_info *)
Check if vector map is 3D.
int Vedit_snap_point(struct Map_info *, int, double *, double *, double *, double, int)
Snap given point to the nearest primitive.
#define WITHOUT_Z
2D/3D vector data
int n_values
Number of values in the list.
int * value
Array of values.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
int n_points
Number of points.
double * z
Array of Z coordinates.
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)
int Vedit_add_vertex(struct Map_info *Map, struct ilist *List, struct line_pnts *coord, double thresh)
Add new vertex to line.
int Vedit_remove_vertex(struct Map_info *Map, struct ilist *List, struct line_pnts *coord, double thresh)
Remove vertex from line.