[GRASS-SVN] r68681 - grass/trunk/raster/r.patch

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 14 07:40:47 PDT 2016


Author: mlennert
Date: 2016-06-14 07:40:47 -0700 (Tue, 14 Jun 2016)
New Revision: 68681

Modified:
   grass/trunk/raster/r.patch/main.c
   grass/trunk/raster/r.patch/r.patch.html
Log:
r.patch: add flag to avoid creation of color and category files


Modified: grass/trunk/raster/r.patch/main.c
===================================================================
--- grass/trunk/raster/r.patch/main.c	2016-06-14 10:23:28 UTC (rev 68680)
+++ grass/trunk/raster/r.patch/main.c	2016-06-14 14:40:47 UTC (rev 68681)
@@ -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/trunk/raster/r.patch/r.patch.html
===================================================================
--- grass/trunk/raster/r.patch/r.patch.html	2016-06-14 10:23:28 UTC (rev 68680)
+++ grass/trunk/raster/r.patch/r.patch.html	2016-06-14 14:40:47 UTC (rev 68681)
@@ -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