[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Mar 22 14:28:01 EDT 2010


changeset 325df9d68f4d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=325df9d68f4d
summary: add install_name to liblas_c target for APPLE

changeset e8ee49101fc0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e8ee49101fc0
summary: that last PointFormat patch was stupid :)

diffstat:

 include/liblas/detail/reader/point.hpp |   1 -
 include/liblas/detail/writer/point.hpp |   1 -
 include/liblas/lasformat.hpp           |   1 +
 include/liblas/lasheader.hpp           |   2 +
 src/CMakeLists.txt                     |  12 +++++++
 src/detail/reader/point.cpp            |  18 +++++-----
 src/detail/writer/point.cpp            |   7 +--
 src/lasformat.cpp                      |  11 ++++++
 src/lasheader.cpp                      |  55 ++++++++++++++++++++-------------
 9 files changed, 71 insertions(+), 37 deletions(-)

diffs (truncated from 301 to 300 lines):

diff -r 0a681a3a232a -r e8ee49101fc0 include/liblas/detail/reader/point.hpp
--- a/include/liblas/detail/reader/point.hpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/include/liblas/detail/reader/point.hpp	Mon Mar 22 13:22:25 2010 -0500
@@ -93,7 +93,6 @@
     const liblas::Header& m_header;
     liblas::Point m_point;
     OGRCoordinateTransformationH m_transform;
-    const liblas::PointFormat& m_format;
     
     
     void project();
diff -r 0a681a3a232a -r e8ee49101fc0 include/liblas/detail/writer/point.hpp
--- a/include/liblas/detail/writer/point.hpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/include/liblas/detail/writer/point.hpp	Mon Mar 22 13:22:25 2010 -0500
@@ -100,7 +100,6 @@
     OGRCoordinateTransformationH m_transform;
     
     PointRecord m_record;
-    const liblas::PointFormat& m_format;
     
     void project();
     void setup();
diff -r 0a681a3a232a -r e8ee49101fc0 include/liblas/lasformat.hpp
--- a/include/liblas/lasformat.hpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/include/liblas/lasformat.hpp	Mon Mar 22 13:22:25 2010 -0500
@@ -67,6 +67,7 @@
                     bool bTime);
     PointFormat& operator=(PointFormat const& rhs);
     PointFormat(PointFormat const& other);
+    PointFormat();
     
     ~PointFormat() {};
 
diff -r 0a681a3a232a -r e8ee49101fc0 include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/include/liblas/lasheader.hpp	Mon Mar 22 13:22:25 2010 -0500
@@ -50,6 +50,7 @@
 #include <liblas/liblas.hpp>
 #include <liblas/lasvariablerecord.hpp>
 #include <liblas/lasspatialreference.hpp>
+#include <liblas/lasformat.hpp>
 #include <liblas/guid.hpp>
 
 //std
@@ -376,6 +377,7 @@
     PointExtents m_extents;
     std::vector<VariableRecord> m_vlrs;
     SpatialReference m_srs;
+    PointFormat m_format;
 };
 
 } // namespace liblas
diff -r 0a681a3a232a -r e8ee49101fc0 src/CMakeLists.txt
--- a/src/CMakeLists.txt	Sun Mar 21 21:56:56 2010 -0500
+++ b/src/CMakeLists.txt	Mon Mar 22 13:22:25 2010 -0500
@@ -128,9 +128,21 @@
 # Static libLAS C++ library
 add_library(${LIBLAS_LIB_NAME} STATIC ${LIBLAS_SOURCES})
 
+
+
 # Shared libLAS C library
 add_library(${LIBLAS_C_LIB_NAME} SHARED ${LIBLAS_C_SOURCES})
 
+if (APPLE)
+    set_target_properties(
+    ${LIBLAS_C_LIB_NAME}
+    PROPERTIES
+    INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+    
+    )
+endif(APPLE)
+
+########
 target_link_libraries(${LIBLAS_C_LIB_NAME}
   ${LIBLAS_LIB_NAME}
   ${ZLIB_LIBRARIES}
diff -r 0a681a3a232a -r e8ee49101fc0 src/detail/reader/point.cpp
--- a/src/detail/reader/point.cpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/src/detail/reader/point.cpp	Mon Mar 22 13:22:25 2010 -0500
@@ -54,7 +54,7 @@
 }
 
 Point::Point(std::istream& ifs, const liblas::Header& header) :
-    m_ifs(ifs), m_header(header), m_point(liblas::Point()), m_transform(0), m_format(header.GetPointFormat())
+    m_ifs(ifs), m_header(header), m_point(liblas::Point()), m_transform(0)
 {
     setup();
 }
@@ -62,7 +62,7 @@
 Point::Point(   std::istream& ifs, 
                 const liblas::Header& header, 
                 OGRCoordinateTransformationH transform) :
-    m_ifs(ifs), m_header(header), m_point(liblas::Point()), m_transform(transform), m_format(header.GetPointFormat())
+    m_ifs(ifs), m_header(header), m_point(liblas::Point()), m_transform(transform)
 {
     setup();
 }
@@ -106,14 +106,14 @@
     // Reader::FillPoint(record, m_point, m_header);
     m_point.SetCoordinates(m_header, m_point.GetX(), m_point.GetY(), m_point.GetZ());
 
-    if (m_format.HasTime()) 
+    if (m_header.GetPointFormat().HasTime()) 
     {
 
         detail::read_n(gpst, m_ifs, sizeof(double));
         m_point.SetTime(gpst);
         bytesread += sizeof(double);
         
-        if (m_format.HasColor()) 
+        if (m_header.GetPointFormat().HasColor()) 
         {
             detail::read_n(red, m_ifs, sizeof(uint16_t));
             detail::read_n(green, m_ifs, sizeof(uint16_t));
@@ -125,7 +125,7 @@
             bytesread += 3 * sizeof(uint16_t);
         }
     } else {
-        if (m_format.HasColor()) 
+        if (m_header.GetPointFormat().HasColor()) 
         {
             detail::read_n(red, m_ifs, sizeof(uint16_t));
             detail::read_n(green, m_ifs, sizeof(uint16_t));
@@ -137,17 +137,17 @@
             bytesread += 3 * sizeof(uint16_t);
         }        
     }
-
-    if (bytesread != m_format.GetByteSize()) {
+    
+    if (bytesread != m_header.GetPointFormat().GetByteSize()) {
         std::ostringstream msg; 
         msg <<  "The number of bytes that were read ("<< bytesread <<") does not " 
                 "match the number of bytes the point's format "
                 "says it should have (" << 
-                m_format.GetByteSize() << ")";
+                m_header.GetPointFormat().GetByteSize() << ")";
         throw std::runtime_error(msg.str());
         
     }
-    if (m_format.GetByteSize() != m_header.GetDataRecordLength())
+    if (m_header.GetPointFormat().GetByteSize() != m_header.GetDataRecordLength())
     {
         std::size_t bytesleft = m_header.GetDataRecordLength() - bytesread;
 
diff -r 0a681a3a232a -r e8ee49101fc0 src/detail/writer/point.cpp
--- a/src/detail/writer/point.cpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/src/detail/writer/point.cpp	Mon Mar 22 13:22:25 2010 -0500
@@ -62,8 +62,7 @@
     m_ofs(ofs), 
     m_header(header), 
     m_point(liblas::Point()), 
-    m_transform(0),
-    m_format(header.GetPointFormat())
+    m_transform(0)
 {
     setup();
 }
@@ -72,7 +71,7 @@
                 liblas::uint32_t& count,
                 const liblas::Header& header, 
                 OGRCoordinateTransformationH transform) : Base(ofs, count),
-    m_ofs(ofs), m_header(header), m_point(liblas::Point()), m_transform(transform), m_format(header.GetPointFormat())
+    m_ofs(ofs), m_header(header), m_point(liblas::Point()), m_transform(transform)
 
 {
     setup();
@@ -142,7 +141,7 @@
 
     // write in our extra data that the user set on the 
     // point up to the header's specified DataRecordLength
-    if (m_format.GetByteSize() != m_header.GetDataRecordLength()) {
+    if (m_header.GetPointFormat().GetByteSize() != m_header.GetDataRecordLength()) {
 
         std::vector<uint8_t> const& data = point.GetExtraData();
         std::streamsize const size = static_cast<std::streamsize>(m_header.GetDataRecordLength() - data.size());
diff -r 0a681a3a232a -r e8ee49101fc0 src/lasformat.cpp
--- a/src/lasformat.cpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/src/lasformat.cpp	Mon Mar 22 13:22:25 2010 -0500
@@ -84,6 +84,17 @@
     updatesize();
 }
 
+PointFormat::PointFormat( ) :
+    m_size(0),
+    m_versionminor(2), 
+    m_versionmajor(1),
+    m_hasColor(false),
+    m_hasTime(false)
+{
+    updatesize();
+}
+
+
 // copy constructor
 PointFormat::PointFormat(PointFormat const& other) :
     m_size(other.m_size),
diff -r 0a681a3a232a -r e8ee49101fc0 src/lasheader.cpp
--- a/src/lasheader.cpp	Sun Mar 21 21:56:56 2010 -0500
+++ b/src/lasheader.cpp	Mon Mar 22 13:22:25 2010 -0500
@@ -90,7 +90,8 @@
     m_scales(other.m_scales),
     m_offsets(other.m_offsets),
     m_extents(other.m_extents),
-    m_srs(other.m_srs)
+    m_srs(other.m_srs),
+    m_format(other.m_format)
 {
     void* p = 0;
 
@@ -147,6 +148,7 @@
         m_offsets = rhs.m_offsets;
         m_extents = rhs.m_extents;
         m_srs = rhs.m_srs;
+        m_format = rhs.m_format;
     }
     return *this;
 }
@@ -586,6 +588,8 @@
 
     // Zero scale value is useless, so we need to use a small value.
     SetScale(0.01, 0.01, 0.01);
+
+    SetPointFormat(m_format);
 }
 
 void Header::ClearGeoKeyVLRs()
@@ -667,6 +671,7 @@
 {
     return m_srs;
 }
+
 void Header::SetSRS(SpatialReference& srs)
 {
     m_srs = srs;
@@ -674,26 +679,27 @@
 
 PointFormat Header::GetPointFormat() const
 {
-    bool bHasColor(false);
-    bool bHasTime(false);
-
-    if (GetDataFormatId() == liblas::ePointFormat3) {
-        bHasColor = true;
-        bHasTime = true;
-    } else if (GetDataFormatId() == liblas::ePointFormat2) {
-        bHasColor = true;
-        bHasTime = false;
-    } else if (GetDataFormatId() == liblas::ePointFormat1) {
-        bHasColor = false;
-        bHasTime = true;
-    } 
+    // bool bHasColor(false);
+    // bool bHasTime(false);
+    // 
+    // if (GetDataFormatId() == liblas::ePointFormat3) {
+    //     bHasColor = true;
+    //     bHasTime = true;
+    // } else if (GetDataFormatId() == liblas::ePointFormat2) {
+    //     bHasColor = true;
+    //     bHasTime = false;
+    // } else if (GetDataFormatId() == liblas::ePointFormat1) {
+    //     bHasColor = false;
+    //     bHasTime = true;
+    // } 
         
-    return PointFormat(  GetVersionMajor(), 
-                            GetVersionMinor(), 
-                            GetDataRecordLength(), 
-                            bHasColor, 
-                            bHasTime);
-    
+    return m_format;
+    // return PointFormat(  GetVersionMajor(), 
+    //                         GetVersionMinor(), 
+    //                         GetDataRecordLength(), 
+    //                         bHasColor, 
+    //                         bHasTime);
+    // 
 }
 
 void Header::SetPointFormat(const PointFormat& format)
@@ -722,10 +728,15 @@
         SetDataFormatId(liblas::ePointFormat1);
         SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize1),
                                         static_cast<uint16_t>(format.GetByteSize())));
-    } else 
+    } else {
         SetDataFormatId(liblas::ePointFormat0);
         SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize0),
                                         static_cast<uint16_t>(format.GetByteSize())));
-    } 
+    }
+
+    m_format = format;
+
+} 
+    
     


More information about the Liblas-commits mailing list