[Liblas-commits] hg-main-tree: temp hack for multi-iter support

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Mar 24 11:48:22 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/4b4b8a92c65b
changeset: 421:4b4b8a92c65b
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Mar 24 08:48:17 2011 -0700
description:
temp hack for multi-iter support

diffstat:

 src/drivers/liblas/Iterator.cpp |   2 +
 test/unit/LiblasReaderTest.cpp  |  48 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diffs (75 lines):

diff -r ec0feaff84ce -r 4b4b8a92c65b src/drivers/liblas/Iterator.cpp
--- a/src/drivers/liblas/Iterator.cpp	Thu Mar 24 08:06:11 2011 -0700
+++ b/src/drivers/liblas/Iterator.cpp	Thu Mar 24 08:48:17 2011 -0700
@@ -51,6 +51,7 @@
     , m_istream(NULL)
 {
     m_istream = Utils::openFile(m_reader.getFileName());
+    m_reader.m_externalReader->Reset();
     return;
 }
 
@@ -194,6 +195,7 @@
     , m_istream(NULL)
 {
     m_istream = Utils::openFile(m_reader.getFileName());
+    m_reader.m_externalReader->Reset();
     return;
 }
 
diff -r ec0feaff84ce -r 4b4b8a92c65b test/unit/LiblasReaderTest.cpp
--- a/test/unit/LiblasReaderTest.cpp	Thu Mar 24 08:06:11 2011 -0700
+++ b/test/unit/LiblasReaderTest.cpp	Thu Mar 24 08:48:17 2011 -0700
@@ -166,4 +166,52 @@
 }
 
 
+BOOST_AUTO_TEST_CASE(test_reset)
+{
+    LiblasReader reader(TestConfig::g_data_path + "1.2-with-color.las");
+    BOOST_CHECK(reader.getName() == "Liblas Reader");
+
+    const Schema& schema = reader.getHeader().getSchema();
+    SchemaLayout layout(schema);
+
+    BOOST_CHECK(reader.getNumPoints() == 1065);
+    PointBuffer data(layout, 1065);
+    
+
+    {
+        libpc::SequentialIterator* iter = reader.createSequentialIterator();
+        BOOST_CHECK(iter->getIndex() == 0);
+
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 1065);
+        BOOST_CHECK(iter->getIndex() == 1065);
+
+        checkPointXYZ(data, 0, schema, 637012.240000, 849028.310000, 431.660000);
+        checkPointXYZ(data, 1, schema, 636896.330000, 849087.700000, 446.390000);
+        checkPointXYZ(data, 2, schema, 636784.740000, 849106.660000, 426.710000);
+
+        delete iter;
+    }
+
+    {
+        libpc::RandomIterator* iter = reader.createRandomIterator();
+        BOOST_CHECK(iter->getIndex() == 0);
+
+        boost::uint32_t numRead = iter->read(data);
+        BOOST_CHECK(numRead == 1065);
+        BOOST_CHECK(iter->getIndex() == 1065);
+
+        checkPointXYZ(data, 0, schema, 637012.240000, 849028.310000, 431.660000);
+        checkPointXYZ(data, 1, schema, 636896.330000, 849087.700000, 446.390000);
+        checkPointXYZ(data, 2, schema, 636784.740000, 849106.660000, 426.710000);
+
+        delete iter;
+    }
+
+   
+
+    return;
+}
+
+
 BOOST_AUTO_TEST_SUITE_END()


More information about the Liblas-commits mailing list