[Liblas-commits] hg-main-tree: keep track of the number of points
we've written a...
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Apr 11 15:33:33 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/1fe4ff9e705d
changeset: 525:1fe4ff9e705d
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Apr 11 14:33:28 2011 -0500
description:
keep track of the number of points we've written and rewrite the header on writeEnd to put the count in
diffstat:
include/libpc/drivers/las/Writer.hpp | 1 +
src/drivers/las/Writer.cpp | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diffs (44 lines):
diff -r 7a39e8149210 -r 1fe4ff9e705d include/libpc/drivers/las/Writer.hpp
--- a/include/libpc/drivers/las/Writer.hpp Mon Apr 11 11:54:16 2011 -0500
+++ b/include/libpc/drivers/las/Writer.hpp Mon Apr 11 14:33:28 2011 -0500
@@ -63,6 +63,7 @@
private:
std::ostream& m_ostream;
LasHeader m_lasHeader;
+ boost::uint32_t m_numPointsWritten;
LasWriter& operator=(const LasWriter&); // not implemented
LasWriter(const LasWriter&); // not implemented
diff -r 7a39e8149210 -r 1fe4ff9e705d src/drivers/las/Writer.cpp
--- a/src/drivers/las/Writer.cpp Mon Apr 11 11:54:16 2011 -0500
+++ b/src/drivers/las/Writer.cpp Mon Apr 11 14:33:28 2011 -0500
@@ -47,6 +47,7 @@
LasWriter::LasWriter(Stage& prevStage, std::ostream& ostream)
: Writer(prevStage)
, m_ostream(ostream)
+ , m_numPointsWritten(0)
{
return;
}
@@ -78,6 +79,11 @@
void LasWriter::writeEnd()
{
+ m_lasHeader.SetPointRecordsCount(m_numPointsWritten);
+
+ LasHeaderWriter lasHeaderWriter(m_lasHeader, m_ostream);
+ lasHeaderWriter.write();
+
return;
}
@@ -239,7 +245,8 @@
//std::vector<boost::uint8_t> const& data = point.GetData();
//detail::write_n(m_ofs, data.front(), m_header->GetDataRecordLength());
-
+
+ m_numPointsWritten = m_numPointsWritten+numValidPoints;
return numValidPoints;
}
More information about the Liblas-commits
mailing list