Skip to content

Commit

Permalink
Merge pull request #4 from mundialis/remove_all_areas
Browse files Browse the repository at this point in the history
add loop to really merge all small areas
  • Loading branch information
metzm authored Nov 15, 2024
2 parents 1da01e5 + 5d32a46 commit e9275e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]

# E402 module level import not at top of file
# E501 line too long (83 > 79 characters)
# F821 undefined name '_'

exclude = .git

max-line-length = 80

per-file-ignores =
./v.example.py: F821, E501
22 changes: 17 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char *argv[])
struct Flag *no_build;
} flag;
double thresh;
int count;
int count, count_total;
double size;
int layer;
int ncols, ncols_table, col, nrec, i, j;
Expand Down Expand Up @@ -182,8 +182,8 @@ int main(int argc, char *argv[])

if (use_col) {
db_CatValArray_init(&cvarr[i]);
nrec = db_select_CatValArray(driver, Fi->table, catcol, colname, NULL,
&cvarr[i]);
nrec = db_select_CatValArray(driver, Fi->table, catcol, colname,
NULL, &cvarr[i]);
i++;
}
}
Expand All @@ -209,8 +209,20 @@ int main(int argc, char *argv[])

G_message(_("Tool: Remove small areas"));
/* new function to also consider attributes */
count = remove_small_areas(&Out, thresh, pErr, &size, layer, cvarr, ncols);
if (count > 0) {
count_total = 0;
count = 1;
while (count > 0) {
count = remove_small_areas(&Out, thresh, pErr, &size, layer, cvarr,
ncols);
if (count > 0) {
count_total += count;

Vect_build_partial(&Out, GV_BUILD_NONE);
Vect_build_partial(&Out, GV_BUILD_CENTROIDS);
}
}

if (count_total > 0) {
Vect_build_partial(&Out, GV_BUILD_BASE);
G_message(SEP);
G_message(_("Tool: Merge boundaries"));
Expand Down

0 comments on commit e9275e3

Please sign in to comment.