| 419 | } |
| 420 | |
| 421 | BOOL LASwriterTXT::write_point(const LASpoint* point) |
| 422 | { |
| 423 | p_count++; |
| 424 | int i = 0; |
| 425 | while (true) |
| 426 | { |
| 427 | switch (parse_string[i]) |
| 428 | { |
| 429 | case 'x': // the x coordinate |
| 430 | lidardouble2string(printstring, header->get_x(point->get_X()), header->x_scale_factor); fprintf(file, "%s", printstring); |
| 431 | break; |
| 432 | case 'y': // the y coordinate |
| 433 | lidardouble2string(printstring, header->get_y(point->get_Y()), header->y_scale_factor); fprintf(file, "%s", printstring); |
| 434 | break; |
| 435 | case 'z': // the z coordinate |
| 436 | lidardouble2string(printstring, header->get_z(point->get_Z()), header->z_scale_factor); fprintf(file, "%s", printstring); |
| 437 | break; |
| 438 | case 't': // the gps-time |
| 439 | fprintf(file, "%.6f", point->get_gps_time()); |
| 440 | break; |
| 441 | case 'i': // the intensity |
| 442 | if (opts) |
| 443 | fprintf(file, "%d", -2048 + point->get_intensity()); |
| 444 | else if (optx) |
| 445 | { |
| 446 | int len = snprintf(printstring, sizeof(printstring), "%.3f", 1.0f/4095.0f * point->get_intensity()) - 1; |
| 447 | while (printstring[len] == '0') len--; |
| 448 | if (printstring[len] != '.') len++; |
| 449 | printstring[len] = '\0'; |
| 450 | fprintf(file, "%s", printstring); |
| 451 | } |
| 452 | else |
| 453 | fprintf(file, "%d", point->get_intensity()); |
| 454 | break; |
| 455 | case 'a': // the scan angle |
| 456 | fprintf(file, "%s", point->get_scan_angle_string().c_str()); |
| 457 | break; |
| 458 | case 'r': // the number of the return |
| 459 | fprintf(file, "%d", point->get_return_number()); |
| 460 | break; |
| 461 | case 'c': // the classification |
| 462 | fprintf(file, "%d", point->get_classification()); |
| 463 | break; |
| 464 | case 'u': // the user data |
| 465 | fprintf(file, "%d", point->get_user_data()); |
| 466 | break; |
| 467 | case 'n': // the number of returns of given pulse |
| 468 | fprintf(file, "%d", point->get_number_of_returns()); |
| 469 | break; |
| 470 | case 'p': // the point source ID |
| 471 | fprintf(file, "%d", point->get_point_source_ID()); |
| 472 | break; |
| 473 | case 'e': // the edge of flight line flag |
| 474 | fprintf(file, "%d", point->get_edge_of_flight_line()); |
| 475 | break; |
| 476 | case 'd': // the direction of scan flag |
| 477 | fprintf(file, "%d", point->get_scan_direction_flag()); |
| 478 | break; |
nothing calls this directly
no test coverage detected