22 #include <grass/gis.h>
23 #include <grass/Vect.h>
24 #include <grass/glocale.h>
42 struct Map_info *Err,
double *removed_area)
48 struct line_pnts *Points;
49 struct line_cats *Cats;
50 double size_removed = 0.0;
58 for (area = 1; area <= nareas; area++) {
59 int i, j, centroid, dissolve_neighbour;
90 for (i = 0; i < List->n_values; i++) {
91 int line, left, right, neighbour;
93 line = List->value[i];
104 G_debug(4,
" line = %d left = %d right = %d neighbour = %d",
105 line, left, right, neighbour);
109 G_debug(3,
"num neighbours = %d", AList->n_values);
112 dissolve_neighbour = 0;
114 for (i = 0; i < AList->n_values; i++) {
118 neighbour1 = AList->value[i];
119 G_debug(4,
" neighbour1 = %d", neighbour1);
121 for (j = 0; j < List->n_values; j++) {
122 int line, left, right, neighbour2;
124 line = List->value[j];
131 if (neighbour2 == neighbour1) {
138 dissolve_neighbour = neighbour1;
142 G_debug(3,
"dissolve_neighbour = %d", dissolve_neighbour);
146 for (i = 0; i < List->n_values; i++) {
147 int line, left, right, neighbour;
149 line = List->value[i];
156 G_debug(3,
" neighbour = %d", neighbour);
158 if (neighbour == dissolve_neighbour) {
164 for (i = 0; i < AList->n_values; i++) {
167 line = AList->value[i];
181 *removed_area = size_removed;
int Vect_get_area_centroid(struct Map_info *Map, int area)
Returns centroid number of area.
int Vect_get_area_boundaries(struct Map_info *Map, int area, struct ilist *List)
Creates list of boundaries for area.
int Vect_get_line_areas(struct Map_info *Map, int line, int *left, int *right)
Get area/isle ids on the left and right.
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_get_num_areas(struct Map_info *map)
Get number of areas in vector map.
int G_percent(long n, long d, int s)
Print percent complete messages.
int Vect_reset_list(struct ilist *list)
Reset ilist structure.
int Vect_list_append(struct ilist *list, int val)
Append new item to the end of list if not yet present.
int Vect_line_alive(struct Map_info *Map, int line)
Check if feature is alive or dead.
struct line_cats * Vect_new_cats_struct()
Creates and initializes line_cats structure.
double Vect_line_length(struct line_pnts *Points)
Calculate line length, 3D-length in case of 3D vector line.
int Vect_remove_small_areas(struct Map_info *Map, double thresh, struct Map_info *Err, double *removed_area)
Remove small areas from the map map.
double Vect_get_area_area(struct Map_info *Map, int area)
Returns area of area without areas of isles.
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_area_alive(struct Map_info *Map, int area)
Check if area is alive or dead.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int Vect_read_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
Read vector feature.