[GRASS-SVN] r49799 - in grass/branches/develbranch_6:
raster/r.external raster/r.in.gdal vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 18 00:20:05 EST 2011
Author: hamish
Date: 2011-12-17 21:20:05 -0800 (Sat, 17 Dec 2011)
New Revision: 49799
Modified:
grass/branches/develbranch_6/raster/r.external/main.c
grass/branches/develbranch_6/raster/r.in.gdal/main.c
grass/branches/develbranch_6/vector/v.in.ogr/main.c
Log:
if in PERMANENT, also update WIND (merge from trunk; #1507)
Modified: grass/branches/develbranch_6/raster/r.external/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.external/main.c 2011-12-18 00:16:02 UTC (rev 49798)
+++ grass/branches/develbranch_6/raster/r.external/main.c 2011-12-18 05:20:05 UTC (rev 49799)
@@ -239,7 +239,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);
@@ -254,7 +259,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"));
}
static void query_band(GDALRasterBandH hBand, const char *output, int exact_range,
@@ -547,7 +557,9 @@
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/branches/develbranch_6/raster/r.in.gdal/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.in.gdal/main.c 2011-12-18 00:16:02 UTC (rev 49798)
+++ grass/branches/develbranch_6/raster/r.in.gdal/main.c 2011-12-18 05:20:05 UTC (rev 49799)
@@ -135,7 +135,9 @@
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_f = G_define_flag();
flag_f->key = 'f';
@@ -594,7 +596,12 @@
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
if (flag_e->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);
@@ -609,7 +616,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"));
}
exit(EXIT_SUCCESS);
Modified: grass/branches/develbranch_6/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ogr/main.c 2011-12-18 00:16:02 UTC (rev 49798)
+++ grass/branches/develbranch_6/vector/v.in.ogr/main.c 2011-12-18 05:20:05 UTC (rev 49799)
@@ -227,8 +227,10 @@
extend_flag = G_define_flag();
extend_flag->key = 'e';
+ extend_flag->label =
+ _("Extend region extents based on new dataset");
extend_flag->description =
- _("Extend region extents based on new dataset");
+ _("Also updates the default region if in the PERMANENT mapset");
tolower_flag = G_define_flag();
tolower_flag->key = 'w';
@@ -695,30 +697,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);
}
@@ -1186,7 +1176,12 @@
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
if (extend_flag->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);
@@ -1201,7 +1196,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 && !z_flag->answer)
More information about the grass-commit
mailing list