[GRASS-SVN] r67222 - grass/trunk/raster/r.in.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 18 07:21:18 PST 2015


Author: wenzeslaus
Date: 2015-12-18 07:21:18 -0800 (Fri, 18 Dec 2015)
New Revision: 67222

Modified:
   grass/trunk/raster/r.in.lidar/main.c
Log:
r.in.lidar: add flag to set region according to the new raster

This is the same as -e flag in v.in.lidar.
Perhaps -e and -n i r.in.lidar and -e in v.in.lidar
should be somehow synchronized.


Modified: grass/trunk/raster/r.in.lidar/main.c
===================================================================
--- grass/trunk/raster/r.in.lidar/main.c	2015-12-18 14:42:15 UTC (rev 67221)
+++ grass/trunk/raster/r.in.lidar/main.c	2015-12-18 15:21:18 UTC (rev 67222)
@@ -82,6 +82,7 @@
     struct Option *file_list_opt;
     struct Option *voutput_opt;
     struct Flag *print_flag, *scan_flag, *shell_style, *over_flag, *extents_flag, *intens_flag;
+    struct Flag *set_region_flag;
     struct Flag *base_rast_res_flag;
     struct Flag *notopo_flag;
 
@@ -239,6 +240,15 @@
 	_("Extend region extents based on new dataset");
     extents_flag->guisection = _("Output");
 
+    set_region_flag = G_define_flag();
+    set_region_flag->key = 'n';
+    set_region_flag->label =
+        _("Set computation region to match the new raster map");
+    set_region_flag->description =
+        _("Set computation region to match the 2D extent and resolution"
+          " of the newly created new raster map");
+    set_region_flag->guisection = _("Output");
+
     over_flag = G_define_flag();
     over_flag->key = 'o';
     over_flag->label =
@@ -273,6 +283,14 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
+    /* we could use rules but this gives more info and allows continuing */
+    if (set_region_flag->answer && !(extents_flag->answer || res_opt->answer)) {
+        G_warning(_("Flag %c makes sense only with %s option or -%c flag"),
+                  set_region_flag->key, res_opt->key, extents_flag->key);
+        /* avoid the call later on */
+        set_region_flag->answer = '\0';
+    }
+
     struct StringList infiles;
 
     if (file_list_opt->answer) {
@@ -683,6 +701,11 @@
         Vect_destroy_cats_struct(vector_writer.cats);
     }
 
+    /* set computation region to the new raster map */
+    /* TODO: should be in the done message */
+    if (set_region_flag->answer)
+        G_put_window(&region);
+
     if (infiles.num_items > 1) {
         sprintf(buff, _("Raster map <%s> created."
                         " %lu points from %d files found in region."),



More information about the grass-commit mailing list