Skip to content

Commit

Permalink
put hex generation in destructor of iterator -- it has to happen afte…
Browse files Browse the repository at this point in the history
…r we've read all the points, and then it will update the metadata of the PointBuffer that was used to instantiate the interator
  • Loading branch information
hobu committed Aug 22, 2013
1 parent 2d2cebc commit b0b0461
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
7 changes: 4 additions & 3 deletions include/pdal/filters/HexBin.hpp
Expand Up @@ -124,12 +124,13 @@ class PDAL_DLL HexBin : public pdal::FilterSequentialIterator, public hexbin::It
{
public:
HexBin(const pdal::filters::HexBin& filter, PointBuffer& buffer);
~HexBin(){};
~HexBin();

protected:
// virtual void readBufferBeginImpl(PointBuffer&);
virtual void readBufferEndImpl(PointBuffer&);

// virtual void readBufferEndImpl(PointBuffer&);
// virtual void readEndImpl();

private:
boost::uint64_t skipImpl(boost::uint64_t);
boost::uint32_t readBufferImpl(PointBuffer&);
Expand Down
38 changes: 19 additions & 19 deletions src/filters/HexBin.cpp
Expand Up @@ -122,8 +122,9 @@ IteratorBase::IteratorBase( pdal::filters::HexBin const& filter,
IteratorBase::~IteratorBase()
{
#ifdef PDAL_HAVE_HEXER
//if (m_grid)
//delete m_grid;



#endif

}
Expand Down Expand Up @@ -207,17 +208,31 @@ boost::uint32_t HexBin::readBufferImpl(PointBuffer& buffer)

return numPoints;
}


void HexBin::readBufferEndImpl(PointBuffer& buffer)
boost::uint64_t HexBin::skipImpl(boost::uint64_t count)
{
getPrevIterator().skip(count);
return count;
}


bool HexBin::atEndImpl() const
{
return getPrevIterator().atEnd();
}

HexBin::~HexBin()
{


#ifdef PDAL_HAVE_HEXER
if (m_grid)
{
m_grid->findShapes();
m_grid->findParentPaths();

pdal::Metadata& metadata = buffer.getMetadataRef();
pdal::Metadata& metadata = getBuffer().getMetadataRef();


pdal::Metadata m;
Expand Down Expand Up @@ -246,22 +261,7 @@ void HexBin::readBufferEndImpl(PointBuffer& buffer)
throw pdal_error("Hexgrid was not created!");
}
#endif

}


boost::uint64_t HexBin::skipImpl(boost::uint64_t count)
{
getPrevIterator().skip(count);
return count;
}


bool HexBin::atEndImpl() const
{
return getPrevIterator().atEnd();
}

} // sequential

// namespace random
Expand Down

0 comments on commit b0b0461

Please sign in to comment.