| 744 | |
| 745 | |
| 746 | void LasReader::loadPointV10(PointRef& point, const char *buf, size_t bufsize) |
| 747 | { |
| 748 | LeExtractor istream(buf, bufsize); |
| 749 | |
| 750 | int32_t xi, yi, zi; |
| 751 | istream >> xi >> yi >> zi; |
| 752 | const las::Header& h = d->header; |
| 753 | |
| 754 | double x = xi * h.scale.x + h.offset.x; |
| 755 | double y = yi * h.scale.y + h.offset.y; |
| 756 | double z = zi * h.scale.z + h.offset.z; |
| 757 | |
| 758 | uint16_t intensity; |
| 759 | uint8_t flags; |
| 760 | uint8_t classificationWithFlags; |
| 761 | int8_t scanAngleRank; |
| 762 | uint8_t user; |
| 763 | uint16_t pointSourceId; |
| 764 | |
| 765 | istream >> intensity >> flags >> classificationWithFlags >> scanAngleRank >> |
| 766 | user >> pointSourceId; |
| 767 | |
| 768 | uint8_t returnNum = flags & 0x07; |
| 769 | uint8_t numReturns = (flags >> 3) & 0x07; |
| 770 | uint8_t scanDirFlag = (flags >> 6) & 0x01; |
| 771 | uint8_t flight = (flags >> 7) & 0x01; |
| 772 | |
| 773 | uint8_t classification = classificationWithFlags & 0x1F; |
| 774 | uint8_t synthetic = (classificationWithFlags >> 5) & 0x01; |
| 775 | uint8_t keypoint = (classificationWithFlags >> 6) & 0x01; |
| 776 | uint8_t withheld = (classificationWithFlags >> 7) & 0x01; |
| 777 | uint8_t overlap = 0; |
| 778 | |
| 779 | // For V10 PDRFs, "Overlap" was encoded as Classification=12. This was |
| 780 | // split out into its own bitfield for the V14 PDRFs, so mimic that behavior |
| 781 | // here, setting the dedicated Overlap flag and resetting the Classification |
| 782 | // to "Never Classified". |
| 783 | if (classification == ClassLabel::LegacyOverlap) |
| 784 | { |
| 785 | classification = ClassLabel::CreatedNeverClassified; |
| 786 | overlap = 1; |
| 787 | } |
| 788 | |
| 789 | point.setField(Dimension::Id::X, x); |
| 790 | point.setField(Dimension::Id::Y, y); |
| 791 | point.setField(Dimension::Id::Z, z); |
| 792 | point.setField(Dimension::Id::Intensity, intensity); |
| 793 | point.setField(Dimension::Id::ReturnNumber, returnNum); |
| 794 | point.setField(Dimension::Id::NumberOfReturns, numReturns); |
| 795 | point.setField(Dimension::Id::ScanDirectionFlag, scanDirFlag); |
| 796 | point.setField(Dimension::Id::EdgeOfFlightLine, flight); |
| 797 | point.setField(Dimension::Id::Classification, classification); |
| 798 | point.setField(Dimension::Id::Synthetic, synthetic); |
| 799 | point.setField(Dimension::Id::KeyPoint, keypoint); |
| 800 | point.setField(Dimension::Id::Withheld, withheld); |
| 801 | point.setField(Dimension::Id::Overlap, overlap); |
| 802 | point.setField(Dimension::Id::ScanAngleRank, scanAngleRank); |
| 803 | point.setField(Dimension::Id::UserData, user); |