[GRASS-SVN] r49745 - grass/trunk/raster/r.in.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 14 10:19:03 EST 2011


Author: hamish
Date: 2011-12-14 07:19:02 -0800 (Wed, 14 Dec 2011)
New Revision: 49745

Modified:
   grass/trunk/raster/r.in.gdal/main.c
Log:
reinstate old behaviour of -e flag at the request of Markus, plus checks and fallback if not in PERMANENT (#1507)

Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c	2011-12-14 12:40:33 UTC (rev 49744)
+++ grass/trunk/raster/r.in.gdal/main.c	2011-12-14 15:19:02 UTC (rev 49745)
@@ -141,7 +141,10 @@
 
     flag_e = G_define_flag();
     flag_e->key = 'e';
-    flag_e->description = _("Extend region extents based on new dataset");
+    flag_e->label = _("Extend location extents based on new dataset");
+    flag_e->description =
+	_("Updates default region if in the PERMANENT mapset, "
+	  "in other mapsets the current region will be extended");
 
     flag_f = G_define_flag();
     flag_f->key = 'f';
@@ -608,7 +611,10 @@
     /*      Extend current window based on dataset.                         */
     /* -------------------------------------------------------------------- */
     if (flag_e->answer) {
-	G_get_set_window(&cur_wind);
+	if (strcmp(G_mapset(), "PERMANENT") == 0)
+	    G_get_default_window(&cur_wind);
+	else
+	    G_get_set_window(&cur_wind);
 
 	cur_wind.north = MAX(cur_wind.north, cellhd.north);
 	cur_wind.south = MIN(cur_wind.south, cellhd.south);
@@ -623,7 +629,14 @@
 				  / cur_wind.ew_res);
 	cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;
 
-	G_put_window(&cur_wind);
+	if (strcmp(G_mapset(), "PERMANENT") == 0) {
+	    G__put_window(&cur_wind, "", "DEFAULT_WIND");
+	    G_message(_("Default region for this location updated"));
+	}
+	else {
+	    G_put_window(&cur_wind);
+	    G_message(_("Region for the current mapset updated"));
+	}
     }
 
     exit(EXIT_SUCCESS);



More information about the grass-commit mailing list