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");
136 for (j = 0; do_merge && j < List_in_box->
n_values; j++) {
137 if (List_in_box->
value[j] == line1 ||
144 List_in_box->
value[j]);
147 line2 = List_in_box->
value[j];
158 line2 = List_in_box->
value[j];
163 if (!do_merge || line2 < 0)
168 merge_lines(Points1, Cats1, Points2,
Cats2, -1.0,
171 G_debug(3,
"Vedit_merge_lines(): lines=%d,%d", line1, line2);
210 return nlines_merged;
215 double thresh,
struct line_pnts **Points)
227 G_debug(3,
" merge line ? index: %d, mindist: %g, thresh: %g", mindistidx,
230 if (thresh > 0 && mindist > thresh) {
235 switch (mindistidx) {
248 if (
ps->n_points == 0)
253 if (
ps->n_points == 0)
void G_ilist_add(struct ilist *, int)
Add item to ilist.
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)
plus_t Vect_get_num_lines(struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.
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_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
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)
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_line_alive(struct Map_info *, int)
Check if feature is alive or dead (topological level required)
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_val_in_list(const struct ilist *, int)
Find a given item in the list.
void Vect_reset_line(struct line_pnts *)
Reset line.
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_reset_list(struct ilist *)
Reset ilist structure.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
int Vect_append_points(struct line_pnts *, const struct line_pnts *, int)
Appends points to the end of a line.
double Vedit_get_min_distance(struct line_pnts *, struct line_pnts *, int, int *)
Calculate distances between two lines.
#define GV_FORWARD
Line direction indicator forward/backward.
int Vedit_merge_lines(struct Map_info *Map, struct ilist *List)
Merge lines/boundaries.
int n_values
Number of values in the list.
int * value
Array of values.
int * field
Array of layers (fields)
int * cat
Array of categories.
int n_cats
Number of categories attached to element.
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.