forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
g.region: Align region to resolution (-a flag) for n=, s=, w=, e= (OS…
…Geo#1884) * g.region: Align region to resolution (-a flag) for n=, s=, w=, e= * Copyright year
- Loading branch information
Showing
1 changed file
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
* datum added by Andreas Lange <[email protected]> | ||
* PURPOSE: Program to manage and print the boundary definitions for the | ||
* geographic region. | ||
* | ||
* COPYRIGHT: (C) 2000 by the GRASS Development Team | ||
* | ||
* COPYRIGHT: (C) 2000-2021 by the GRASS Development Team | ||
* | ||
* This program is free software under the GPL (>=v2) | ||
* Read the file COPYING that comes with GRASS for details. | ||
|
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) | |
{ | ||
int i; | ||
int print_flag = 0; | ||
int flat_flag; | ||
int flat_flag; | ||
double x, xs, ys, zs; | ||
int ival; | ||
int row_flag = 0, col_flag = 0; | ||
|
@@ -522,7 +522,7 @@ int main(int argc, char *argv[]) | |
ret = Vect_get_map_box1(&Map, &box); | ||
if (ret != 1) | ||
G_fatal_error(_("Unable to get map bounding box")); | ||
|
||
map_window = window; | ||
map_window.north = box.N; | ||
map_window.south = box.S; | ||
|
@@ -592,6 +592,9 @@ int main(int argc, char *argv[]) | |
window.north = x; | ||
else | ||
die(parm.north); | ||
|
||
if (flag.res_set->answer) | ||
window.north = ceil(window.north / window.ns_res) * window.ns_res; | ||
} | ||
|
||
/* s= */ | ||
|
@@ -616,6 +619,9 @@ int main(int argc, char *argv[]) | |
window.south = x; | ||
else | ||
die(parm.south); | ||
|
||
if (flag.res_set->answer) | ||
window.south = floor(window.south / window.ns_res) * window.ns_res; | ||
} | ||
|
||
/* e= */ | ||
|
@@ -640,6 +646,9 @@ int main(int argc, char *argv[]) | |
window.east = x; | ||
else | ||
die(parm.east); | ||
|
||
if (flag.res_set->answer) | ||
window.east = ceil(window.east / window.ew_res) * window.ew_res; | ||
} | ||
|
||
/* w= */ | ||
|
@@ -664,6 +673,9 @@ int main(int argc, char *argv[]) | |
window.west = x; | ||
else | ||
die(parm.west); | ||
|
||
if (flag.res_set->answer) | ||
window.west = floor(window.west / window.ew_res) * window.ew_res; | ||
} | ||
|
||
/* t= */ | ||
|
@@ -815,7 +827,7 @@ int main(int argc, char *argv[]) | |
Rast_get_cellhd(name, mapset, &temp_window); | ||
Rast_align_window(&window, &temp_window); | ||
} | ||
|
||
/* grow by number of cells */ | ||
if ((value = parm.grow->answer)){ | ||
update_file = true; | ||
|
@@ -825,7 +837,7 @@ int main(int argc, char *argv[]) | |
if (G_projection() == PROJECTION_LL && ( | ||
window.north + xs <= 90.0 + 0.5 * window.ns_res || | ||
window.south - xs >= -90.0 - 0.5 * window.ns_res)) { | ||
G_warning(_("'%s' option not used with <%s> because a coordinate would become invalid"), | ||
G_warning(_("'%s' option not used with <%s> because a coordinate would become invalid"), | ||
parm.grow->key, "latitude"); | ||
} else { | ||
window.north += xs; | ||
|