21 #include <grass/gis.h>
22 #include <grass/Vect.h>
23 #include <grass/glocale.h>
40 struct line_pnts *APoints, *BPoints;
41 struct line_cats *ACats, *BCats, *Cats;
42 int i, j, c, atype, btype, bline;
43 int nlines, nbcats_orig;
58 G_debug(1,
"nlines = %d", nlines);
66 for (i = 1; i <= nlines; i++) {
77 G_debug(3,
" %d lines selected by box", List->n_values);
79 for (j = 0; j < List->n_values; j++) {
80 bline = List->value[j];
81 G_debug(3,
" j = %d bline = %d", j, bline);
99 nbcats_orig = BCats->n_cats;
101 for (c = 0; c < ACats->n_cats; c++)
104 if (BCats->n_cats > nbcats_orig) {
105 G_debug(4,
"cats merged: n_cats %d -> %d", nbcats_orig,
115 G_debug(3,
"nlines = %d\n", nlines);
130 const struct line_pnts *BPoints,
int with_z)
136 if (APoints->n_points != BPoints->n_points)
139 npoints = APoints->n_points;
143 for (k = 0; k < APoints->n_points; k++) {
144 if (APoints->x[k] != BPoints->x[k] ||
145 APoints->y[k] != BPoints->y[k] ||
146 (with_z && APoints->z[k] != BPoints->z[k])) {
154 for (k = 0; k < APoints->n_points; k++) {
155 if (APoints->x[k] != BPoints->x[npoints - k - 1] ||
156 APoints->y[k] != BPoints->y[npoints - k - 1] ||
157 (with_z && APoints->z[k] != BPoints->z[npoints - k - 1])) {
int Vect_line_box(struct line_pnts *Points, BOUND_BOX *Box)
Get bounding box of line.
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_cat_set(struct line_cats *Cats, int field, int cat)
Add new field/cat to category structure if doesn't exist yet.
int G_percent(long n, long d, int s)
Print percent complete messages.
void G_verbose_message(const char *msg,...)
Print a message to stderr but only if module is in verbose mode.
int Vect_rewrite_line(struct Map_info *Map, int line, int type, struct line_pnts *points, struct line_cats *cats)
Rewrites feature info at the given offset.
void Vect_remove_duplicates(struct Map_info *Map, int type, struct Map_info *Err)
Remove duplicate lines from vector map.
int Vect_line_alive(struct Map_info *Map, int line)
Check if feature is alive or dead.
int Vect_select_lines_by_box(struct Map_info *Map, BOUND_BOX *Box, int type, struct ilist *list)
Select lines by box.
struct line_cats * Vect_new_cats_struct()
Creates and initializes line_cats structure.
int Vect_get_num_lines(struct Map_info *map)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
int Vect_line_check_duplicate(const struct line_pnts *APoints, const struct line_pnts *BPoints, int with_z)
Check for duplicate lines.
int G_debug(int level, const char *msg,...)
Print debugging message.
int Vect_delete_line(struct Map_info *Map, int line)
Delete feature.
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_read_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
Read vector feature.