18 static int select_by_query(
struct Map_info *,
int,
int,
double,
21 static int merge_lists(
struct ilist *alist,
struct ilist *blist);
43 int type,
int layer,
double thresh,
int query,
50 struct ilist *List_query;
67 for (line = 1; line <= num; line++) {
68 if (select_by_query(Map, line, type, thresh,
74 for (i = 0; i < List->
n_values; i++) {
75 line = List->
value[i];
76 if (select_by_query(Map, line, type, thresh,
77 query, Points, Cats)) {
85 struct ilist *List_dangle;
88 thresh_tmp = fabs(thresh);
94 for (i = 0; i < List_dangle->
n_values; i++) {
112 if (List != List_query) {
113 merge_lists(List, List_query);
117 G_debug(3,
"Vedit_select_by_query(): %d lines selected (by query %d)",
133 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)
213 GV_LINES, 0.0,
WITHOUT_Z, exclude, found);
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
plus_t Vect_get_num_lines(const struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
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.
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
int Vect_get_node_n_lines(const struct Map_info *, int)
Get number of lines for node.
int Vect_get_node_coor(const struct Map_info *, int, double *, double *, double *)
Get node coordinates.
Feature geometry info - coordinates.
void Vect_select_dangles(struct Map_info *, int, double, struct ilist *)
Select dangles from vector map.
void Vect_destroy_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
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 * cat
Array of categories.
int Vedit_select_by_query(struct Map_info *Map, int type, int layer, double thresh, int query, struct ilist *List)
Select primitives by query (based on geometry properties)
#define WITHOUT_Z
2D/3D vector data
int Vect_get_line_nodes(const struct Map_info *, int, int *, int *)
Get line nodes.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_line_alive(const struct Map_info *, int)
Check if feature is alive or dead (topological level required)
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
int Vect_list_delete_list(struct ilist *, const struct ilist *)
Delete list from existing list.
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.