Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Attempt to fix return_number
Browse files Browse the repository at this point in the history
  • Loading branch information
gillins committed Jun 30, 2020
1 parent a6a1e1e commit be304e8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/las.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ static PyObject *PyLasFileRead_readData(PyLasFileRead *self, PyObject *args)
typenum = NPY_FLOAT64;
break;
default:
fprintf(stderr, "Unkown type for field %s. Assuming f64\n", pPoint->attributer->attributes[i].name);
fprintf(stderr, "Unknown type for field %s. Assuming f64\n", pPoint->attributer->attributes[i].name);
typenum = NPY_FLOAT64;
}
self->pExtraPointNativeTypes->insert(std::pair<std::string, int>(pPoint->attributer->attributes[i].name, typenum));
Expand Down Expand Up @@ -721,12 +721,14 @@ static PyObject *PyLasFileRead_readData(PyLasFileRead *self, PyObject *args)
{
// use the 'extended' fields since they are bigger
// I *think* there is no need for the un-extended fields in this case
pLasPoint->return_number = pPoint->get_extended_return_number() - 1; // 1-based for some reason
// NOTE: get_extended_return_number/get_return_number can't be relied on
// we deal with this below by re-writing.
//pLasPoint->return_number = pPoint->get_extended_return_number() - 1; // 1-based for some reason
pLasPoint->classification = pPoint->get_extended_classification();
}
else
{
pLasPoint->return_number = pPoint->get_return_number() - 1; // 1-based for some reason
//pLasPoint->return_number = pPoint->get_return_number() - 1; // 1-based for some reason
pLasPoint->classification = pPoint->get_classification();
}
pLasPoint->synthetic_flag = pPoint->get_synthetic_flag();
Expand Down Expand Up @@ -918,6 +920,13 @@ static PyObject *PyLasFileRead_readData(PyLasFileRead *self, PyObject *args)
pPulse->x_idx = p2->x;
pPulse->y_idx = p2->y;
}

// now re-write the return_number as we can't trust the return from
// get_return_number() (above)
for( npy_intp i = 0; i < pPulse->number_of_returns; i++ )
{
pPoints->getElem(pPulse->pts_start_idx + i)->return_number = i;
}
}

// find those with
Expand Down

0 comments on commit be304e8

Please sign in to comment.