set the number of the first segment that is likely to be the LAS file, and return true iff we found it
| 203 | // set the number of the first segment that is likely to be the LAS |
| 204 | // file, and return true iff we found it |
| 205 | bool NitfFileReader::locateLidarDataSegment() |
| 206 | { |
| 207 | // as per 3.2.5, page 59 |
| 208 | |
| 209 | ::nitf::ListIterator iter = m_record.getDataExtensions().begin(); |
| 210 | const ::nitf::Uint32 numSegs = m_record.getNumDataExtensions(); |
| 211 | for (::nitf::Uint32 segNum=0; segNum<numSegs; segNum++) |
| 212 | { |
| 213 | ::nitf::DESegment seg = *iter; |
| 214 | |
| 215 | ::nitf::DESubheader subheader = seg.getSubheader(); |
| 216 | |
| 217 | ::nitf::Field idField = subheader.getTypeID(); |
| 218 | if (idField.getType() != (::nitf::Field::FieldType)NITF_BCS_A) |
| 219 | throw error("error reading nitf (6)"); |
| 220 | |
| 221 | ::nitf::Field verField = subheader.getVersion(); |
| 222 | if (verField.getType() != (::nitf::Field::FieldType)NITF_BCS_N) |
| 223 | throw error("error reading nitf (7)"); |
| 224 | |
| 225 | const std::string id = idField.toString(); |
| 226 | const int ver = (int)verField; |
| 227 | |
| 228 | if (id == "LIDARA DES " && ver == 1) |
| 229 | { |
| 230 | m_lidarDataSegment = segNum; |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | iter++; |
| 235 | } |
| 236 | |
| 237 | return false; |
| 238 | } |
| 239 | |
| 240 | } // namespace pdal |
| 241 |