[Liblas-commits] libpc: first las output achieved
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Feb 17 12:22:18 EST 2011
details: http://hg.liblas.orglibpc/rev/ce87b62c31a1
changeset: 66:ce87b62c31a1
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Feb 17 09:22:01 2011 -0800
description:
first las output achieved
diffstat:
apps/pc2pc.cpp | 6 ------
include/libpc/FauxWriter.hpp | 2 +-
include/libpc/LasWriter.hpp | 2 +-
include/libpc/Writer.hpp | 2 +-
src/FauxWriter.cpp | 2 +-
src/LasWriter.cpp | 15 ++++++++-------
src/Writer.cpp | 8 ++++----
7 files changed, 16 insertions(+), 21 deletions(-)
diffs (130 lines):
diff -r 3f400151fa35 -r ce87b62c31a1 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Wed Feb 16 14:22:44 2011 -0800
+++ b/apps/pc2pc.cpp Thu Feb 17 09:22:01 2011 -0800
@@ -78,12 +78,6 @@
std::cout << (const LasHeader&)header;
- //boost::uint32_t numPoints = (boost::uint32_t)header.getNumPoints();
- //PointData pointData(header.getSchema(), numPoints);
- //reader.readPoints(pointData);
-
-// std::cout << pointData;
-
std::ostream* ofs = Utils::Create("temp.las");
LasWriter lasWriter(reader, *ofs);
diff -r 3f400151fa35 -r ce87b62c31a1 include/libpc/FauxWriter.hpp
--- a/include/libpc/FauxWriter.hpp Wed Feb 16 14:22:44 2011 -0800
+++ b/include/libpc/FauxWriter.hpp Thu Feb 17 09:22:01 2011 -0800
@@ -50,7 +50,7 @@
private:
int m_numPointsWritten;
- void writeBegin();
+ void writeBegin(std::size_t totalNumPoints);
void writeBuffer(const PointData&);
void writeEnd();
diff -r 3f400151fa35 -r ce87b62c31a1 include/libpc/LasWriter.hpp
--- a/include/libpc/LasWriter.hpp Wed Feb 16 14:22:44 2011 -0800
+++ b/include/libpc/LasWriter.hpp Thu Feb 17 09:22:01 2011 -0800
@@ -49,7 +49,7 @@
protected:
// this is called once before the loop with the writeBuffer calls
- virtual void writeBegin();
+ virtual void writeBegin(std::size_t totalNumPoints);
// called repeatedly, until out of data
virtual void writeBuffer(const PointData&);
diff -r 3f400151fa35 -r ce87b62c31a1 include/libpc/Writer.hpp
--- a/include/libpc/Writer.hpp Wed Feb 16 14:22:44 2011 -0800
+++ b/include/libpc/Writer.hpp Thu Feb 17 09:22:01 2011 -0800
@@ -51,7 +51,7 @@
protected:
// this is called once before the loop with the writeBuffer calls
- virtual void writeBegin() = 0;
+ virtual void writeBegin(std::size_t totalNumPoints) = 0;
// called repeatedly, until out of data
virtual void writeBuffer(const PointData&) = 0;
diff -r 3f400151fa35 -r ce87b62c31a1 src/FauxWriter.cpp
--- a/src/FauxWriter.cpp Wed Feb 16 14:22:44 2011 -0800
+++ b/src/FauxWriter.cpp Thu Feb 17 09:22:01 2011 -0800
@@ -50,7 +50,7 @@
}
-void FauxWriter::writeBegin()
+void FauxWriter::writeBegin(std::size_t totalNumPoints)
{
cout << "FauxWriter::writeBegin()" << endl;
cout << endl;
diff -r 3f400151fa35 -r ce87b62c31a1 src/LasWriter.cpp
--- a/src/LasWriter.cpp Wed Feb 16 14:22:44 2011 -0800
+++ b/src/LasWriter.cpp Thu Feb 17 09:22:01 2011 -0800
@@ -48,21 +48,22 @@
LasHeader* lasHeader = new LasHeader;
setHeader(lasHeader);
- // need to set properties of the header here, based on this->getHeader() and on the user's preferences
- const Header& baseHeader = getHeader();
- lasHeader->setBounds( baseHeader.getBounds() );
- lasHeader->SetOffset(0,0,0);
- lasHeader->SetScale(1,1,1);
-
return;
}
-void LasWriter::writeBegin()
+void LasWriter::writeBegin(std::size_t totalNumPoints)
{
Header& baseHeader = getHeader();
LasHeader& lasHeader = (LasHeader&)baseHeader;
+ // need to set properties of the header here, based on this->getHeader() and on the user's preferences
+ lasHeader.setBounds( baseHeader.getBounds() );
+ lasHeader.SetOffset(0,0,0);
+ lasHeader.SetScale(1,1,1);
+
+ lasHeader.SetPointRecordsCount(totalNumPoints);
+
LasHeaderWriter lasHeaderWriter(lasHeader, m_ostream);
lasHeaderWriter.write();
diff -r 3f400151fa35 -r ce87b62c31a1 src/Writer.cpp
--- a/src/Writer.cpp Wed Feb 16 14:22:44 2011 -0800
+++ b/src/Writer.cpp Thu Feb 17 09:22:01 2011 -0800
@@ -49,9 +49,9 @@
void Writer::write()
{
- writeBegin();
+ boost::uint64_t numPoints = m_prevStage.getHeader().getNumPoints();
- boost::uint64_t numPoints = m_prevStage.getHeader().getNumPoints();
+ writeBegin(numPoints);
const boost::uint32_t chunkSize = 100;
@@ -60,7 +60,7 @@
if (numChunks > 0)
{
- PointData buffer(getHeader().getSchema(), chunkSize);
+ PointData buffer(m_prevStage.getHeader().getSchema(), chunkSize);
for (boost::uint64_t i=0; i<numChunks; i++)
{
m_prevStage.readPoints(buffer);
@@ -71,7 +71,7 @@
if (remainder > 0)
{
if (remainder != (boost::uint32_t)remainder) throw;
- PointData buffer(getHeader().getSchema(), (boost::uint32_t)remainder);
+ PointData buffer(m_prevStage.getHeader().getSchema(), (boost::uint32_t)remainder);
m_prevStage.readPoints(buffer);
this->writeBuffer(buffer);
More information about the Liblas-commits
mailing list