[GRASS-SVN] r72397 - grass/trunk/general/g.region
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 19 14:00:28 PDT 2018
Author: lucadelu
Date: 2018-03-19 14:00:28 -0700 (Mon, 19 Mar 2018)
New Revision: 72397
Modified:
grass/trunk/general/g.region/main.c
Log:
g.region: test new values from grow, working on #3509
Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c 2018-03-19 20:41:47 UTC (rev 72396)
+++ grass/trunk/general/g.region/main.c 2018-03-19 21:00:28 UTC (rev 72397)
@@ -791,18 +791,36 @@
/* grow by number of cells */
if ((value = parm.grow->answer)){
- if (sscanf(value, "%i", &pix)){
- xs = window.ns_res * pix;
- window.north += xs;
- window.south -= xs;
- ys = window.ew_res * pix;
- window.west -= ys;
- window.east += ys;
- zs = window.tb_res * pix;
- window.top += zs;
- window.bottom -= zs;
- }
- }
+ if (sscanf(value, "%i", &pix)){
+ xs = window.ns_res * pix;
+ if (window.north + xs > window.south - xs){
+ 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(_("Box option not used with <%s> because a coordinate would become invalid"), "latitude");
+ } else {
+ window.north += xs;
+ window.south -= xs;
+ }
+ } else {
+ G_warning(_("Box option not used with <%s> because <%s> would become minor than <%s>"), "latitude", "north", "south");
+ }
+ ys = window.ew_res * pix;
+ if (window.east + ys > window.west - ys){
+ window.west -= ys;
+ window.east += ys;
+ } else {
+ G_warning(_("Box option not used with <%s> because <%s> would become minor than <%s>"), "longitude", "east", "west");
+ }
+ zs = window.tb_res * pix;
+ if (window.top + zs > window.bottom - zs){
+ window.top += zs;
+ window.bottom -= zs;
+ } else {
+ G_warning(_("Box option not used with <%s> because <%s> would become minor than <%s>"), "3D", "top", "bottom");
+ }
+ }
+ }
/* save= */
if ((name = parm.save->answer)) {
More information about the grass-commit
mailing list