[GRASS-SVN] r49733 - in grass/trunk: raster/r.external
raster/r.in.gdal vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 14 04:33:15 EST 2011
Author: hamish
Date: 2011-12-14 01:33:15 -0800 (Wed, 14 Dec 2011)
New Revision: 49733
Modified:
grass/trunk/raster/r.external/main.c
grass/trunk/raster/r.external/proj.c
grass/trunk/raster/r.external/window.c
grass/trunk/raster/r.in.gdal/main.c
grass/trunk/vector/v.in.ogr/main.c
Log:
Modules are only allowed to modify the current mapset. (#1507)
Checking projection against DEFAULT_WIND is more reliable.
Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c 2011-12-14 09:11:59 UTC (rev 49732)
+++ grass/trunk/raster/r.external/main.c 2011-12-14 09:33:15 UTC (rev 49733)
@@ -102,7 +102,7 @@
flag.e = G_define_flag();
flag.e->key = 'e';
- flag.e->description = _("Extend location extents based on new dataset");
+ flag.e->description = _("Extend region extents based on new dataset");
flag.r = G_define_flag();
flag.r->key = 'r';
Modified: grass/trunk/raster/r.external/proj.c
===================================================================
--- grass/trunk/raster/r.external/proj.c 2011-12-14 09:11:59 UTC (rev 49732)
+++ grass/trunk/raster/r.external/proj.c 2011-12-14 09:33:15 UTC (rev 49733)
@@ -22,7 +22,7 @@
/* Does the projection of the current location match the */
/* dataset? */
/* -------------------------------------------------------------------- */
- G_get_window(&loc_wind);
+ G_get_default_window(&loc_wind);
if (loc_wind.proj != PROJECTION_XY) {
loc_proj_info = G_get_projinfo();
loc_proj_units = G_get_projunits();
Modified: grass/trunk/raster/r.external/window.c
===================================================================
--- grass/trunk/raster/r.external/window.c 2011-12-14 09:11:59 UTC (rev 49732)
+++ grass/trunk/raster/r.external/window.c 2011-12-14 09:33:15 UTC (rev 49733)
@@ -66,22 +66,22 @@
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
- struct Cell_head def_wind;
+ struct Cell_head cur_wind;
- G_get_default_window(&def_wind);
+ G_get_set_window(&cur_wind);
- def_wind.north = MAX(def_wind.north, cellhd->north);
- def_wind.south = MIN(def_wind.south, cellhd->south);
- def_wind.west = MIN(def_wind.west, cellhd->west);
- def_wind.east = MAX(def_wind.east, cellhd->east);
+ cur_wind.north = MAX(cur_wind.north, cellhd->north);
+ cur_wind.south = MIN(cur_wind.south, cellhd->south);
+ cur_wind.west = MIN(cur_wind.west, cellhd->west);
+ cur_wind.east = MAX(cur_wind.east, cellhd->east);
- def_wind.rows = (int)ceil((def_wind.north - def_wind.south)
- / def_wind.ns_res);
- def_wind.south = def_wind.north - def_wind.rows * def_wind.ns_res;
+ cur_wind.rows = (int)ceil((cur_wind.north - cur_wind.south)
+ / cur_wind.ns_res);
+ cur_wind.south = cur_wind.north - cur_wind.rows * cur_wind.ns_res;
- def_wind.cols = (int)ceil((def_wind.east - def_wind.west)
- / def_wind.ew_res);
- def_wind.east = def_wind.west + def_wind.cols * def_wind.ew_res;
+ cur_wind.cols = (int)ceil((cur_wind.east - cur_wind.west)
+ / cur_wind.ew_res);
+ cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;
- G__put_window(&def_wind, "../PERMANENT", "DEFAULT_WIND");
+ G_put_window(&cur_wind);
}
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2011-12-14 09:11:59 UTC (rev 49732)
+++ grass/trunk/raster/r.in.gdal/main.c 2011-12-14 09:33:15 UTC (rev 49733)
@@ -52,7 +52,7 @@
char *input;
char *output;
char *title;
- struct Cell_head cellhd, loc_wind, def_wind;
+ struct Cell_head cellhd, loc_wind, cur_wind;
struct Key_Value *proj_info = NULL, *proj_units = NULL;
struct Key_Value *loc_proj_info = NULL, *loc_proj_units = NULL;
GDALDatasetH hDS;
@@ -141,7 +141,7 @@
flag_e = G_define_flag();
flag_e->key = 'e';
- flag_e->description = _("Extend location extents based on new dataset");
+ flag_e->description = _("Extend region extents based on new dataset");
flag_f = G_define_flag();
flag_f->key = 'f';
@@ -358,7 +358,7 @@
/* Does the projection of the current location match the */
/* dataset? */
/* -------------------------------------------------------------------- */
- G_get_window(&loc_wind);
+ G_get_default_window(&loc_wind);
if (loc_wind.proj != PROJECTION_XY) {
loc_proj_info = G_get_projinfo();
loc_proj_units = G_get_projunits();
@@ -373,8 +373,7 @@
|| (projcomp_error = G_compare_projections(loc_proj_info,
loc_proj_units,
proj_info,
- proj_units)) <
- 0) {
+ proj_units)) < 0) {
int i_value;
strcpy(error_msg,
@@ -609,22 +608,22 @@
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
if (flag_e->answer) {
- G_get_default_window(&def_wind);
+ G_get_set_window(&cur_wind);
- def_wind.north = MAX(def_wind.north, cellhd.north);
- def_wind.south = MIN(def_wind.south, cellhd.south);
- def_wind.west = MIN(def_wind.west, cellhd.west);
- def_wind.east = MAX(def_wind.east, cellhd.east);
+ cur_wind.north = MAX(cur_wind.north, cellhd.north);
+ cur_wind.south = MIN(cur_wind.south, cellhd.south);
+ cur_wind.west = MIN(cur_wind.west, cellhd.west);
+ cur_wind.east = MAX(cur_wind.east, cellhd.east);
- def_wind.rows = (int)ceil((def_wind.north - def_wind.south)
- / def_wind.ns_res);
- def_wind.south = def_wind.north - def_wind.rows * def_wind.ns_res;
+ cur_wind.rows = (int)ceil((cur_wind.north - cur_wind.south)
+ / cur_wind.ns_res);
+ cur_wind.south = cur_wind.north - cur_wind.rows * cur_wind.ns_res;
- def_wind.cols = (int)ceil((def_wind.east - def_wind.west)
- / def_wind.ew_res);
- def_wind.east = def_wind.west + def_wind.cols * def_wind.ew_res;
+ cur_wind.cols = (int)ceil((cur_wind.east - cur_wind.west)
+ / cur_wind.ew_res);
+ cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;
- G__put_window(&def_wind, "../PERMANENT", "DEFAULT_WIND");
+ G_put_window(&cur_wind);
}
exit(EXIT_SUCCESS);
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2011-12-14 09:11:59 UTC (rev 49732)
+++ grass/trunk/vector/v.in.ogr/main.c 2011-12-14 09:33:15 UTC (rev 49733)
@@ -256,7 +256,7 @@
flag.extend = G_define_flag();
flag.extend->key = 'e';
flag.extend->description =
- _("Extend location extents based on new dataset");
+ _("Extend region extents based on new dataset");
flag.tolower = G_define_flag();
flag.tolower->key = 'w';
@@ -538,7 +538,7 @@
/* Does the projection of the current location match the dataset? */
/* G_get_window seems to be unreliable if the location has been changed */
- G__get_window(&loc_wind, "", "DEFAULT_WIND", "PERMANENT");
+ G_get_default_window(&loc_wind);
/* fetch LOCATION PROJ info */
if (loc_wind.proj != PROJECTION_XY) {
loc_proj_info = G_get_projinfo();
@@ -1242,22 +1242,22 @@
/* Extend current window based on dataset. */
/* -------------------------------------------------------------------- */
if (flag.extend->answer) {
- G_get_default_window(&loc_wind);
+ G_get_set_window(&cur_wind);
- loc_wind.north = MAX(loc_wind.north, cellhd.north);
- loc_wind.south = MIN(loc_wind.south, cellhd.south);
- loc_wind.west = MIN(loc_wind.west, cellhd.west);
- loc_wind.east = MAX(loc_wind.east, cellhd.east);
+ cur_wind.north = MAX(cur_wind.north, cellhd.north);
+ cur_wind.south = MIN(cur_wind.south, cellhd.south);
+ cur_wind.west = MIN(cur_wind.west, cellhd.west);
+ cur_wind.east = MAX(cur_wind.east, cellhd.east);
- loc_wind.rows = (int)ceil((loc_wind.north - loc_wind.south)
- / loc_wind.ns_res);
- loc_wind.south = loc_wind.north - loc_wind.rows * loc_wind.ns_res;
+ cur_wind.rows = (int)ceil((cur_wind.north - cur_wind.south)
+ / cur_wind.ns_res);
+ cur_wind.south = cur_wind.north - cur_wind.rows * cur_wind.ns_res;
- loc_wind.cols = (int)ceil((loc_wind.east - loc_wind.west)
- / loc_wind.ew_res);
- loc_wind.east = loc_wind.west + loc_wind.cols * loc_wind.ew_res;
+ cur_wind.cols = (int)ceil((cur_wind.east - cur_wind.west)
+ / cur_wind.ew_res);
+ cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;
- G__put_window(&loc_wind, "../PERMANENT", "DEFAULT_WIND");
+ G_put_window(&cur_wind);
}
if (with_z && !flag.z->answer)
More information about the grass-commit
mailing list