浏览代码

r.thin: Support reclassified raster maps (trunk, https://trac.osgeo.org/grass/changeset/66399 + https://trac.osgeo.org/grass/changeset/66400)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67252 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 年之前
父节点
当前提交
f7bbd9665e
共有 2 个文件被更改,包括 16 次插入11 次删除
  1. 11 8
      raster/r.thin/io.c
  2. 5 3
      raster/r.thin/main.c

+ 11 - 8
raster/r.thin/io.c

@@ -86,18 +86,21 @@ int open_file(char *name)
     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 @@ int open_file(char *name)
     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 @@ int close_file(char *name)
 
     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 @@ int close_file(char *name)
     /* 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 @@ int close_file(char *name)
     /* 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);

+ 5 - 3
raster/r.thin/main.c

@@ -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