[GRASS-SVN] r67252 - grass/branches/releasebranch_7_0/raster/r.thin
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 19 13:34:18 PST 2015
Author: neteler
Date: 2015-12-19 13:34:18 -0800 (Sat, 19 Dec 2015)
New Revision: 67252
Modified:
grass/branches/releasebranch_7_0/raster/r.thin/io.c
grass/branches/releasebranch_7_0/raster/r.thin/main.c
Log:
r.thin: Support reclassified raster maps (trunk, r66399 + r66400)
Modified: grass/branches/releasebranch_7_0/raster/r.thin/io.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.thin/io.c 2015-12-19 21:11:31 UTC (rev 67251)
+++ grass/branches/releasebranch_7_0/raster/r.thin/io.c 2015-12-19 21:34:18 UTC (rev 67252)
@@ -86,18 +86,21 @@
int i, row;
CELL *buf;
char *tmpstr1, *tmpstr2;
+ char rname[GNAME_MAX];
+ char rmapset[GMAPSET_MAX];
/* open raster map */
cell_file = Rast_open_old(name, "");
-
- if (Rast_get_map_type(cell_file) != CELL_TYPE) {
+
+ if (Rast_is_reclass(name, "", rname, rmapset) <= 0 &&
+ Rast_get_map_type(cell_file) != CELL_TYPE) {
Rast_close(cell_file);
G_fatal_error(_("Input raster must be of type CELL."));
}
n_rows = Rast_window_rows();
n_cols = Rast_window_cols();
-
+
/* GTC Count of raster rows */
G_asprintf(&tmpstr1, n_("%d row", "%d rows", n_rows), n_rows);
/* GTC Count of raster columns */
@@ -106,7 +109,7 @@
G_message(_("Raster map <%s> - %s X %s"), name, tmpstr1, tmpstr2);
G_free(tmpstr1);
G_free(tmpstr2);
-
+
n_cols += (PAD << 1);
/* copy raster map into our read/write file */
@@ -164,7 +167,7 @@
row_count = n_rows - (PAD << 1);
col_count = n_cols - (PAD << 1);
-
+
/* GTC Count of raster rows */
G_asprintf(&tmpstr1, n_("%d row", "%d rows", row_count), row_count);
/* GTC Count of raster columns */
@@ -172,8 +175,8 @@
/* GTC %s will be replaced with number of rows and columns */
G_message(_("Output map %s X %s"), tmpstr1, tmpstr2);
G_free(tmpstr1);
- G_free(tmpstr2);
-
+ G_free(tmpstr2);
+
/* GTC Count of window rows */
G_asprintf(&tmpstr1, n_("%d row", "%d rows", Rast_window_rows()), Rast_window_rows());
/* GTC Count of window columns */
@@ -181,7 +184,7 @@
/* GTC %s will be replaced with number of rows and columns */
G_message(_("Window %s X %s"), tmpstr1, tmpstr2);
G_free(tmpstr1);
- G_free(tmpstr2);
+ G_free(tmpstr2);
for (row = 0, k = PAD; row < row_count; row++, k++) {
buf = get_a_row(k);
Modified: grass/branches/releasebranch_7_0/raster/r.thin/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.thin/main.c 2015-12-19 21:11:31 UTC (rev 67251)
+++ grass/branches/releasebranch_7_0/raster/r.thin/main.c 2015-12-19 21:34:18 UTC (rev 67252)
@@ -8,10 +8,12 @@
* Systems, 1990) and Jean Ezell (USACERL, 1988).
*
* Roberto Flor <flor itc.it>, Markus Neteler <neteler itc.it>
- * Glynn Clements <glynn gclements.plus.com>, Hamish Bowman <hamish_b yahoo.com>,
- * Jan-Oliver Wagner <jan intevation.de>
+ * Glynn Clements <glynn gclements.plus.com>,
+ * Hamish Bowman <hamish_b yahoo.com>,
+ * Jan-Oliver Wagner <jan intevation.de>,
+ * Huidae Cho <grass4u gmail.com>
* PURPOSE: Cell-file line thinning
- * COPYRIGHT: (C) 1999-2006 by the GRASS Development Team
+ * COPYRIGHT: (C) 1999-2015 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
More information about the grass-commit
mailing list