[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Apr 5 11:52:55 EDT 2010


changeset 5cd168bdd44c in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5cd168bdd44c
summary: reset the error state of the stream if we're eof

changeset db534a58c501 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=db534a58c501
summary: clean up leftover from last commit

diffstat:

 include/liblas/iterator.hpp            |   12 +-
 include/liblas/laserror.hpp            |    8 +-
 src/detail/reader/header.cpp           |    7 +-
 src/las_c_api.cpp                      |   10 +-
 src/laserror.cpp                       |    6 +-
 test/unit/common.cpp                   |   30 +-
 test/unit/common.hpp                   |   16 +-
 test/unit/lasclassification_test.cpp   |   76 ++++----
 test/unit/laserror_test.cpp            |   12 +-
 test/unit/lasheader_test.cpp           |   56 +++---
 test/unit/laspoint_test.cpp            |   52 +++---
 test/unit/lasreader_iterator_test.cpp  |   16 +-
 test/unit/lasreader_test.cpp           |   22 +-
 test/unit/lasspatialreference_test.cpp |  252 +--------------------------------
 test/unit/lasvariablerecord_test.cpp   |   22 +-
 test/unit/laswriter_test.cpp           |   40 ++--
 16 files changed, 197 insertions(+), 440 deletions(-)

diffs (truncated from 1690 to 300 lines):

diff -r 9d6ed479de3d -r db534a58c501 include/liblas/iterator.hpp
--- a/include/liblas/iterator.hpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/include/liblas/iterator.hpp	Mon Apr 05 10:46:57 2010 -0500
@@ -72,7 +72,7 @@
 
     /// Initializes iterator pointing to beginning of LAS file sequence.
     /// No ownership transfer of reader object occurs.
-    reader_iterator(liblas::LASReader& reader)
+    reader_iterator(liblas::Reader& reader)
         : m_reader(&reader)
     {
         assert(0 != m_reader);
@@ -129,7 +129,7 @@
         }
     }
 
-    liblas::LASReader* m_reader;
+    liblas::Reader* m_reader;
 };
 
 /// Equality operator implemented in terms of reader_iterator::equal
@@ -164,7 +164,7 @@
     /// Initialize iterator with given writer.
     /// The writer position is not changed.
     /// No ownership transfer of writer object occurs.
-    writer_iterator(liblas::LASWriter& writer)
+    writer_iterator(liblas::Writer& writer)
         : m_writer(&writer)
     {
         assert(0 != m_writer);
@@ -205,16 +205,16 @@
 
 private:
 
-    liblas::LASWriter* m_writer;
+    liblas::Writer* m_writer;
 };
 
 // Declare specializations for user's convenience
 
 /// Public specialization of LASReader input iterator for liblas::LASPoint type.
-typedef reader_iterator<LASPoint> lasreader_iterator;
+typedef reader_iterator<Point> lasreader_iterator;
 
 /// Public specialization of LASWriter output iterator for liblas::LASPoint type.
-typedef writer_iterator<LASPoint> laswriter_iterator;
+typedef writer_iterator<Point> laswriter_iterator;
 
 } // namespace liblas
 
diff -r 9d6ed479de3d -r db534a58c501 include/liblas/laserror.hpp
--- a/include/liblas/laserror.hpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/include/liblas/laserror.hpp	Mon Apr 05 10:46:57 2010 -0500
@@ -54,21 +54,21 @@
 /// This class describes details of error condition occured in
 /// libLAS core. All errors are stacked by C API layer, so it's
 /// possible to track problem down to its source.
-class LASError
+class Error
 {
 public:
 
     /// Custom constructor.
     /// This is the main and the only tool to initialize error instance.
-    LASError(int code, std::string const& message, std::string const& method);
+    Error(int code, std::string const& message, std::string const& method);
 
     /// Copy constructor.
     /// Error objects are copyable.
-    LASError(LASError const& other);
+    Error(Error const& other);
 
     /// Assignment operator.
     /// Error objects are assignable.
-    LASError& operator=(LASError const& rhs);
+    Error& operator=(Error const& rhs);
 
     // TODO - mloskot: What about replacing string return by copy with const char* ?
     //        char const* GetMethod() const { return m_method.c_str(); }, etc.
diff -r 9d6ed479de3d -r db534a58c501 src/detail/reader/header.cpp
--- a/src/detail/reader/header.cpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/src/detail/reader/header.cpp	Mon Apr 05 10:46:57 2010 -0500
@@ -215,6 +215,7 @@
     // offset is actually 2 bytes back.  We need to set the dataoffset 
     // appropriately in those cases anyway. 
     m_ifs.seekg(m_header.GetDataOffset());
+    
 
     if (HasLAS10PadSignature()) {
         std::streamsize const current_pos = m_ifs.tellg();
@@ -232,6 +233,10 @@
     // really what is wrong, but there's no real way to know that unless 
     // you go start mucking around in the bytes with hexdump or od
 
+    // If we're eof, we need to reset the state
+    if (m_ifs.eof())
+        m_ifs.clear();
+        
     // Seek to the beginning
     m_ifs.seekg(0, std::ios::beg);
     std::ios::pos_type beginning = m_ifs.tellg();
@@ -240,7 +245,7 @@
     m_ifs.seekg(0, std::ios::end);
     std::ios::pos_type end = m_ifs.tellg();
     std::ios::off_type size = end - beginning;
-    
+     
     // Figure out how many points we have 
     std::ios::off_type count = (end - static_cast<std::ios::off_type>(m_header.GetDataOffset())) / 
                                  static_cast<std::ios::off_type>(m_header.GetDataRecordLength());
diff -r 9d6ed479de3d -r db534a58c501 src/las_c_api.cpp
--- a/src/las_c_api.cpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/src/las_c_api.cpp	Mon Apr 05 10:46:57 2010 -0500
@@ -132,7 +132,7 @@
 } LASErrorEnum;
 
 
-static std::stack<LASError > errors;
+static std::stack<liblas::Error > errors;
 
 #ifdef _MSC_VER
 # pragma warning(disable: 4127) // warning C4127: conditional expression is constant
@@ -184,7 +184,7 @@
     if (errors.empty())
         return 0;
     else {
-        LASError err = errors.top();
+        liblas::Error err = errors.top();
         return err.GetCode();
     }
 }
@@ -193,7 +193,7 @@
     if (errors.empty()) 
         return NULL;
     else {
-        LASError err = errors.top();
+        liblas::Error err = errors.top();
         return strdup(err.GetMessage().c_str());
     }
 }
@@ -202,13 +202,13 @@
     if (errors.empty()) 
         return NULL;
     else {
-        LASError err = errors.top();
+        liblas::Error err = errors.top();
         return strdup(err.GetMethod().c_str());
     }
 }
 
 LAS_DLL void LASError_PushError(int code, const char *message, const char *method) {
-    LASError err = LASError(code, std::string(message), std::string(method));
+    liblas::Error err = liblas::Error(code, std::string(message), std::string(method));
     errors.push(err);
 }
 
diff -r 9d6ed479de3d -r db534a58c501 src/laserror.cpp
--- a/src/laserror.cpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/src/laserror.cpp	Mon Apr 05 10:46:57 2010 -0500
@@ -47,21 +47,21 @@
 namespace liblas
 {
 
-LASError::LASError(int code, std::string const& message, std::string const& method) :
+Error::Error(int code, std::string const& message, std::string const& method) :
     m_code(code),
     m_message(message),
     m_method(method)
 {
 }
 
-LASError::LASError(LASError const& other) :
+Error::Error(Error const& other) :
     m_code(other.m_code),
     m_message(other.m_message),
     m_method(other.m_method)
 {
 }
 
-LASError& LASError::operator=(LASError const& rhs)
+Error& Error::operator=(Error const& rhs)
 {
     if (&rhs != this)
     {
diff -r 9d6ed479de3d -r db534a58c501 test/unit/common.cpp
--- a/test/unit/common.cpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/test/unit/common.cpp	Mon Apr 05 10:46:57 2010 -0500
@@ -14,12 +14,12 @@
 namespace tut
 {
 
-void test_default_header(liblas::LASHeader const& h)
+void test_default_header(liblas::Header const& h)
 {
-    using liblas::LASHeader;
+    using liblas::Header;
 
     ensure_equals("wrong default file signature",
-        h.GetFileSignature(), LASHeader::FileSignature);
+        h.GetFileSignature(), Header::FileSignature);
 
     ensure_equals("wrong default file source id",
         h.GetFileSourceId(), 0);
@@ -36,9 +36,9 @@
         h.GetVersionMinor(), 2);
 
     ensure_equals("wrong default system id",
-        h.GetSystemId(), LASHeader::SystemIdentifier);
+        h.GetSystemId(), Header::SystemIdentifier);
     ensure_equals("wrong default software id",
-        h.GetSoftwareId(), LASHeader::SoftwareIdentifier);
+        h.GetSoftwareId(), Header::SoftwareIdentifier);
 
     // TODO: Fix me to use todays day # and year
     // ensure_equals("wrong default creation day-of-year",
@@ -81,7 +81,7 @@
     ensure_equals("wrong default max Z", h.GetMaxZ(), double(0));
 }
 
-void test_default_point(liblas::LASPoint const& p)
+void test_default_point(liblas::Point const& p)
 {
     ensure_equals("wrong default X coordinate",
         p.GetX(), double(0));
@@ -100,7 +100,7 @@
     ensure_equals("wrong defualt edge of flight line",
         p.GetFlightLineEdge(), 0);
     ensure_equals("wrong defualt classification",
-        p.GetClassification(), liblas::LASClassification::bitset_type());
+        p.GetClassification(), liblas::Classification::bitset_type());
     ensure_equals("wrong defualt scan angle rank",
         p.GetScanAngleRank(), 0);
     ensure_equals("wrong defualt file marker/user data value",
@@ -120,9 +120,9 @@
     ensure("invalid defualt point record", p.IsValid());
 }
 
-void test_file10_header(liblas::LASHeader const& h)
+void test_file10_header(liblas::Header const& h)
 {
-    ensure_equals(h.GetFileSignature(), liblas::LASHeader::FileSignature);
+    ensure_equals(h.GetFileSignature(), liblas::Header::FileSignature);
     ensure_equals(h.GetFileSourceId(), 0);
     ensure_equals(h.GetReserved(), 0);
 
@@ -156,13 +156,13 @@
     ensure_equals(h.GetMaxZ(), double(55.26));
 }
 
-void test_file10_point1(liblas::LASPoint const& p)
+void test_file10_point1(liblas::Point const& p)
 {
     ensure_distance(p.GetX(), double(630262.30), 0.0001);
     ensure_distance(p.GetY(), double(4834500), 0.0001);
     ensure_distance(p.GetZ(), double(51.53), 0.0001);
     ensure_equals(p.GetIntensity(), 670);
-    ensure_equals(p.GetClassification(), liblas::LASClassification::bitset_type(1));
+    ensure_equals(p.GetClassification(), liblas::Classification::bitset_type(1));
     ensure_equals(p.GetScanAngleRank(), 0);
     ensure_equals(p.GetUserData(), 3);
     ensure_equals(p.GetPointSourceID(), 0);
@@ -170,13 +170,13 @@
     ensure_distance(p.GetTime(), double(413665.23360000004), 0.0001);
 }
 
-void test_file10_point2(liblas::LASPoint const& p)
+void test_file10_point2(liblas::Point const& p)
 {
     ensure_distance(p.GetX(), double(630282.45), 0.0001);
     ensure_distance(p.GetY(), double(4834500), 0.0001);
     ensure_distance(p.GetZ(), double(51.63), 0.0001);
     ensure_equals(p.GetIntensity(), 350);
-    ensure_equals(p.GetClassification(), liblas::LASClassification::bitset_type(1));
+    ensure_equals(p.GetClassification(), liblas::Classification::bitset_type(1));
     ensure_equals(p.GetScanAngleRank(), 0);
     ensure_equals(p.GetUserData(), 3);
     ensure_equals(p.GetPointSourceID(), 0);
@@ -184,13 +184,13 @@
     ensure_distance(p.GetTime(), double(413665.52880000003), 0.0001);
 }
 
-void test_file10_point4(liblas::LASPoint const& p)
+void test_file10_point4(liblas::Point const& p)
 {
     ensure_distance(p.GetX(), double(630346.83), 0.0001);
     ensure_distance(p.GetY(), double(4834500), 0.0001);
     ensure_distance(p.GetZ(), double(50.90), 0.0001);
     ensure_equals(p.GetIntensity(), 150);
-    ensure_equals(p.GetClassification(), liblas::LASClassification::bitset_type(1));
+    ensure_equals(p.GetClassification(), liblas::Classification::bitset_type(1));
     ensure_equals(p.GetScanAngleRank(), 0);
     ensure_equals(p.GetUserData(), 4);
     ensure_equals(p.GetPointSourceID(), 0);
diff -r 9d6ed479de3d -r db534a58c501 test/unit/common.hpp
--- a/test/unit/common.hpp	Thu Apr 01 22:14:13 2010 -0500
+++ b/test/unit/common.hpp	Mon Apr 05 10:46:57 2010 -0500
@@ -21,7 +21,7 @@
         : x(x), y(y), t(tolerance)
     {}
 


More information about the Liblas-commits mailing list