[GRASS-SVN] r49796 - grass/trunk/raster/r.external

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 17 18:56:53 EST 2011


Author: hamish
Date: 2011-12-17 15:56:53 -0800 (Sat, 17 Dec 2011)
New Revision: 49796

Modified:
   grass/trunk/raster/r.external/main.c
   grass/trunk/raster/r.external/window.c
Log:
also update DEFAULT_WIND (back again), #1507

Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c	2011-12-17 23:04:47 UTC (rev 49795)
+++ grass/trunk/raster/r.external/main.c	2011-12-17 23:56:53 UTC (rev 49796)
@@ -102,7 +102,8 @@
 
     flag.e = G_define_flag();
     flag.e->key = 'e';
-    flag.e->description = _("Extend region extents based on new dataset");
+    flag.e->label = _("Extend region extents based on new dataset");
+    flag.e->description = _("Also updates the default region if in the PERMANENT mapset");
 
     flag.r = G_define_flag();
     flag.r->key = 'r';

Modified: grass/trunk/raster/r.external/window.c
===================================================================
--- grass/trunk/raster/r.external/window.c	2011-12-17 23:04:47 UTC (rev 49795)
+++ grass/trunk/raster/r.external/window.c	2011-12-17 23:56:53 UTC (rev 49796)
@@ -68,7 +68,12 @@
 
     struct Cell_head cur_wind;
 
-    G_get_set_window(&cur_wind);
+    if (strcmp(G_mapset(), "PERMANENT") == 0) 
+	/* fixme: expand WIND and DEFAULT_WIND independently. (currently
+	 WIND gets forgotten and DEFAULT_WIND is expanded for both) */
+	G_get_default_window(&cur_wind);
+    else
+	G_get_window(&cur_wind);
 
     cur_wind.north = MAX(cur_wind.north, cellhd->north);
     cur_wind.south = MIN(cur_wind.south, cellhd->south);
@@ -83,5 +88,10 @@
 			      / cur_wind.ew_res);
     cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;
 
+    if (strcmp(G_mapset(), "PERMANENT") == 0) {
+	G__put_window(&cur_wind, "", "DEFAULT_WIND");
+	G_message(_("Default region for this location updated")); 
+    }
     G_put_window(&cur_wind);
+    G_message(_("Region for the current mapset updated"));
 }



More information about the grass-commit mailing list