Explorar el Código

Preprocess only flag (-p) added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58074 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho hace 11 años
padre
commit
d7cc76c805
Se han modificado 1 ficheros con 17 adiciones y 4 borrados
  1. 17 4
      raster/r.topmodel/main.c

+ 17 - 4
raster/r.topmodel/main.c

@@ -37,6 +37,10 @@ int main(int argc, char **argv)
 	struct Option *ntopidxclasses;
 	struct Option *outtopidxstats;
     } params;
+    struct
+    {
+	struct Flag *preprocess;
+    } flags;
 
     /* Initialize GRASS and parse command line */
     G_gisinit(argv[0]);
@@ -89,7 +93,7 @@ int main(int argc, char **argv)
     params.topidx->label =
 	_("Name of input topographic index ln(a/tanB) raster map");
     params.topidx->description =
-	    _("Must be clipped to the catchment boundary. Used for generating outtopidxstats.");
+	_("Must be clipped to the catchment boundary. Used for generating outtopidxstats.");
     params.topidx->required = NO;
     params.topidx->guisection = _("Preprocess");
 
@@ -97,7 +101,7 @@ int main(int argc, char **argv)
     params.ntopidxclasses->key = "ntopidxclasses";
     params.ntopidxclasses->label = _("Number of topographic index classes");
     params.ntopidxclasses->description =
-	    _("Used for generating outtopidxstats.");
+	_("Used for generating outtopidxstats.");
     params.ntopidxclasses->type = TYPE_INTEGER;
     params.ntopidxclasses->required = NO;
     params.ntopidxclasses->answer = "30";
@@ -108,10 +112,16 @@ int main(int argc, char **argv)
     params.outtopidxstats->label =
 	_("Name for output topographic index statistics file");
     params.outtopidxstats->description =
-	    _("Requires topidx and ntopidxclasses.");
+	_("Requires topidx and ntopidxclasses.");
     params.outtopidxstats->required = NO;
     params.outtopidxstats->guisection = _("Preprocess");
 
+    flags.preprocess = G_define_flag();
+    flags.preprocess->key = 'p';
+    flags.preprocess->description =
+	_("Preprocess only and stop after generating outtopidxstats");
+    flags.preprocess->suppress_required = YES;
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -149,6 +159,9 @@ int main(int argc, char **argv)
 	G_warning(_("Ignoring outtopidxstats because topidx is not specified."));
     }
 
+    if (flags.preprocess->answer)
+        exit(EXIT_SUCCESS);
+
     /* Read required files */
     read_input();
 
@@ -158,5 +171,5 @@ int main(int argc, char **argv)
     /* Write outputs */
     write_output();
 
-    exit(0);
+    exit(EXIT_SUCCESS);
 }