34 double thresh,
struct line_pnts **Points);
49 struct ilist *List_in_box;
51 struct line_pnts *Points1, *Points2, *Points;
55 int line, line1, type1, line2;
59 int nlines, nlines_merged;
80 for (line_i = 0; line_i < List->
n_values; line_i++) {
81 line1 = List->
value[line_i];
95 G_debug(3,
"Vedit_merge_lines(): skipping zero length line");
117 Points1->
y[i], Points1->
z[i]);
132 Points1->
z[i], GV_LINES, 0, 0,
133 NULL, List_in_box)) {
136 for (j = 0; do_merge && j < List_in_box->
n_values; j++) {
137 if (List_in_box->
value[j] == line1 ||
146 line2 = List_in_box->
value[j];
157 line2 = List_in_box->
value[j];
162 if (!do_merge || line2 < 0)
167 merge_lines(Points1, Cats1, Points2, Cats2, -1.0, &Points);
169 G_debug(3,
"Vedit_merge_lines(): lines=%d,%d", line1, line2);
204 return nlines_merged;
209 double thresh,
struct line_pnts **Points)
221 G_debug(3,
" merge line ? index: %d, mindist: %g, thresh: %g",
222 mindistidx, mindist, thresh);
224 if (thresh > 0 && mindist > thresh) {
229 switch (mindistidx) {
259 for (i = 0; i < Cats2->
n_cats; i++) {
int Vect_append_points(struct line_pnts *, const struct line_pnts *, int)
Appends points to the end of a line.
#define GV_FORWARD
Line direction indicator forward/backward.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
plus_t Vect_get_num_lines(const struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
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 Vect_val_in_list(const struct ilist *, int)
Find a given item in the list.
int n_values
Number of values in the list.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
double Vedit_get_min_distance(struct line_pnts *, struct line_pnts *, int, int *)
Calculate distances between two lines.
double * x
Array of X coordinates.
void G_ilist_add(struct ilist *, int)
Add item to ilist.
Feature geometry info - coordinates.
int Vedit_merge_lines(struct Map_info *Map, struct ilist *List)
Merge lines/boundaries.
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.
int n_cats
Number of categories attached to element.
int * cat
Array of categories.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
double * y
Array of Y coordinates.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_line_alive(const struct Map_info *, int)
Check if feature is alive or dead (topological level required)
double * z
Array of Z coordinates.
int * field
Array of layers (fields)
int * value
Array of values.
int Vect_find_line_list(struct Map_info *, double, double, double, int, double, int, const struct ilist *, struct ilist *)
Find the nearest line(s).
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 G_debug(int, const char *,...) __attribute__((format(printf
void Vect_reset_line(struct line_pnts *)
Reset line.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.