[GRASS-SVN] r61916 - grass/trunk/raster/r.in.lidar
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 13 14:27:42 PDT 2014
Author: annakrat
Date: 2014-09-13 14:27:42 -0700 (Sat, 13 Sep 2014)
New Revision: 61916
Modified:
grass/trunk/raster/r.in.lidar/main.c
Log:
r.in.lidar: add class_filter option, filter option renamed to return_filter, from v.in.lidar
Modified: grass/trunk/raster/r.in.lidar/main.c
===================================================================
--- grass/trunk/raster/r.in.lidar/main.c 2014-09-13 21:00:39 UTC (rev 61915)
+++ grass/trunk/raster/r.in.lidar/main.c 2014-09-13 21:27:42 UTC (rev 61916)
@@ -125,6 +125,8 @@
double pass_north, pass_south;
int arr_row, arr_col;
unsigned long count, count_total;
+ int skipme, i;
+ int point_class;
double min = 0.0 / 0.0; /* init as nan */
double max = 0.0 / 0.0; /* init as nan */
@@ -143,7 +145,7 @@
int r_low, r_up;
struct GModule *module;
- struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt;
+ struct Option *input_opt, *output_opt, *percent_opt, *type_opt, *filter_opt, *class_opt;
struct Option *method_opt, *zrange_opt, *zscale_opt;
struct Option *trim_opt, *pth_opt, *res_opt;
struct Flag *print_flag, *scan_flag, *shell_style, *over_flag, *extents_flag, *intens_flag;
@@ -244,13 +246,22 @@
_("Output raster resolution");
filter_opt = G_define_option();
- filter_opt->key = "filter";
+ filter_opt->key = "return_filter";
filter_opt->type = TYPE_STRING;
filter_opt->required = NO;
filter_opt->label = _("Only import points of selected return type");
filter_opt->description = _("If not specified, all points are imported");
filter_opt->options = "first,last,mid";
+ class_opt = G_define_option();
+ class_opt->key = "class_filter";
+ class_opt->type = TYPE_INTEGER;
+ class_opt->multiple = YES;
+ class_opt->required = NO;
+ class_opt->label = _("Only import points of selected class(es)");
+ class_opt->description = _("Input is comma separated integers. "
+ "If not specified, all points are imported.");
+
print_flag = G_define_flag();
print_flag->key = 'p';
print_flag->description =
@@ -775,7 +786,7 @@
if (return_filter != LAS_ALL) {
int return_no = LASPoint_GetReturnNumber(LAS_point);
int n_returns = LASPoint_GetNumberOfReturns(LAS_point);
- int skipme = 1;
+ skipme = 1;
if (n_returns > 1) {
@@ -799,6 +810,21 @@
continue;
}
}
+ if (class_opt->answer) {
+ point_class = (int) LASPoint_GetClassification(LAS_point);
+ i = 0;
+ skipme = TRUE;
+ while (class_opt->answers[i]) {
+ if (point_class == atoi(class_opt->answers[i])) {
+ skipme = FALSE;
+ break;
+ }
+ i++;
+ }
+ if (skipme) {
+ continue;
+ }
+ }
if (y <= pass_south || y > pass_north) {
continue;
More information about the grass-commit
mailing list