| 2980 | } |
| 2981 | |
| 2982 | BOOL LASreadOpener::add_neighbor_list_of_files(const CHAR* neighbor_list_of_files, BOOL unique) { |
| 2983 | FILE* file = LASfopen(neighbor_list_of_files, "r"); |
| 2984 | if (file == 0) { |
| 2985 | laserror("cannot open '%s'", neighbor_list_of_files); |
| 2986 | return FALSE; |
| 2987 | } |
| 2988 | CHAR line[2048]; |
| 2989 | U32 ID; |
| 2990 | I64 npoints; |
| 2991 | F64 min_x; |
| 2992 | F64 min_y; |
| 2993 | F64 max_x; |
| 2994 | F64 max_y; |
| 2995 | int num; |
| 2996 | while (fgets(line, 2048, file)) { |
| 2997 | // find end of line |
| 2998 | I32 len = (I32)strlen(line) - 1; |
| 2999 | // remove extra white spaces and line return at the end |
| 3000 | while ((len > 0) && ((line[len] == '\n') || (line[len] == ' ') || (line[len] == '\t') || (line[len] == '\012'))) { |
| 3001 | line[len] = '\0'; |
| 3002 | len--; |
| 3003 | } |
| 3004 | // try to parse number of points and xy bounds |
| 3005 | num = sscanf_las(line, "%u,%lld,%lf,%lf,%lf,%lf,", &ID, &npoints, &min_x, &min_y, &max_x, &max_y); |
| 3006 | if (num == 6) { |
| 3007 | // skip number of points and xy bounds |
| 3008 | num = 0; |
| 3009 | while ((num < len) && (line[num] != ',')) num++; |
| 3010 | num++; |
| 3011 | while ((num < len) && (line[num] != ',')) num++; |
| 3012 | num++; |
| 3013 | while ((num < len) && (line[num] != ',')) num++; |
| 3014 | num++; |
| 3015 | while ((num < len) && (line[num] != ',')) num++; |
| 3016 | num++; |
| 3017 | while ((num < len) && (line[num] != ',')) num++; |
| 3018 | num++; |
| 3019 | while ((num < len) && (line[num] != ',')) num++; |
| 3020 | num++; |
| 3021 | // remove extra white spaces at the beginning |
| 3022 | while ((num < len) && ((line[num] == ' ') || (line[num] == '\t'))) num++; |
| 3023 | add_neighbor_file_name(&line[num], npoints, min_x, min_y, max_x, max_y, unique); |
| 3024 | } else { |
| 3025 | #ifdef _WIN32 |
| 3026 | add_neighbor_file_name_single(line); |
| 3027 | #else |
| 3028 | add_neighbor_file_name(line); |
| 3029 | #endif |
| 3030 | } |
| 3031 | } |
| 3032 | fclose(file); |
| 3033 | return TRUE; |
| 3034 | } |
| 3035 | |
| 3036 | void LASreadOpener::delete_file_name(U32 file_name_id) { |
| 3037 | if (file_name_id < file_name_number) { |
nothing calls this directly
no test coverage detected