18 static int select_by_query(
struct Map_info *,
int,
int,
double,
int,
21 static int merge_lists(
struct ilist *alist,
struct ilist *blist);
45 double thresh,
int query,
struct ilist *List)
51 struct ilist *List_query;
68 for (line = 1; line <= num; line++) {
69 if (select_by_query(Map, line, type, thresh, query, Points,
75 for (i = 0; i < List->
n_values; i++) {
76 line = List->
value[i];
77 if (select_by_query(Map, line, type, thresh, query, Points,
86 struct ilist *List_dangle;
89 thresh_tmp = fabs(thresh);
95 for (i = 0; i < List_dangle->
n_values; i++) {
113 if (List != List_query) {
114 merge_lists(List, List_query);
118 G_debug(3,
"Vedit_select_by_query(): %d lines selected (by query %d)",
134 int select_by_query(
struct Map_info *Map,
int line,
int type,
double thresh,
140 int node1, node2, node;
143 struct ilist *exclude, *found;
157 if (length <= fabs(thresh))
184 if ((nnode1 == 4 && nnode2 == 1) || (nnode1 == 1 && nnode2 == 4)) {
197 if (length > fabs(thresh))
201 if (length <= thresh)
217 for (i = 0; i < found->
n_values; i++) {
231 G_fatal_error(
"Vedit_select_by_query(): %s",
_(
"Unknown query tool"));
245 int merge_lists(
struct ilist *alist,
struct ilist *blist)
249 struct ilist *list_del;
253 for (i = 0; i < alist->
n_values; i++) {
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
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.
int Vect_get_line_nodes(struct Map_info *, int, int *, int *)
Get line nodes.
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
plus_t Vect_get_num_lines(struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
void Vect_select_dangles(struct Map_info *, int, double, struct ilist *)
Select dangles from vector map.
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
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_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
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_list_delete_list(struct ilist *, const struct ilist *)
Delete list from existing list.
int Vect_line_alive(struct Map_info *, int)
Check if feature is alive or dead (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.
int Vect_get_node_n_lines(struct Map_info *, int)
Get number of lines for node.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
#define WITHOUT_Z
2D/3D vector data
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int n_values
Number of values in the list.
int * value
Array of values.
int * cat
Array of categories.
Feature geometry info - coordinates.
int Vedit_select_by_query(struct Map_info *Map, int type, int layer UNUSED, double thresh, int query, struct ilist *List)
Select primitives by query (based on geometry properties)