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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 20 10:02:24 EDT 2008


Author: glynn
Date: 2008-08-20 10:02:24 -0400 (Wed, 20 Aug 2008)
New Revision: 32925

Modified:
   grass/trunk/raster/r.external/main.c
Log:
Add -r flag (require exact range)


Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c	2008-08-20 13:49:49 UTC (rev 32924)
+++ grass/trunk/raster/r.external/main.c	2008-08-20 14:02:24 UTC (rev 32925)
@@ -259,7 +259,7 @@
     G__put_window(&def_wind, "../PERMANENT", "DEFAULT_WIND");
 }
 
-static void query_band(GDALRasterBandH hBand, const char *output,
+static void query_band(GDALRasterBandH hBand, const char *output, int exact_range,
 		       struct Cell_head *cellhd, struct band_info *info)
 {
     int bGotMin, bGotMax;
@@ -306,7 +306,7 @@
     info->range[0] = GDALGetRasterMinimum(hBand, &bGotMin);
     info->range[1] = GDALGetRasterMaximum(hBand, &bGotMax);
     if(!(bGotMin && bGotMax))
-	GDALComputeRasterMinMax(hBand, TRUE, info->range);
+	GDALComputeRasterMinMax(hBand, !exact_range, info->range);
 
     G_init_colors(&info->colors);
 
@@ -453,7 +453,7 @@
     struct {
 	struct Option *input, *output, *band, *title;
     } parm;
-    struct Flag *flag_o, *flag_f, *flag_e;
+    struct Flag *flag_o, *flag_f, *flag_e, *flag_r;
     int band;
     struct band_info info;
 
@@ -497,6 +497,10 @@
     flag_e->key = 'e';
     flag_e->description = _("Extend location extents based on new dataset");
 
+    flag_r = G_define_flag();
+    flag_r->key = 'r';
+    flag_r->description = _("Require exact range");
+
     flag_f = G_define_flag();
     flag_f->key = 'f';
     flag_f->description = _("List supported formats and exit");
@@ -551,7 +555,7 @@
     if (G_set_window(&cellhd) < 0)
 	G_fatal_error(_("Unable to set window"));
 
-    query_band(hBand, output, &cellhd, &info);
+    query_band(hBand, output, flag_r->answer, &cellhd, &info);
     create_map(input, band, output, &cellhd, &info, title);
 
     if (flag_e->answer)



More information about the grass-commit mailing list