Skip to content

Commit

Permalink
r.flowaccumulation: Change if to switch (OSGeo#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho authored Apr 5, 2024
1 parent a148e72 commit 5f40487
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/raster/r.flowaccumulation/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,22 @@ int main(int argc, char *argv[])
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 1);
Rast_get_c_row(dir_fd, dir_buf, row);
if (dir_format == DIR_DEG) {
switch (dir_format) {
case DIR_DEG:
for (col = 0; col < ncols; col++)
if (!Rast_is_c_null_value(&dir_buf[col]))
DIR(row, col) = pow(2, abs(dir_buf[col] / 45.));
}
else if (dir_format == DIR_DEG45) {
break;
case DIR_DEG45:
for (col = 0; col < ncols; col++)
if (!Rast_is_c_null_value(&dir_buf[col]))
DIR(row, col) = pow(2, 8 - abs(dir_buf[col]));
}
else {
break;
default:
for (col = 0; col < ncols; col++)
if (!Rast_is_c_null_value(&dir_buf[col]))
DIR(row, col) = abs(dir_buf[col]);
break;
}
}
G_percent(1, 1, 1);
Expand Down

0 comments on commit 5f40487

Please sign in to comment.