[GRASS-SVN] r36815 -
grass/branches/releasebranch_6_4/raster/r.topidx
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 20 08:27:46 EDT 2009
Author: neteler
Date: 2009-04-20 08:27:46 -0400 (Mon, 20 Apr 2009)
New Revision: 36815
Modified:
grass/branches/releasebranch_6_4/raster/r.topidx/file_io.c
grass/branches/releasebranch_6_4/raster/r.topidx/main.c
Log:
trap if current region resolution is higher than map resolution
Modified: grass/branches/releasebranch_6_4/raster/r.topidx/file_io.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.topidx/file_io.c 2009-04-20 12:27:27 UTC (rev 36814)
+++ grass/branches/releasebranch_6_4/raster/r.topidx/file_io.c 2009-04-20 12:27:46 UTC (rev 36815)
@@ -10,12 +10,14 @@
RASTER_MAP_TYPE data_type;
CELL *ccell = NULL;
FCELL *fcell = NULL;
+ struct Cell_head inhead;
-
if ((fd = G_open_cell_old(iname, mapset)) < 0)
G_fatal_error(_("Cannot open raster map <%s>"), iname);
data_type = G_get_raster_map_type(fd);
+ if (G_get_cellhd(iname, mapset, &inhead) < 0 )
+ G_fatal_error(_("Unable to read header of raster map <%s>"), iname);
if (data_type == CELL_TYPE)
ccell = (CELL *) G_malloc(sizeof(CELL) * window.cols);
@@ -26,6 +28,9 @@
atb = (DCELL **) G_malloc(sizeof(DCELL *) * window.rows);
a = (DCELL **) G_malloc(sizeof(DCELL *) * window.rows);
+ if ((window.ew_res < inhead.ew_res) || (window.ns_res < inhead.ns_res))
+ G_fatal_error(_("Current region resolution [%.2fx%.2f] lower than input map resolution [%.2fx%.2f]! Needs to be at least identical or the current region resolution lower than the input map resolution"),window.ew_res, window.ns_res, inhead.ew_res, inhead.ns_res);
+
G_important_message(_("Reading elevation map..."));
for (i = 0; i < window.rows; i++) {
Modified: grass/branches/releasebranch_6_4/raster/r.topidx/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.topidx/main.c 2009-04-20 12:27:27 UTC (rev 36814)
+++ grass/branches/releasebranch_6_4/raster/r.topidx/main.c 2009-04-20 12:27:46 UTC (rev 36815)
@@ -19,6 +19,7 @@
*****************************************************************************/
#define MAIN
+#include <grass/gis.h>
#include <grass/glocale.h>
#include "global.h"
More information about the grass-commit
mailing list