[Liblas-commits] hg: 4 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jul 29 12:30:32 EDT 2010


changeset ab63fa3d0bec in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ab63fa3d0bec
summary: small test that points are properly copied

changeset 8801519d91a6 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=8801519d91a6
summary: use proper array delete []

changeset c9730cac0c7d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c9730cac0c7d
summary: merge

changeset cc16aa18d156 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=cc16aa18d156
summary: merge

diffstat:

 include/liblas/detail/utility.hpp      |    1 +
 include/liblas/lasbounds.hpp           |   10 -
 python/tests/File.txt                  |   11 +-
 src/detail/reader/header.cpp           |    2 +-
 src/detail/writer/header.cpp           |    3 +-
 src/lasbounds.cpp                      |    1 +
 src/lastransform.cpp                   |    5 +-
 test/unit/common.hpp                   |   37 +-
 test/unit/lasheader_test.cpp           |   23 +-
 test/unit/laspoint_test.cpp            |    7 +-
 test/unit/lasreader_iterator_test.cpp  |   25 +--
 test/unit/tut/README                   |    2 +-
 test/unit/tut/tut.hpp                  |  132 +++++++----
 test/unit/tut/tut_assert.hpp           |  163 ++++++++++++--
 test/unit/tut/tut_config.hpp           |    6 +
 test/unit/tut/tut_console_reporter.hpp |   95 +++++--
 test/unit/tut/tut_cppunit_reporter.hpp |  201 ------------------
 test/unit/tut/tut_exception.hpp        |   92 +++++++-
 test/unit/tut/tut_posix.hpp            |   37 ++-
 test/unit/tut/tut_restartable.hpp      |    9 +-
 test/unit/tut/tut_result.hpp           |   79 +++++-
 test/unit/tut/tut_runner.hpp           |   55 +++-
 test/unit/tut/tut_xml_reporter.hpp     |  361 ---------------------------------
 23 files changed, 567 insertions(+), 790 deletions(-)

diffs (truncated from 2305 to 300 lines):

diff -r fc5d19cd8859 -r cc16aa18d156 include/liblas/detail/utility.hpp
--- a/include/liblas/detail/utility.hpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/include/liblas/detail/utility.hpp	Thu Jul 29 11:30:03 2010 -0500
@@ -90,6 +90,7 @@
 template <typename T, std::size_t N>
 inline std::size_t static_array_size(T (&t)[N])
 {
+    detail::ignore_unused_variable_warning(t);
     return (sizeof(t) / sizeof(t[0]));
 }
 
diff -r fc5d19cd8859 -r cc16aa18d156 include/liblas/lasbounds.hpp
--- a/include/liblas/lasbounds.hpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/include/liblas/lasbounds.hpp	Thu Jul 29 11:30:03 2010 -0500
@@ -85,16 +85,6 @@
     bool equal(Bounds const& other) const;
     bool intersects2d(Bounds const& other) const;
     bool intersects3d(Bounds const& other) const;
-
-    bool operator==(Bounds const& rhs)
-    {
-        return equal(rhs);
-    }
-
-    bool operator!=(Bounds const& rhs)
-    {
-        return (!equal(rhs));
-    }
         
 private:
     Array mins;
diff -r fc5d19cd8859 -r cc16aa18d156 python/tests/File.txt
--- a/python/tests/File.txt	Wed Jul 28 11:51:00 2010 -0500
+++ b/python/tests/File.txt	Thu Jul 29 11:30:03 2010 -0500
@@ -49,11 +49,20 @@
   >>> f.close()
   >>> f.open()
 
+
+Test Reading different locations and proper internal overwriting of the file
+
   >>> f2 = file.File('../test/data/TO_core_last_clip.las')
   >>> p2 = f2.read(6)
   >>> p2.x, p2.y, p2.z
   (630320.95999999996, 4834500.0, 55.009999999999998)
 
+  >>> p2 == f2.read(3)
+  False
+  >>> p2.x == f2.read(6).x
+  True
+
+
   >>> f2.close()
   >>> del f2
   
@@ -305,7 +314,7 @@
   >>> h6.data_record_length
   52
 
-
+  
 f.size - f.base_size will be 16 bytes of space (h6.data_record_length - 34 bytes for point format 3)
 
 >>> import ctypes
diff -r fc5d19cd8859 -r cc16aa18d156 src/detail/reader/header.cpp
--- a/src/detail/reader/header.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/src/detail/reader/header.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -210,7 +210,7 @@
     {
         m_header->SetPointRecordsByReturnCount(i, point_counts[i]);
     }  
-    delete point_counts;
+    delete[] point_counts;
 
     // 21-23. Scale factors
     read_n(x1, m_ifs, sizeof(x1));
diff -r fc5d19cd8859 -r cc16aa18d156 src/detail/writer/header.cpp
--- a/src/detail/writer/header.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/src/detail/writer/header.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -47,6 +47,7 @@
 
 #include <cassert>
 #include <cstdlib> // std::size_t
+#include <algorithm>
 #include <fstream>
 #include <iosfwd>
 #include <ostream>
@@ -217,7 +218,7 @@
     // TODO: fix this for 1.3, which has srbyr = 7;  See detail/reader/header.cpp for more details
     // assert(vpbr.size() <= srbyr);
     uint32_t pbr[srbyr] = { 0 };
-    std::copy(vpbr.begin(), vpbr.end(), pbr);
+    std::copy(vpbr.begin(), vpbr.begin() + srbyr, pbr); // FIXME: currently, copies only 5 records, to be improved
     detail::write_n(GetStream(), pbr, sizeof(pbr));
 
     // 20-22. Scale factors
diff -r fc5d19cd8859 -r cc16aa18d156 src/lasbounds.cpp
--- a/src/lasbounds.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/src/lasbounds.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -149,6 +149,7 @@
 
 bool Bounds::equal(Bounds const& other) const
 {
+    // FIXME: direct comparison of float-point values may give wrong result --mloskot
     for (uint32_t i = 0; i < 3; i++) {
         if (!(min(i) == other.min(i)) && !(max(i) == other.max(i))) 
         {
diff -r fc5d19cd8859 -r cc16aa18d156 src/lastransform.cpp
--- a/src/lastransform.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/src/lastransform.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -88,7 +88,10 @@
     }
 
     m_transform = OCTNewCoordinateTransformation( m_in_ref, m_out_ref);
-    
+#else
+
+    detail::ignore_unused_variable_warning(inSRS);
+    detail::ignore_unused_variable_warning(outSRS);
 #endif
 }
 
diff -r fc5d19cd8859 -r cc16aa18d156 test/unit/common.hpp
--- a/test/unit/common.hpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/test/unit/common.hpp	Thu Jul 29 11:30:03 2010 -0500
@@ -9,6 +9,7 @@
 #include <liblas/laspoint.hpp>
 #include <liblas/lasheader.hpp>
 
+#include <iostream>
 
 namespace tut
 {
@@ -37,38 +38,36 @@
 // Functor to calculate bounding box of a set of points
 struct bbox_calculator
 {
-    typedef liblas::Bounds result_type;
-
-    bbox_calculator() : empty(true) {}
-
-    result_type get_result() const { return bbox; }    
+    bbox_calculator(liblas::Bounds& bbox) : bbox(&bbox), empty(true) {}
 
     void operator()(liblas::Point const& p)
     {
+        assert(0 != bbox);
+
         // Box initialization during first iteration only
         if (empty)
         {
-            bbox.min(0, p.GetX());
-            bbox.max(0, p.GetX());
-            bbox.min(1, p.GetY());
-            bbox.max(1, p.GetY());
-            bbox.min(2, p.GetZ());
-            bbox.max(2, p.GetZ());
+            bbox->min(0, p.GetX());
+            bbox->max(0, p.GetX());
+            bbox->min(1, p.GetY());
+            bbox->max(1, p.GetY());
+            bbox->min(2, p.GetZ());
+            bbox->max(2, p.GetZ());
             empty = false;
         }
 
         // Expand bounding box to include given point
-        bbox.min(0, std::min(bbox.min(0), p.GetX()));
-        bbox.min(1, std::min(bbox.min(1), p.GetY()));
-        bbox.min(2, std::min(bbox.min(2), p.GetZ()));
-        bbox.max(0, std::max(bbox.max(0), p.GetX()));
-        bbox.max(1, std::max(bbox.max(1), p.GetY()));
-        bbox.max(2, std::max(bbox.max(2), p.GetZ()));
+        bbox->min(0, std::min(bbox->min(0), p.GetX()));
+        bbox->min(1, std::min(bbox->min(1), p.GetY()));
+        bbox->min(2, std::min(bbox->min(2), p.GetZ()));
+        bbox->max(0, std::max(bbox->max(0), p.GetX()));
+        bbox->max(1, std::max(bbox->max(1), p.GetY()));
+        bbox->max(2, std::max(bbox->max(2), p.GetZ()));
     }
 
-
+private:
+    liblas::Bounds* bbox;
     bool empty;
-    liblas::Bounds bbox;
 };
 
 // Common test procedure for default constructed point data.
diff -r fc5d19cd8859 -r cc16aa18d156 test/unit/lasheader_test.cpp
--- a/test/unit/lasheader_test.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/test/unit/lasheader_test.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -251,32 +251,39 @@
         typedef ::liblas::uint32_t count_type;
 
         liblas::Header h;
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        // NOTE: The committee in its infinite stupidity decided to increase the size of this array to 7 at 1.3.
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
 
         h.SetPointRecordsByReturnCount(0, 100);
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
         ensure_equals(h.GetPointRecordsByReturnCount().at(0), count_type(100));
 
         h.SetPointRecordsByReturnCount(1, 101);
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
         ensure_equals(h.GetPointRecordsByReturnCount().at(1), count_type(101));
 
         h.SetPointRecordsByReturnCount(2, 102);
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
         ensure_equals(h.GetPointRecordsByReturnCount().at(2), count_type(102));
 
         h.SetPointRecordsByReturnCount(3, 103);
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
         ensure_equals(h.GetPointRecordsByReturnCount().at(3), count_type(103));
 
         h.SetPointRecordsByReturnCount(4, 104);
-        ensure_equals(h.GetPointRecordsByReturnCount().size(), size_type(5));
+        ensure(h.GetPointRecordsByReturnCount().size() >= 5);
+        ensure(h.GetPointRecordsByReturnCount().size() <= 7);
         ensure_equals(h.GetPointRecordsByReturnCount().at(4), count_type(104));
 
         try
         {
-            // 5 is out of range
-            h.SetPointRecordsByReturnCount(5, 500);
+            // 8 is out of range
+            h.SetPointRecordsByReturnCount(8, 500);
             ensure("std::out_of_range not thrown", false);
         }
         catch (std::out_of_range const& e)
diff -r fc5d19cd8859 -r cc16aa18d156 test/unit/laspoint_test.cpp
--- a/test/unit/laspoint_test.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/test/unit/laspoint_test.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -424,20 +424,21 @@
     template<>
     void to::test<17>()
     {
-        std::vector<liblas::uint8_t> data;
+        typedef std::vector<liblas::uint8_t> data_t;
         
+        data_t data;
         data.push_back(254);
         data.push_back(254);
         data.push_back(1);
         
         ensure_equals("invalid default extra data",
-            m_default.GetExtraData().size(), 0);
+            m_default.GetExtraData().size(), 0u);
 
 
         m_default.SetExtraData(data);
 
         ensure_equals("invalid set red color",
-            m_default.GetExtraData().size(), 3);
+            m_default.GetExtraData().size(), 3u);
 
         ensure_equals("invalid set green color",
             m_default.GetExtraData()[1], 254);
diff -r fc5d19cd8859 -r cc16aa18d156 test/unit/lasreader_iterator_test.cpp
--- a/test/unit/lasreader_iterator_test.cpp	Wed Jul 28 11:51:00 2010 -0500
+++ b/test/unit/lasreader_iterator_test.cpp	Thu Jul 29 11:30:03 2010 -0500
@@ -383,30 +383,11 @@
 
         Header const& h = reader_.GetHeader();
         bbox_t lasbbox = h.GetExtent();
-
-        // I don't know why this is failing -- hobu
-
-       // std::cout << std::endl;
-       //  std::cout << "minx: " << h.GetMinX()
-       //            << " miny: " << h.GetMinY()
-       //            << " minz: " << h.GetMinZ()
-       //            << " maxx: " << h.GetMaxX()
-       //            << " maxy: " << h.GetMaxY()
-       //            << " maxz: " << h.GetMaxZ();
                   
         // Accumulate points extents to common bounding box
-        bbox_calculator calculator;
-        std::for_each(it, end, calculator);
+        bbox_t accumulated;
+        std::for_each(it, end, bbox_calculator(accumulated));
         
-        // std::cout << std::endl;
-        // bbox_t b = calculator.get_result();
-        // std::cout << "minx: " << b.min.x
-        //           << " miny: " << b.min.y
-        //           << " minz: " << b.min.z
-        //           << " maxx: " << b.max.x
-        //           << " maxy: " << b.max.y
-        //           << " maxz: " << b.max.z;


More information about the Liblas-commits mailing list