[GRASS-SVN] r49798 - grass/trunk/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 17 19:16:02 EST 2011


Author: hamish
Date: 2011-12-17 16:16:02 -0800 (Sat, 17 Dec 2011)
New Revision: 49798

Modified:
   grass/trunk/vector/v.in.ogr/main.c
Log:
also update DEFAULT_WIND (back again; merge from r.in.gdal), #1507

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2011-12-18 00:05:33 UTC (rev 49797)
+++ grass/trunk/vector/v.in.ogr/main.c	2011-12-18 00:16:02 UTC (rev 49798)
@@ -255,8 +255,10 @@
 
     flag.extend = G_define_flag();
     flag.extend->key = 'e';
+    flag.extend->label =
+	_("Extend region extents based on new dataset");
     flag.extend->description =
-	_("Extend region extents based on new dataset");
+	_("Also updates the default region if in the PERMANENT mapset");
 
     flag.tolower = G_define_flag();
     flag.tolower->key = 'w';
@@ -778,30 +780,18 @@
 		}
 
 		/** Simple 32bit integer                     OFTInteger = 0        **/
-
 		/** List of 32bit integers                   OFTIntegerList = 1    **/
-
 		/** Double Precision floating point          OFTReal = 2           **/
-
 		/** List of doubles                          OFTRealList = 3       **/
-
 		/** String of ASCII chars                    OFTString = 4         **/
-
 		/** Array of strings                         OFTStringList = 5     **/
-
 		/** Double byte string (unsupported)         OFTWideString = 6     **/
-
 		/** List of wide strings (unsupported)       OFTWideStringList = 7 **/
-
 		/** Raw Binary data (unsupported)            OFTBinary = 8         **/
-
 		/**                                          OFTDate = 9           **/
-
 		/**                                          OFTTime = 10          **/
-
 		/**                                          OFTDateTime = 11      **/
 
-
 		if (Ogr_ftype == OFTInteger) {
 		    sprintf(buf, ", %s integer", Ogr_fieldname);
 		}
@@ -1242,7 +1232,12 @@
     /*      Extend current window based on dataset.                         */
     /* -------------------------------------------------------------------- */
     if (flag.extend->answer) {
-	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);
@@ -1257,7 +1252,12 @@
 				  / 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"));
     }
 
     if (with_z && !flag.z->answer)



More information about the grass-commit mailing list