[GRASS-SVN] r69690 - grass/branches/releasebranch_7_2/raster/r.patch

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 9 03:59:56 PDT 2016


Author: mlennert
Date: 2016-10-09 03:59:56 -0700 (Sun, 09 Oct 2016)
New Revision: 69690

Modified:
   grass/branches/releasebranch_7_2/raster/r.patch/main.c
   grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html
Log:
r.patch: add flag to avoid creation of color and category files (merge from trunk r68681 - fix for #3056)


Modified: grass/branches/releasebranch_7_2/raster/r.patch/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.patch/main.c	2016-10-09 02:51:13 UTC (rev 69689)
+++ grass/branches/releasebranch_7_2/raster/r.patch/main.c	2016-10-09 10:59:56 UTC (rev 69690)
@@ -41,7 +41,7 @@
     char *rname;
     int i;
     int row, nrows, ncols;
-    int use_zero;
+    int use_zero, no_support;
     char *new_name;
     char **names;
     char **ptr;
@@ -49,7 +49,7 @@
     struct Cell_head *cellhd;
 
     struct GModule *module;
-    struct Flag *zeroflag;
+    struct Flag *zeroflag, *nosupportflag;
     struct Option *opt1, *opt2;
 
     G_gisinit(argv[0]);
@@ -80,10 +80,16 @@
     zeroflag->description =
 	_("Use zero (0) for transparency instead of NULL");
 
+    nosupportflag = G_define_flag();
+    nosupportflag->key = 's';
+    nosupportflag->description =
+	_("Do not create color and category files");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     use_zero = (zeroflag->answer);
+    no_support = (nosupportflag->answer);
 
     names = opt1->answers;
 
@@ -163,19 +169,24 @@
     G_free(presult);
     for (i = 0; i < nfiles; i++)
 	Rast_close(infd[i]);
-    /* 
-     * build the new cats and colors. do this before closing the new
-     * file, in case the new file is one of the patching files as well.
-     */
-    G_verbose_message(_("Creating support files for raster map <%s>..."), new_name);
-    support(names, statf, nfiles, &cats, &cats_ok, &colr, &colr_ok, out_type);
 
+    if(!no_support) {
+        /* 
+         * build the new cats and colors. do this before closing the new
+         * file, in case the new file is one of the patching files as well.
+         */
+        G_verbose_message(_("Creating support files for raster map <%s>..."), new_name);
+        support(names, statf, nfiles, &cats, &cats_ok, &colr, &colr_ok, out_type);
+    }
+
     /* now close (and create) the result */
     Rast_close(outfd);
-    if (cats_ok)
-	Rast_write_cats(new_name, &cats);
-    if (colr_ok)
-	Rast_write_colors(new_name, G_mapset(), &colr);
+    if(!no_support) {
+        if (cats_ok)
+    	    Rast_write_cats(new_name, &cats);
+	if (colr_ok)
+	    Rast_write_colors(new_name, G_mapset(), &colr);
+    }
 
     Rast_short_history(new_name, "raster", &history);
     Rast_command_history(&history);

Modified: grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html	2016-10-09 02:51:13 UTC (rev 69689)
+++ grass/branches/releasebranch_7_2/raster/r.patch/r.patch.html	2016-10-09 10:59:56 UTC (rev 69690)
@@ -80,7 +80,13 @@
 layer.
 
 <p>
-<em>r.patch</em> creates support files for the patched, composite output map. 
+<em>r.patch</em> reads the existing category label files and color tables
+from the <em>input</em> maps and creates these files for the patched, 
+composite <em>output</em> map.  This can be quite time consuming for 
+certain maps, especially if there are many different category values 
+across the patched maps. The <em>-s</em> flag allows to disable the reading
+and creation of these support files,  meaning that the <em>output</em> 
+map will have no category labels and no explicit color table.
 
 <p>
 Number of raster maps to be processed is given by the limit of the



More information about the grass-commit mailing list