[Liblas-commits] hg-main-tree: clean up err mssg

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 2 16:49:28 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/c4deed5860fb
changeset: 994:c4deed5860fb
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Aug 02 13:48:51 2011 -0700
description:
clean up err mssg
Subject: hg-main-tree: add read-scale-reproj-descale-write test for hobu

details:   http://hg.libpc.orghg-main-tree/rev/42aad86c4ce1
changeset: 995:42aad86c4ce1
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Aug 02 13:49:18 2011 -0700
description:
add read-scale-reproj-descale-write test for hobu

diffstat:

 src/filters/ScalingFilter.cpp        |   8 +++---
 test/data/pipeline_write2.xml        |  35 ++++++++++++++++++++++++++
 test/unit/PipelineReaderTest.cpp     |  47 +++++++++++++++++++++++++++++++++++-
 test/unit/ReprojectionFilterTest.cpp |  17 ++----------
 test/unit/Support.cpp                |  10 +++++++
 test/unit/Support.hpp                |   2 +
 6 files changed, 100 insertions(+), 19 deletions(-)

diffs (223 lines):

diff -r 9a6cd83d3a90 -r 42aad86c4ce1 src/filters/ScalingFilter.cpp
--- a/src/filters/ScalingFilter.cpp	Tue Aug 02 13:57:31 2011 -0500
+++ b/src/filters/ScalingFilter.cpp	Tue Aug 02 13:49:18 2011 -0700
@@ -152,11 +152,11 @@
 
         if (!schema.hasDimension(dimXd) || !schema.hasDimension(dimYd) || !schema.hasDimension(dimZd))
         {
-            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as doubles (forward direction)");
+            throw impedance_invalid("Descaling filter requires X,Y,Z dimensions as doubles");
         }
         if (schema.hasDimension(dimXi) || schema.hasDimension(dimYi) || schema.hasDimension(dimZi))
         {
-            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as ints not be initially present (forward direction)");
+            throw impedance_invalid("Descaling filter requires X,Y,Z dimensions as ints not be initially present");
         }
 
         schema.removeDimension(dimXd);
@@ -203,11 +203,11 @@
         // ints --> doubles
         if (!schema.hasDimension(dimXi) || !schema.hasDimension(dimYi) || !schema.hasDimension(dimZi))
         {
-            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as int32s (reverse direction)");
+            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as int32s");
         }
         if (schema.hasDimension(dimXd) || schema.hasDimension(dimYd) || schema.hasDimension(dimZd))
         {
-            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as int32s not be initially present (reverse direction)");
+            throw impedance_invalid("Scaling filter requires X,Y,Z dimensions as int32s not be initially present");
         }
 
         if (m_customScaleOffset)
diff -r 9a6cd83d3a90 -r 42aad86c4ce1 test/data/pipeline_write2.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/pipeline_write2.xml	Tue Aug 02 13:49:18 2011 -0700
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WriterPipeline>
+    <Writer>
+        <Type>drivers.las.writer</Type>
+        <Option>
+            <Name>filename</Name>
+            <Value>out2.las</Value>
+            <Description>junk junk junk</Description>
+        </Option>
+        
+        <Filter>
+            <Type>filters.descaling</Type>
+            
+            <Filter>
+                <Type>filters.reprojection</Type>
+                <Option>
+                    <Name>out_srs</Name>
+                    <Value>EPSG:4326</Value>
+                </Option>
+                
+                <Filter>
+                    <Type>filters.scaling</Type>
+                    
+                    <Reader>
+                        <Type>drivers.las.reader</Type>
+                        <Option>
+                            <Name>filename</Name>
+                            <Value>utm15.las</Value>
+                        </Option>
+                    </Reader>
+                </Filter>
+            </Filter>
+        </Filter>
+    </Writer>
+</WriterPipeline>
diff -r 9a6cd83d3a90 -r 42aad86c4ce1 test/unit/PipelineReaderTest.cpp
--- a/test/unit/PipelineReaderTest.cpp	Tue Aug 02 13:57:31 2011 -0500
+++ b/test/unit/PipelineReaderTest.cpp	Tue Aug 02 13:49:18 2011 -0700
@@ -41,6 +41,7 @@
 #include <pdal/FileUtils.hpp>
 #include <pdal/PointBuffer.hpp>
 #include <pdal/StageIterator.hpp>
+#include <pdal/drivers/las/Reader.hpp>
 
 using namespace pdal;
 
@@ -88,7 +89,7 @@
         BOOST_CHECK(np == 1065);
     }
 
-    FileUtils::deleteFile("out.las");
+    FileUtils::deleteFile(Support::datapath("out.las"));
 
     return;
 }
@@ -159,4 +160,48 @@
     return;
 }
 
+
+BOOST_AUTO_TEST_CASE(PipelineReaderTest_test4)
+{
+    FileUtils::deleteFile("out2.las");
+
+    {
+        PipelineManager manager;
+        PipelineReader reader(manager);
+
+        reader.readWriterPipeline(Support::datapath("pipeline_write2.xml"));
+        Writer* writerStage = manager.getWriter();
+        writerStage->initialize();
+
+        const boost::uint64_t np = writerStage->write();
+        BOOST_CHECK(np == 1);
+    }
+
+    const double preX = 470692.447538;
+    const double preY = 4602888.904642;
+    const double preZ = 16.000000;
+    const double postX = -93.351563;
+    const double postY = 41.577148;
+    const double postZ = 16.000000;
+    {
+        pdal::drivers::las::LasReader reader(Support::datapath("utm15.las"));
+        reader.initialize();
+        const pdal::Bounds<double>& bounds = reader.getBounds();
+        const pdal::Bounds<double> ref(preX, preY, preZ, preX, preY, preZ);
+        Support::compareBounds(bounds, ref);
+    }
+    {
+        pdal::drivers::las::LasReader reader(Support::datapath("out2.las"));
+        reader.initialize();
+        const pdal::Bounds<double>& bounds = reader.getBounds();
+        const pdal::Bounds<double> ref(postX, postY, postZ, postX, postY, postZ);
+        Support::compareBounds(bounds, ref);
+    }
+
+    FileUtils::deleteFile(Support::datapath("out2.las"));
+
+    return;
+}
+
+
 BOOST_AUTO_TEST_SUITE_END()
diff -r 9a6cd83d3a90 -r 42aad86c4ce1 test/unit/ReprojectionFilterTest.cpp
--- a/test/unit/ReprojectionFilterTest.cpp	Tue Aug 02 13:57:31 2011 -0500
+++ b/test/unit/ReprojectionFilterTest.cpp	Tue Aug 02 13:49:18 2011 -0700
@@ -49,17 +49,6 @@
 BOOST_AUTO_TEST_SUITE(ReprojectionFilterTest)
 
 
-static void compareBounds(const pdal::Bounds<double>& p, const pdal::Bounds<double>& q)
-{
-    BOOST_CHECK_CLOSE(p.getMinimum(0), q.getMinimum(0), 1);
-    BOOST_CHECK_CLOSE(p.getMinimum(1), q.getMinimum(1), 1);
-    BOOST_CHECK_CLOSE(p.getMinimum(2), q.getMinimum(2), 1);
-    BOOST_CHECK_CLOSE(p.getMaximum(0), q.getMaximum(0), 1);
-    BOOST_CHECK_CLOSE(p.getMaximum(1), q.getMaximum(1), 1);
-    BOOST_CHECK_CLOSE(p.getMaximum(2), q.getMaximum(2), 1);
-}
-
-
 static void getPoint(const pdal::PointBuffer& data, double& x, double& y, double& z, double scaleX, double scaleY, double scaleZ)
 {
     using namespace pdal;
@@ -129,7 +118,7 @@
         // note this file has only 1 points, so yes, the extent's mins and maxes are the same
         const pdal::Bounds<double> oldBounds_ref(preX, preY, preZ, preX, preY, preZ);
         const pdal::Bounds<double>& oldBounds = reader.getBounds();
-        compareBounds(oldBounds_ref, oldBounds);
+        Support::compareBounds(oldBounds_ref, oldBounds);
 
         double x=0, y=0, z=0;
         getPoint(data, x, y, z, 0.01, 0.01, 0.01);
@@ -164,7 +153,7 @@
 
         const pdal::Bounds<double> newBounds_ref(postX, postY, postZ, postX, postY, postZ);
         const pdal::Bounds<double>& newBounds = descalingFilter.getBounds();
-        compareBounds(newBounds_ref, newBounds);
+        Support::compareBounds(newBounds_ref, newBounds);
 
         double x=0, y=0, z=0;
         getPoint(data, x, y, z, 0.01, 0.01, 0.01);
@@ -202,7 +191,7 @@
 
         const pdal::Bounds<double> newBounds_ref(postX, postY, postZ, postX, postY, postZ);
         const pdal::Bounds<double>& newBounds = descalingFilter.getBounds();
-        compareBounds(newBounds_ref, newBounds);
+        Support::compareBounds(newBounds_ref, newBounds);
 
         double x=0, y=0, z=0;
         getPoint(data, x, y, z, 0.01, 0.01, 0.01);
diff -r 9a6cd83d3a90 -r 42aad86c4ce1 test/unit/Support.cpp
--- a/test/unit/Support.cpp	Tue Aug 02 13:57:31 2011 -0500
+++ b/test/unit/Support.cpp	Tue Aug 02 13:49:18 2011 -0700
@@ -216,3 +216,13 @@
     Support::check_pN(data, schema, 2, 638598.880000, 851445.370000, 422.150000);
 }
 
+
+void Support::compareBounds(const pdal::Bounds<double>& p, const pdal::Bounds<double>& q)
+{
+    BOOST_CHECK_CLOSE(p.getMinimum(0), q.getMinimum(0), 1);
+    BOOST_CHECK_CLOSE(p.getMinimum(1), q.getMinimum(1), 1);
+    BOOST_CHECK_CLOSE(p.getMinimum(2), q.getMinimum(2), 1);
+    BOOST_CHECK_CLOSE(p.getMaximum(0), q.getMaximum(0), 1);
+    BOOST_CHECK_CLOSE(p.getMaximum(1), q.getMaximum(1), 1);
+    BOOST_CHECK_CLOSE(p.getMaximum(2), q.getMaximum(2), 1);
+}
diff -r 9a6cd83d3a90 -r 42aad86c4ce1 test/unit/Support.hpp
--- a/test/unit/Support.hpp	Tue Aug 02 13:57:31 2011 -0500
+++ b/test/unit/Support.hpp	Tue Aug 02 13:49:18 2011 -0700
@@ -37,6 +37,7 @@
 
 // support functions for unit testing
 
+#include <pdal/Bounds.hpp>
 #include <boost/cstdint.hpp>
 
 namespace pdal
@@ -75,6 +76,7 @@
     static void check_p355_p356_p357(const pdal::PointBuffer& data, const pdal::Schema& schema);
     static void check_p710_p711_p712(const pdal::PointBuffer& data, const pdal::Schema& schema);
 
+    static void compareBounds(const pdal::Bounds<double>& p, const pdal::Bounds<double>& q);
 };
 
 


More information about the Liblas-commits mailing list