[Liblas-commits] hg: add a test of liblas::Summary with certainty3d-color-utm-fee...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 22 12:33:14 EST 2010


changeset f419244e89e0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f419244e89e0
summary: add a test of liblas::Summary with certainty3d-color-utm-feet-navd88.las file

diffstat:

 test/unit/lasreader_test.cpp |  114 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 0 deletions(-)

diffs (133 lines):

diff -r 2c9aab8dcc05 -r f419244e89e0 test/unit/lasreader_test.cpp
--- a/test/unit/lasreader_test.cpp	Wed Dec 22 10:44:50 2010 -0600
+++ b/test/unit/lasreader_test.cpp	Wed Dec 22 11:33:08 2010 -0600
@@ -20,9 +20,11 @@
     struct lasreader_data
     {
         std::string file10_;
+        std::string file12_;
 
         lasreader_data()
             : file10_(g_test_data_path + "//TO_core_last_clip.las")
+            , file12_(g_test_data_path + "//certainty3d-color-utm-feet-navd88.las")
         {}
     };
 
@@ -164,5 +166,117 @@
         test_file10_point4(reader[3]);
 
     }
+
+    // Test summarization and valid values
+    template<>
+    template<>
+    void to::test<8>()
+    {
+        std::ifstream ifs;
+        ifs.open(file12_.c_str(), std::ios::in | std::ios::binary);
+        liblas::Reader reader(ifs);
+        
+        liblas::Summary summary;
+        liblas::CoordinateSummary coord_summary;
+        
+        bool read = reader.ReadNextPoint();
+        while (read)
+        {
+            summary.AddPoint(reader.GetPoint());
+            coord_summary.AddPoint(reader.GetPoint());
+            read = reader.ReadNextPoint();
+        }
+
+        liblas::property_tree::ptree tree = summary.GetPTree();
+        
+        ensure_equals("Point count not correct", 
+                       tree.get<boost::uint32_t>("summary.points.count"),
+                       static_cast<boost::uint32_t>(10126));
+                       
+        ensure_distance("Min X does not match", 
+                        tree.get<double>("summary.points.minimum.x"), 
+                        6326726.536120,
+                        0.000001);
+
+        ensure_distance("Min Y does not match", 
+                        tree.get<double>("summary.points.minimum.y"), 
+                        2068062.385430,
+                        0.000001);
+
+        ensure_distance("Min Z does not match", 
+                        tree.get<double>("summary.points.minimum.z"), 
+                        2700.5303501,
+                        0.000001);
+
+
+        ensure_distance("Max X does not match", 
+                        tree.get<double>("summary.points.maximum.x"), 
+                        6330162.951062,
+                        0.000001);
+
+        ensure_distance("Max Y does not match", 
+                        tree.get<double>("summary.points.maximum.y"), 
+                        2071932.240223,
+                        0.000001);
+
+        ensure_distance("Max Z does not match", 
+                        tree.get<double>("summary.points.maximum.z"), 
+                        2975.7118862,
+                        0.000001);
+
+        ensure_equals("Min red not correct", 
+                       tree.get<boost::uint16_t>("summary.points.minimum.color.red"),
+                       static_cast<boost::uint16_t>(4096)); 
+        ensure_equals("Min green not correct", 
+                       tree.get<boost::uint16_t>("summary.points.minimum.color.green"),
+                       static_cast<boost::uint16_t>(2304));                                              
+        ensure_equals("Min blue not correct", 
+                       tree.get<boost::uint16_t>("summary.points.minimum.color.blue"),
+                       static_cast<boost::uint16_t>(0)); 
+
+        ensure_equals("Max red not correct", 
+                       tree.get<boost::uint16_t>("summary.points.maximum.color.red"),
+                       static_cast<boost::uint16_t>(65280)); 
+        ensure_equals("Max green not correct", 
+                       tree.get<boost::uint16_t>("summary.points.maximum.color.green"),
+                       static_cast<boost::uint16_t>(64512));                                              
+        ensure_equals("Max blue not correct", 
+                       tree.get<boost::uint16_t>("summary.points.maximum.color.blue"),
+                       static_cast<boost::uint16_t>(56320));   
+        
+        tree = coord_summary.GetPTree();
+        ensure_distance("Coordinate Summary Min X does not match", 
+                        tree.get<double>("summary.points.minimum.x"), 
+                        6326726.536120,
+                        0.000001);
+
+        ensure_distance("Coordinate Summary Min Y does not match", 
+                        tree.get<double>("summary.points.minimum.y"), 
+                        2068062.385430,
+                        0.000001);
+
+        ensure_distance("Coordinate Summary Min Z does not match", 
+                        tree.get<double>("summary.points.minimum.z"), 
+                        2700.5303501,
+                        0.000001);
+
+
+        ensure_distance("Coordinate Summary Max X does not match", 
+                        tree.get<double>("summary.points.maximum.x"), 
+                        6330162.951062,
+                        0.000001);
+
+        ensure_distance("Coordinate Summary Max Y does not match", 
+                        tree.get<double>("summary.points.maximum.y"), 
+                        2071932.240223,
+                        0.000001);
+
+        ensure_distance("Coordinate Summary Max Z does not match", 
+                        tree.get<double>("summary.points.maximum.z"), 
+                        2975.7118862,
+                        0.000001);
+
+    }
+
 }
 


More information about the Liblas-commits mailing list