Changeset 66596
- Timestamp:
- Oct 24, 2015, 8:55:49 PM (9 years ago)
- Location:
- grass/trunk/raster/r.in.lidar
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/raster/r.in.lidar/local_proto.h
r66594 r66596 42 42 #define METHOD_TRIMMEAN 13 43 43 44 #define LAS_ALL 0 45 #define LAS_FIRST 1 46 #define LAS_LAST 2 47 #define LAS_MID 3 48 49 44 50 /* info.c */ 45 51 void print_lasinfo(LASHeaderH, LASSRSH); -
grass/trunk/raster/r.in.lidar/main.c
r66595 r66596 34 34 #include "rast_segment.h" 35 35 #include "point_binning.h" 36 37 #define LAS_ALL 0 38 #define LAS_FIRST 1 39 #define LAS_LAST 2 40 #define LAS_MID 3 36 #include "filters.h" 37 41 38 42 39 int main(int argc, char *argv[]) … … 68 65 int arr_row, arr_col; 69 66 unsigned long count, count_total; 70 int skipme, i;71 67 int point_class; 72 68 … … 299 295 G_fatal_error(_("Unknown filter option <%s>"), filter_opt->answer); 300 296 } 297 struct ReturnFilter return_filter_struct; 298 return_filter_struct.filter = return_filter; 299 struct ClassFilter class_filter; 300 class_filter_create_from_strings(&class_filter, class_opt->answers); 301 301 302 302 /* Fetch input map projection in GRASS form. */ … … 499 499 z = LASPoint_GetZ(LAS_point); 500 500 501 if (return_filter != LAS_ALL) { 502 int return_no = LASPoint_GetReturnNumber(LAS_point); 503 int n_returns = LASPoint_GetNumberOfReturns(LAS_point); 504 skipme = 1; 505 506 switch (return_filter) { 507 case LAS_FIRST: 508 if (return_no == 1) 509 skipme = 0; 510 break; 511 case LAS_MID: 512 if (return_no > 1 && return_no < n_returns) 513 skipme = 0; 514 break; 515 case LAS_LAST: 516 if (n_returns > 1 && return_no == n_returns) 517 skipme = 0; 518 break; 519 } 520 521 if (skipme) { 522 n_filtered++; 523 continue; 524 } 525 } 526 if (class_opt->answer) { 527 point_class = (int) LASPoint_GetClassification(LAS_point); 528 i = 0; 529 skipme = TRUE; 530 while (class_opt->answers[i]) { 531 if (point_class == atoi(class_opt->answers[i])) { 532 skipme = FALSE; 533 break; 534 } 535 i++; 536 } 537 if (skipme) { 538 continue; 539 } 540 } 501 int return_n = LASPoint_GetReturnNumber(LAS_point); 502 int n_returns = LASPoint_GetNumberOfReturns(LAS_point); 503 if (return_filter_is_out(&return_filter_struct, return_n, n_returns)) { 504 n_filtered++; 505 continue; 506 } 507 point_class = (int) LASPoint_GetClassification(LAS_point); 508 if (class_filter_is_out(&class_filter, point_class)) 509 continue; 541 510 542 511 if (y <= pass_south || y > pass_north) {
Note:
See TracChangeset
for help on using the changeset viewer.
