[Liblas-commits] hg: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 30 18:39:37 EST 2009


changeset 5900aba73f89 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5900aba73f89
summary: Added alias LASHeader::RecordsByReturnArray to make it possible ot query the actual type of array. Removed temporary string object. Added assertions.

changeset 0c3ad6b8a8e8 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0c3ad6b8a8e8
summary: Removed unreachable code in las_c_api.cpp

changeset f3b481d2694b in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f3b481d2694b
summary: Updated CMakeLists.txt to disable warnings about deprecated CRT functions for more recent Visual Studio versions

diffstat:

 CMakeLists.txt               |   2 +-
 include/liblas/lasheader.hpp |  14 ++++++++------
 src/las_c_api.cpp            |   1 -
 src/lasheader.cpp            |  25 +++++++++----------------
 4 files changed, 18 insertions(+), 24 deletions(-)

diffs (169 lines):

diff -r b1eb8ff1cfbd -r f3b481d2694b CMakeLists.txt
--- a/CMakeLists.txt	Wed Dec 30 22:32:47 2009 +0000
+++ b/CMakeLists.txt	Wed Dec 30 23:39:27 2009 +0000
@@ -74,7 +74,7 @@
             SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
         ENDIF()
 
-        IF (MSVC80)
+        IF (MSVC80 OR MSVC90 OR MSVC10)
             ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
             ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNING)
         ENDIF()
diff -r b1eb8ff1cfbd -r f3b481d2694b include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp	Wed Dec 30 22:32:47 2009 +0000
+++ b/include/liblas/lasheader.hpp	Wed Dec 30 23:39:27 2009 +0000
@@ -49,8 +49,8 @@
 #include <liblas/guid.hpp>
 #include <liblas/detail/utility.hpp>
 #include <liblas/detail/fwd.hpp>
-
 //std
+#include <cstddef>
 #include <string>
 #include <vector>
 
@@ -83,8 +83,7 @@
         ePointFormat0 = 0, ///< Point Data Format \e 0
         ePointFormat1 = 1, ///< Point Data Format \e 1
         ePointFormat2 = 2, ///< Point Data Format \e 2
-        ePointFormat3 = 3 ///< Point Data Format \e 3
-
+        ePointFormat3 = 3  ///< Point Data Format \e 3
     };
 
     /// Number of bytes of point record storage in particular format.
@@ -94,7 +93,6 @@
         ePointSize1 = 28, ///< Size of point record in data format \e 1
         ePointSize2 = 26, ///< Size of point record in data format \e 2
         ePointSize3 = 34  ///< Size of point record in data format \e 3
-
     };
 
     /// Official signature of ASPRS LAS file format, always \b "LASF".
@@ -106,6 +104,10 @@
     /// Default software identifier used by libLAS, always \b "libLAS X.Y".
     static char const* const SoftwareIdentifier;
 
+    /// Array of 5 elements - numbers of points recorded by each return.
+    /// \todo TODO: Consider replacing with {boost|std::tr1}::array<T, 5> --mloskot
+    typedef std::vector<uint32_t> RecordsByReturnArray;
+
     /// Default constructor.
     /// The default constructed header is configured according to the ASPRS
     /// LAS 1.2 Specification, point data format set to 0.
@@ -262,7 +264,7 @@
     void SetPointRecordsCount(uint32_t v);
     
     /// Get array of the total point records per return.
-    std::vector<uint32_t> const& GetPointRecordsByReturnCount() const;
+    RecordsByReturnArray const& GetPointRecordsByReturnCount() const;
 
     /// Set values of 5-elements array of total point records per return.
     /// \exception std::out_of_range - if index is bigger than 4.
@@ -385,7 +387,7 @@
     uint8_t m_dataFormatId;
     uint16_t m_dataRecordLen;
     uint32_t m_pointRecordsCount;
-    std::vector<uint32_t> m_pointRecordsByReturn;
+    RecordsByReturnArray m_pointRecordsByReturn;
     PointScales m_scales;
     PointOffsets m_offsets;
     PointExtents m_extents;
diff -r b1eb8ff1cfbd -r f3b481d2694b src/las_c_api.cpp
--- a/src/las_c_api.cpp	Wed Dec 30 22:32:47 2009 +0000
+++ b/src/las_c_api.cpp	Wed Dec 30 23:39:27 2009 +0000
@@ -202,7 +202,6 @@
     {
         delete istrm;
         throw std::runtime_error("Reading stream was not able to be created");
-        exit(1);
     }
     return istrm;
 }
diff -r b1eb8ff1cfbd -r f3b481d2694b src/lasheader.cpp
--- a/src/lasheader.cpp	Wed Dec 30 22:32:47 2009 +0000
+++ b/src/lasheader.cpp	Wed Dec 30 23:39:27 2009 +0000
@@ -424,7 +424,7 @@
     m_pointRecordsCount = v;
 }
 
-std::vector<uint32_t> const& LASHeader::GetPointRecordsByReturnCount() const
+LASHeader::RecordsByReturnArray const& LASHeader::GetPointRecordsByReturnCount() const
 {
     return m_pointRecordsByReturn;
 }
@@ -555,16 +555,14 @@
     m_dataFormatId = ePointFormat0;
     m_dataRecordLen = ePointSize0;
 
-
     std::time_t now;
-    std::tm *ptm;
-
     std::time(&now);
-    ptm = std::gmtime(&now);
+    std::tm* ptm = std::gmtime(&now);
+    assert(0 != ptm);
     
     m_createDOY = static_cast<uint16_t>(ptm->tm_yday);
     m_createYear = static_cast<uint16_t>(ptm->tm_year + 1900);
-    
+
     m_headerSize = eHeaderSize;
 
     m_sourceId = m_reserved = m_projectId2 = m_projectId3 = uint16_t();
@@ -604,13 +602,10 @@
     for (i = m_vlrs.begin(); i != m_vlrs.end(); ++i)
     {
         LASVariableRecord record = *i;
-        // beg_size += (*i).GetTotalSize();
 
-        std::string user = record.GetUserId(true);
-        if (uid == user.c_str())
+        if (record.GetUserId(true) == uid)
         {
-            uint16_t id = record.GetRecordId();
-
+            uint16_t const id = record.GetRecordId();
             if (34735 == id)
             {
                 // Geotiff SHORT key
@@ -626,7 +621,7 @@
             else if (34736 == id)
             {
                 // Geotiff DOUBLE key
-                for(j = vlrs.begin(); j != vlrs.end(); ++j)
+                for (j = vlrs.begin(); j != vlrs.end(); ++j)
                 {
                     if (*j == *i)
                     {
@@ -649,13 +644,13 @@
             }
         } // uid == user
     }
-    
+
     // Copy our list of surviving VLRs back to our member variable
     // and update header information
     m_vlrs = vlrs;
     m_recordsCount = static_cast<uint32_t>(m_vlrs.size());
+}
 
-}
 void LASHeader::SetGeoreference() 
 {    
     std::vector<LASVariableRecord> vlrs = m_srs.GetVLRs();
@@ -669,7 +664,6 @@
     {
         AddVLR(*i);
     }
-
 }
 
 LASSpatialReference LASHeader::GetSRS() const
@@ -682,4 +676,3 @@
 }
 
 } // namespace liblas
-


More information about the Liblas-commits mailing list