Skip to content

Commit

Permalink
Set index to zero within run() s.t. we can handle multiple PointViews
Browse files Browse the repository at this point in the history
correctly

Fix #3448
  • Loading branch information
chambbj committed May 7, 2021
1 parent 26551d1 commit a3f6445
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 4 additions & 8 deletions filters/HeadFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ void HeadFilter::addArgs(ProgramArgs& args)
"to skip from the beginning.", m_invert, false);
}

void HeadFilter::ready(PointTableRef table)
{
m_index = 0;
}

bool HeadFilter::processOne(PointRef& point)
{

Expand All @@ -81,17 +76,18 @@ bool HeadFilter::processOne(PointRef& point)

PointViewSet HeadFilter::run(PointViewPtr inView)
{
m_index = 0;

PointViewSet viewSet;
if (!inView->size())
return viewSet;

PointViewPtr outView = inView->makeNew();

for (PointId i = 0; i < inView->size(); ++i)
for (PointRef point : *inView)
{
PointRef point = inView->point(i);
if (processOne(point))
outView->appendPoint(*inView, i);
outView->appendPoint(*inView, point.pointId());
}

viewSet.insert(outView);
Expand Down
1 change: 0 additions & 1 deletion filters/HeadFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class PDAL_DLL HeadFilter : public Filter, public Streamable
virtual void addArgs(ProgramArgs& args);
virtual bool processOne(PointRef& point);
virtual PointViewSet run(PointViewPtr view);
virtual void ready(PointTableRef table);

};

Expand Down

0 comments on commit a3f6445

Please sign in to comment.