[Liblas-commits] hg-main-tree: support setting header padding

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Aug 12 13:20:05 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/ff52f4c5578e
changeset: 1062:ff52f4c5578e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:12:29 2011 -0500
description:
support setting header padding
Subject: hg-main-tree: support setting header padding

details:   http://hg.libpc.orghg-main-tree/rev/598bb618697e
changeset: 1063:598bb618697e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:12:57 2011 -0500
description:
support setting header padding
Subject: hg-main-tree: convenience functions for determining byte current length and total byte length of the raw data buffer

details:   http://hg.libpc.orghg-main-tree/rev/96e6a8dd163c
changeset: 1064:96e6a8dd163c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:13:55 2011 -0500
description:
convenience functions for determining byte current length and total byte length of the raw data buffer
Subject: hg-main-tree: keep existing padding on the header and don't alter it when writing the header to file

details:   http://hg.libpc.orghg-main-tree/rev/3e457bd2cea2
changeset: 1065:3e457bd2cea2
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:14:29 2011 -0500
description:
keep existing padding on the header and don't alter it when writing the header to file
Subject: hg-main-tree: use setHeaderPadding methods

details:   http://hg.libpc.orghg-main-tree/rev/5ee73f641295
changeset: 1066:5ee73f641295
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:15:09 2011 -0500
description:
use setHeaderPadding methods
Subject: hg-main-tree: add compare_stage_data method for comparing data. Maybe we should add PointBuffer::operator==?

details:   http://hg.libpc.orghg-main-tree/rev/75b3ad25e67f
changeset: 1067:75b3ad25e67f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:16:00 2011 -0500
description:
add compare_stage_data method for comparing data. Maybe we should add PointBuffer::operator==?
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/959cd863903f
changeset: 1068:959cd863903f
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Aug 12 12:19:56 2011 -0500
description:
merge

diffstat:

 apps/Application.cpp                   |    8 +-
 apps/Application.hpp                   |    2 +-
 include/pdal/PointBuffer.hpp           |   10 +
 include/pdal/drivers/las/Writer.hpp    |    2 +
 include/pdal/drivers/liblas/Writer.hpp |    4 +-
 src/PipelineReader.cpp                 |    6 +-
 src/drivers/las/LasHeaderWriter.cpp    |   11 +-
 src/drivers/las/Writer.cpp             |    4 +
 src/drivers/liblas/Writer.cpp          |    4 +
 test/data/misc/data1.dat               |    1 +
 test/data/misc/data1.txt               |    3 +
 test/data/misc/data2.dat               |    1 +
 test/data/misc/data2.txt               |    3 +
 test/data/misc/data3.dat               |    1 +
 test/data/misc/data3.txt               |    5 +
 test/data/misc/data4a.dat              |    1 +
 test/data/misc/data4b.dat              |    1 +
 test/data/pipeline_readcomments.xml    |   18 ++
 test/data/pipeline_writecomments.xml   |   26 +++
 test/temp/README.txt                   |    1 +
 test/unit/CMakeLists.txt               |    4 +
 test/unit/LasWriterTest.cpp            |   19 +-
 test/unit/LiblasWriterTest.cpp         |   27 +-
 test/unit/PipelineReaderTest.cpp       |    9 +
 test/unit/SpatialReferenceTest.cpp     |    4 +-
 test/unit/Support.cpp                  |  243 +++++++++++++++++++++++++++++---
 test/unit/Support.hpp                  |   31 ++++-
 test/unit/SupportTest.cpp              |  228 ++++++++++++++++++++++++++++++
 test/unit/pc2pcTest.cpp                |   49 ++++++
 test/unit/pcinfoTest.cpp               |   49 ++++++
 test/unit/pcpipelineTest.cpp           |   49 ++++++
 31 files changed, 765 insertions(+), 59 deletions(-)

diffs (truncated from 1297 to 300 lines):

diff -r b0027041eb7a -r 959cd863903f apps/Application.cpp
--- a/apps/Application.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/apps/Application.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -145,7 +145,11 @@
 
 boost::uint8_t Application::getVerboseLevel() const
 {
-    return m_verboseLevel;
+    // verboseLevel is really a u8 value, but we have to store it in a u32
+    // object because if we don't then program_options prints the default
+    // value as an unsigned char (thanks, lexical_cast!)
+    const boost::uint8_t v = static_cast<boost::uint8_t>(m_verboseLevel & 0x000000ff);
+    return v;
 }
 
 
@@ -200,7 +204,7 @@
     basic_options->add_options()
         ("help,h", "produce help message")
         ("debug,d", po::value<bool>(&m_isDebug)->zero_tokens(), "Enable debug mode")
-        ("verbose,v", po::value<boost::uint8_t>(&m_verboseLevel)->default_value(0), "Set verbose message level (default is 0)")
+        ("verbose,v", po::value<boost::uint32_t>(&m_verboseLevel)->default_value(0), "Set verbose message level")
         ("version", "Show version info")
         ("timer", "Show execution time")
         ;
diff -r b0027041eb7a -r 959cd863903f apps/Application.hpp
--- a/apps/Application.hpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/apps/Application.hpp	Fri Aug 12 12:19:56 2011 -0500
@@ -89,7 +89,7 @@
     void addBasicOptionSet();
 
     bool m_isDebug;
-    boost::uint8_t m_verboseLevel;
+    boost::uint32_t m_verboseLevel;
     const int m_argc;
     char** m_argv;
     const std::string m_appName;
diff -r b0027041eb7a -r 959cd863903f include/pdal/PointBuffer.hpp
--- a/include/pdal/PointBuffer.hpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/include/pdal/PointBuffer.hpp	Fri Aug 12 12:19:56 2011 -0500
@@ -148,6 +148,16 @@
 
         return;
     }
+    
+    inline boost::uint64_t getBufferByteLength() const
+    {
+        return m_pointSize*m_numPoints;
+    }
+    inline boost::uint64_t getBufferByteCapacity() const
+    {
+        return m_pointSize*m_capacity;
+    }
+
 
     // access to the raw memory
     inline boost::uint8_t* getData(std::size_t pointIndex) const
diff -r b0027041eb7a -r 959cd863903f include/pdal/drivers/las/Writer.hpp
--- a/include/pdal/drivers/las/Writer.hpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/include/pdal/drivers/las/Writer.hpp	Fri Aug 12 12:19:56 2011 -0500
@@ -73,6 +73,8 @@
     
     // up to 32 chars (default is "PDAL x.y.z")
     void setGeneratingSoftware(const std::string& softwareId);
+    
+    void setHeaderPadding(boost::uint32_t const& v);
 
     // default false
     void setCompressed(bool);
diff -r b0027041eb7a -r 959cd863903f include/pdal/drivers/liblas/Writer.hpp
--- a/include/pdal/drivers/liblas/Writer.hpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/include/pdal/drivers/liblas/Writer.hpp	Fri Aug 12 12:19:56 2011 -0500
@@ -76,7 +76,9 @@
 
     // default false
     void setCompressed(bool);
-
+    
+    void setHeaderPadding(boost::uint32_t const& v);
+    
 protected:
     virtual void writeBegin(boost::uint64_t targetNumPointsToWrite);
     virtual boost::uint32_t writeBuffer(const PointBuffer&);
diff -r b0027041eb7a -r 959cd863903f src/PipelineReader.cpp
--- a/src/PipelineReader.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/src/PipelineReader.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -449,7 +449,8 @@
     m_inputXmlFile = filename;
 
     boost::property_tree::ptree tree;
-    boost::property_tree::xml_parser::read_xml(filename, tree);
+    boost::property_tree::xml_parser::read_xml(filename, tree,
+        boost::property_tree::xml_parser::no_comments);
 
     boost::optional<boost::property_tree::ptree> opt( tree.get_child_optional("WriterPipeline") );
     if (!opt.is_initialized())
@@ -472,7 +473,8 @@
     m_inputXmlFile = filename;
 
     boost::property_tree::ptree tree;
-    boost::property_tree::xml_parser::read_xml(filename, tree);
+    boost::property_tree::xml_parser::read_xml(filename, tree,
+        boost::property_tree::xml_parser::no_comments);
 
     boost::optional<boost::property_tree::ptree> opt( tree.get_child_optional("ReaderPipeline") );
     if (!opt.is_initialized())
diff -r b0027041eb7a -r 959cd863903f src/drivers/las/LasHeaderWriter.cpp
--- a/src/drivers/las/LasHeaderWriter.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/src/drivers/las/LasHeaderWriter.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -109,6 +109,7 @@
     }
 
     {
+        boost::uint32_t padding_before_calculations = m_header.GetHeaderPadding();
         int32_t existing_padding = m_header.GetDataOffset() - 
                                   (m_header.getVLRBlockSize() + 
                                    m_header.GetHeaderSize());
@@ -137,12 +138,14 @@
             }
 
         }
-        
-        m_header.SetDataOffset( m_header.GetHeaderSize() + 
-                                m_header.getVLRBlockSize() + 
-                                m_header.GetHeaderPadding());
+
+    m_header.SetDataOffset( m_header.GetHeaderSize() + 
+                            m_header.getVLRBlockSize() + 
+                            m_header.GetHeaderPadding() + padding_before_calculations);
 
     }
+    
+
 
         // 1. File Signature
     std::string const filesig(m_header.GetFileSignature());
diff -r b0027041eb7a -r 959cd863903f src/drivers/las/Writer.cpp
--- a/src/drivers/las/Writer.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/src/drivers/las/Writer.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -168,6 +168,10 @@
     m_spatialReference = srs;
 }
 
+void LasWriter::setHeaderPadding(boost::uint32_t const& v)
+{
+    m_lasHeader.SetHeaderPadding(v);
+}
 
 void LasWriter::writeBegin(boost::uint64_t targetNumPointsToWrite)
 {
diff -r b0027041eb7a -r 959cd863903f src/drivers/liblas/Writer.cpp
--- a/src/drivers/liblas/Writer.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/src/drivers/liblas/Writer.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -129,6 +129,10 @@
     m_externalHeader->SetCompressed(v);
 }
 
+void LiblasWriter::setHeaderPadding(boost::uint32_t const& v)
+{
+    m_externalHeader->SetHeaderPadding(v);
+}
 
 void LiblasWriter::setFormatVersion(boost::uint8_t majorVersion, boost::uint8_t minorVersion)
 {
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data1.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data1.dat	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+abcde
\ No newline at end of file
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data1.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data1.txt	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,3 @@
+The quick brown fox
+jumped over
+the lazy dog.
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data2.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data2.dat	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+abcdf
\ No newline at end of file
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data2.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data2.txt	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,3 @@
+The quick brown fox
+jumped o'er
+the lazy dog.
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data3.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data3.dat	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+abc
\ No newline at end of file
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data3.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data3.txt	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,5 @@
+The quick brown fox
+jumped over
+the lazy dog.
+Oh, that
+lazy dog.
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data4a.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data4a.dat	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+abcdefghijklmnopqrstuvwxyz
\ No newline at end of file
diff -r b0027041eb7a -r 959cd863903f test/data/misc/data4b.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/misc/data4b.dat	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+abcDEFGhijklmnopqrstuvw**z
\ No newline at end of file
diff -r b0027041eb7a -r 959cd863903f test/data/pipeline_readcomments.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/pipeline_readcomments.xml	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<ReaderPipeline>
+        <Filter>
+            <Type>filters.crop</Type>
+            <Option>
+                <Name>bounds</Name>
+                <Value>([0,1000000],[0,1000000],[0,1000000])</Value>
+            </Option>
+            <Reader>
+                <Type>drivers.las.reader</Type>
+                <Option>
+                    <Name>filename</Name>
+                    <Value>1.2-with-color.las</Value>
+                </Option>
+                <!-- This is a comment -->
+            </Reader>
+        </Filter>
+</ReaderPipeline>
diff -r b0027041eb7a -r 959cd863903f test/data/pipeline_writecomments.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/pipeline_writecomments.xml	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WriterPipeline>
+    <Writer>
+        <Type>drivers.las.writer</Type>
+        <Option>
+            <Name>filename</Name>
+            <Value>out.las</Value>
+            <Description>junk junk junk</Description>
+        </Option>
+        <Filter>
+            <Type>filters.crop</Type>
+            <Option>
+                <Name>bounds</Name>
+                <Value>([0,1000000],[0,1000000],[0,1000000])</Value>
+            </Option>
+            <Reader>
+                <Type>drivers.las.reader</Type>
+                <Option>
+                    <Name>filename</Name>
+                    <Value>1.2-with-color.las</Value>
+                </Option>
+            </Reader>
+        </Filter>
+    </Writer>
+    <!-- This is a comment -->
+</WriterPipeline>
diff -r b0027041eb7a -r 959cd863903f test/temp/README.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/temp/README.txt	Fri Aug 12 12:19:56 2011 -0500
@@ -0,0 +1,1 @@
+The unit tests write files into this directory.  This directory must exist.
diff -r b0027041eb7a -r 959cd863903f test/unit/CMakeLists.txt
--- a/test/unit/CMakeLists.txt	Thu Aug 11 15:48:12 2011 -0500
+++ b/test/unit/CMakeLists.txt	Fri Aug 12 12:19:56 2011 -0500
@@ -12,6 +12,9 @@
 endif()
 
 SET(PDAL_UNITTEST_TEST_SRC
+    pc2pcTest.cpp
+    pcinfoTest.cpp
+    pcpipelineTest.cpp
     BoundsTest.cpp
     ByteSwapFilterTest.cpp
     CacheFilterTest.cpp
@@ -47,6 +50,7 @@
     SpatialReferenceTest.cpp
     StageFactoryTest.cpp
     StreamManagerTest.cpp
+    SupportTest.cpp
     TerraSolidTest.cpp
     UtilsTest.cpp
     VectorTest.cpp
diff -r b0027041eb7a -r 959cd863903f test/unit/LasWriterTest.cpp
--- a/test/unit/LasWriterTest.cpp	Thu Aug 11 15:48:12 2011 -0500
+++ b/test/unit/LasWriterTest.cpp	Fri Aug 12 12:19:56 2011 -0500
@@ -57,7 +57,7 @@
 


More information about the Liblas-commits mailing list