[GRASS-SVN] r36724 - grass-addons/raster/r.terracost
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 13 19:34:49 EDT 2009
Author: neteler
Date: 2009-04-13 19:34:49 -0400 (Mon, 13 Apr 2009)
New Revision: 36724
Modified:
grass-addons/raster/r.terracost/main.cc
Log:
conditionalize G_get_window() and G_get_set_window() due to API change from GRASS 6 to 7
Modified: grass-addons/raster/r.terracost/main.cc
===================================================================
--- grass-addons/raster/r.terracost/main.cc 2009-04-13 19:35:24 UTC (rev 36723)
+++ grass-addons/raster/r.terracost/main.cc 2009-04-13 23:34:49 UTC (rev 36724)
@@ -25,6 +25,7 @@
extern "C" {
#include <grass/gis.h>
#include <grass/glocale.h>
+#include <grass/version.h>
}
#include <grass/iostream/ami.h>
@@ -481,9 +482,13 @@
/* get the current region and dimensions */
region = (struct Cell_head*)malloc(sizeof(struct Cell_head));
assert(region);
+#if defined(GRASS_VERSION_MAJOR) && (GRASS_VERSION_MAJOR > 6)
+ G_get_set_window(region);
+#else
if (G_get_set_window(region) == -1) {
- G_fatal_error("r.terracost: error getting current region");
+ G_fatal_error(_("Unable to get current region"));
}
+#endif
int nr = G_window_rows();
int nc = G_window_cols();
if ((nr > dimension_type_max) || (nc > dimension_type_max)) {
@@ -633,8 +638,12 @@
/* initializes values used in update.cc */
Cell_head window;
- int ok = G_get_window(&window);
+#if defined(GRASS_VERSION_MAJOR) && (GRASS_VERSION_MAJOR > 6)
+ G_get_window(&window);
+#else
+ int ok = G_get_window(&window);
assert(ok >= 0);
+#endif
opt->EW_fac = 1.0 ;
opt->NS_fac = window.ns_res/window.ew_res ;
opt->DIAG_fac = (double)sqrt((double)(opt->NS_fac*opt->NS_fac +
More information about the grass-commit
mailing list