24 #include <grass/Vect.h>
25 #include <grass/glocale.h>
28 struct Map_info *,
int,
struct ilist *,
struct ilist *,
42 if (strcmp(str, GV_ON_AND) == 0)
44 else if (strcmp(str, GV_ON_OVERLAP) == 0)
64 int Vect_overlay(
struct Map_info *AMap,
int atype,
struct ilist *AList,
struct ilist *AAList,
65 struct Map_info *BMap,
int btype,
struct ilist *BList,
struct ilist *BAList,
66 int operator,
struct Map_info *OMap)
103 struct ilist *AAList,
struct Map_info *BMap,
int btype,
104 struct ilist *BList,
struct ilist *BAList,
105 struct Map_info *OMap)
107 int i, j, k, node, line, altype, bltype, oltype, area, centr;
108 struct line_pnts *Points;
109 struct line_cats *ACats, *BCats, *OCats;
110 struct ilist *AOList, *BOList;
122 if ((atype &
GV_LINES) || (btype & GV_LINES))
123 G_warning(_(
"Overlay: line/boundary types not supported by AND operator"));
125 if ((atype & GV_AREA) && (btype & GV_AREA))
126 G_warning(_(
"Overlay: area x area types not supported by AND operator"));
131 if ((atype & GV_POINTS) && (btype & GV_POINTS)) {
132 G_debug(3,
"overlay: AND: point x point");
135 if (!(altype & GV_POINTS))
141 G_debug(3,
"overlay: node = %d", node);
150 if (!(bltype & GV_POINTS))
155 for (k = 0; k < ACats->n_cats; k++)
158 for (k = 0; k < BCats->n_cats; k++)
173 if ((atype & GV_POINTS) && (btype & GV_AREA)) {
174 G_debug(3,
"overlay: AND: point x area");
178 if (!(altype & GV_POINTS))
188 for (k = 0; k < ACats->n_cats; k++)
194 for (k = 0; k < BCats->n_cats; k++)
207 if ((btype & GV_POINTS) && (atype & GV_AREA)) {
208 G_debug(3,
"overlay: AND: area x point");
212 if (!(bltype & GV_POINTS))
222 for (k = 0; k < BCats->n_cats; k++)
228 for (k = 0; k < ACats->n_cats; k++)
int Vect_get_area_centroid(struct Map_info *Map, int area)
Returns centroid number of area.
int Vect_get_node_line(struct Map_info *Map, int node, int line)
Get line id for node line index.
struct line_pnts * Vect_new_line_struct()
Creates and initializes a struct line_pnts.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_reset_cats(struct line_cats *Cats)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_cat_set(struct line_cats *Cats, int field, int cat)
Add new field/cat to category structure if doesn't exist yet.
int Vect_find_area(struct Map_info *Map, double x, double y)
Find the nearest area.
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 Vect_list_append(struct ilist *list, int val)
Append new item to the end of list if not yet present.
int Vect_find_node(struct Map_info *Map, double ux, double uy, double uz, double maxdist, int with_z)
Find the nearest node.
struct line_cats * Vect_new_cats_struct()
Creates and initializes line_cats structure.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int Vect_get_num_lines(struct Map_info *map)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
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 G_debug(int level, const char *msg,...)
Print debugging message.
long Vect_write_line(struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
Writes new feature to the end of file (table)
int Vect_val_in_list(struct ilist *list, int val)
Find a given item in the list.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int Vect_overlay_str_to_operator(const char *str)
Get operator code from string.
int Vect_read_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
Read vector feature.
int Vect_get_node_n_lines(struct Map_info *Map, int node)
Get number of lines for node.