105 int i, j, k, line, altype, bltype, oltype, area, centr;
108 struct ilist *AOList, *BOList;
123 if ((atype &
GV_LINES) || (btype & GV_LINES))
124 G_warning(
_(
"Overlay: line/boundary types not supported by AND operator"));
126 if ((atype &
GV_AREA) && (btype & GV_AREA))
127 G_warning(
_(
"Overlay: area x area types not supported by AND operator"));
132 if ((atype &
GV_POINTS) && (btype & GV_POINTS)) {
133 G_debug(3,
"overlay: AND: point x point");
136 if (!(altype & GV_POINTS))
139 box.
E = box.
W = Points->x[0];
140 box.
N = box.
S = Points->y[0];
141 box.
T = box.
B = Points->z[0];
146 for (j = 0; j < boxlist->
n_values; j++) {
147 line = boxlist->
id[j];
149 if (!(bltype & GV_POINTS))
154 for (k = 0; k < ACats->
n_cats; k++)
157 for (k = 0; k < BCats->
n_cats; k++)
172 if ((atype & GV_POINTS) && (btype & GV_AREA)) {
173 G_debug(3,
"overlay: AND: point x area");
177 if (!(altype & GV_POINTS))
187 for (k = 0; k < ACats->
n_cats; k++)
193 for (k = 0; k < BCats->
n_cats; k++)
206 if ((btype & GV_POINTS) && (atype & GV_AREA)) {
207 G_debug(3,
"overlay: AND: area x point");
211 if (!(bltype & GV_POINTS))
221 for (k = 0; k < BCats->
n_cats; k++)
227 for (k = 0; k < ACats->
n_cats; k++)
void Vect_destroy_boxlist(struct boxlist *)
Frees all memory associated with a struct boxlist, including the struct itself.
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_get_area_centroid(const struct Map_info *, int)
Returns centroid id for given area.
int Vect_val_in_list(const struct ilist *, int)
Find a given item in the list.
int n_values
Number of items in the list.
int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int, struct boxlist *)
Select lines with bounding boxes by box.
Feature geometry info - coordinates.
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 n_cats
Number of categories attached to element.
int Vect_overlay_and(struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *)
Overlay 2 vector maps with AND.
int * cat
Array of categories.
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_find_area(struct Map_info *, double, double)
Find the nearest area.
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_overlay(struct Map_info *AMap, int atype, struct ilist *AList, struct ilist *AAList, struct Map_info *BMap, int btype, struct ilist *BList, struct ilist *BAList, int operator, struct Map_info *OMap)
Overlay 2 vector maps and create new one.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
List of bounding boxes with id.
void G_warning(const char *,...) __attribute__((format(printf
#define GV_ON_AND
Overlay operators.
int * field
Array of layers (fields)
struct boxlist * Vect_new_boxlist(int)
Creates and initializes a struct boxlist.
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_overlay_str_to_operator(const char *str)
Get operator code from string.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.