[Liblas-commits] hg: move PointFormat, FormatVersion, and PointSize out into the ...

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jan 19 17:13:03 EST 2010


changeset a55ca271c41e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a55ca271c41e
summary: move PointFormat, FormatVersion, and PointSize out into the liblas:: namespace instead of liblas::LASHeader

diffstat:

 apps/ts2las.cpp              |   8 +++---
 include/liblas/lasformat.hpp |  47 ++++++++++++++-----------------------------
 include/liblas/lasheader.hpp |  28 +-------------------------
 include/liblas/liblas.hpp    |  28 ++++++++++++++++++++++++++
 src/detail/reader10.cpp      |  24 +++++++++++-----------
 src/detail/reader11.cpp      |  24 +++++++++++-----------
 src/detail/reader12.cpp      |  32 ++++++++++++++--------------
 src/detail/writer10.cpp      |   4 +-
 src/detail/writer11.cpp      |   4 +-
 src/detail/writer12.cpp      |   8 +++---
 src/las_c_api.cpp            |   4 +-
 src/lasformat.cpp            |  17 ++++-----------
 src/lasheader.cpp            |   4 +-
 13 files changed, 106 insertions(+), 126 deletions(-)

diffs (truncated from 575 to 300 lines):

diff -r 2e26e1c57ce4 -r a55ca271c41e apps/ts2las.cpp
--- a/apps/ts2las.cpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/apps/ts2las.cpp	Tue Jan 19 16:08:36 2010 -0600
@@ -71,16 +71,16 @@
     LASHeader header;
     
     // Checks for time and color values
-    liblas::LASHeader::PointFormat format = liblas::LASHeader::ePointFormat0;
+    liblas::PointFormat format = liblas::ePointFormat0;
     
     if (hdr->Time) {
         if (hdr->Color) {
-            format = liblas::LASHeader::ePointFormat3;
+            format = liblas::ePointFormat3;
         } else {
-            format = liblas::LASHeader::ePointFormat1;
+            format = liblas::ePointFormat1;
         }
     } else if (hdr->Color) {
-        format = liblas::LASHeader::ePointFormat2;
+        format = liblas::ePointFormat2;
     } 
     header.SetVersionMinor(2);
     header.SetDataFormatId(format);
diff -r 2e26e1c57ce4 -r a55ca271c41e include/liblas/lasformat.hpp
--- a/include/liblas/lasformat.hpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/include/liblas/lasformat.hpp	Tue Jan 19 16:08:36 2010 -0600
@@ -50,15 +50,15 @@
 
 namespace liblas {  
 
-class LASFormat
+class LASPointFormat
 {
 public:
 
-    LASFormat(liblas::uint8_t major, liblas::uint8_t minor, liblas::LASHeader::PointSize size);
-    virtual ~LASFormat();
+    LASPointFormat(liblas::uint8_t major, liblas::uint8_t minor, liblas::PointSize size);
+    virtual ~LASPointFormat();
     
-    virtual liblas::LASHeader::PointSize GetByteSize() const = 0;
-    virtual void SetByteSize(liblas::LASHeader::PointSize& size) const = 0;
+    virtual liblas::PointSize GetByteSize() const = 0;
+    virtual void SetByteSize(liblas::PointSize& size) const = 0;
     
     liblas::uint8_t GetVersionMajor() { return m_versionmajor; }
     void SetVersionMajor(liblas::uint8_t v) {m_versionmajor = v; }
@@ -66,45 +66,30 @@
     liblas::uint8_t GetVersionMinor() { return m_versionminor; }
     void SetVersionMinor(liblas::uint8_t v) {m_versionminor = v; }
 
-    bool IsCompressed() { return m_compressed; } 
-    void SetCompressed(bool v) {m_compressed = v;}
-
-    virtual bool HasColor() const = 0;
-    virtual bool HasTime() const = 0;
+    bool HasColor() const;
+    bool HasTime() const;
+    
+    
     
   
 protected:
     
-    liblas::LASHeader::PointSize m_size;
+    liblas::PointSize m_size;
     uint8_t m_versionminor;
     uint8_t m_versionmajor;
-    bool m_compressed;
-    
+
+    bool m_hasColor;
+    bool m_hasTime;    
+
 private:
 
     // Blocked copying operations, declared but not defined.
-    LASFormat(LASFormat const& other);
-    LASFormat& operator=(LASFormat const& rhs);
+    LASPointFormat(LASPointFormat const& other);
+    LASPointFormat& operator=(LASPointFormat const& rhs);
     
     
 };
 
-class LASPointFormat : public LASFormat
-{
-public:
-
-    typedef LASFormat Base;
-    
-    LASPointFormat(liblas::uint8_t major, liblas::uint8_t minor, liblas::LASHeader::PointSize size);
-    bool HasColor() { return m_hasColor; }
-    bool HasTime() { return m_hasTime; }
-    bool IsCompressed() { return false; }
-
-private:
-
-    bool m_hasColor;
-    bool m_hasTime;
-};
 
 } // namespace liblas
 
diff -r 2e26e1c57ce4 -r a55ca271c41e include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/include/liblas/lasheader.hpp	Tue Jan 19 16:08:36 2010 -0600
@@ -49,6 +49,7 @@
 #include <liblas/guid.hpp>
 #include <liblas/detail/utility.hpp>
 #include <liblas/detail/fwd.hpp>
+#include <liblas/liblas.hpp>
 //std
 #include <cstddef>
 #include <string>
@@ -68,33 +69,6 @@
 {
 public:
 
-    /// Range of allowed ASPRS LAS file format versions.
-    enum FormatVersion
-    {
-        eVersionMajorMin = 1, ///< Minimum of major component
-        eVersionMajorMax = 1, ///< Maximum of major component
-        eVersionMinorMin = 0, ///< Minimum of minor component
-        eVersionMinorMax = 2 ///< Maximum of minor component
-    };
-
-    /// Versions of point record format.
-    enum PointFormat
-    {
-        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
-    };
-
-    /// Number of bytes of point record storage in particular format.
-    enum PointSize
-    {
-        ePointSize0 = 20, ///< Size of point record in data format \e 0
-        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
-        ePointSizeUnknown = -99
-    };
 
     /// Official signature of ASPRS LAS file format, always \b "LASF".
     static char const* const FileSignature;
diff -r 2e26e1c57ce4 -r a55ca271c41e include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/include/liblas/liblas.hpp	Tue Jan 19 16:08:36 2010 -0600
@@ -117,6 +117,34 @@
 #endif
 }
 
+/// Range of allowed ASPRS LAS file format versions.
+enum FormatVersion
+{
+    eVersionMajorMin = 1, ///< Minimum of major component
+    eVersionMajorMax = 1, ///< Maximum of major component
+    eVersionMinorMin = 0, ///< Minimum of minor component
+    eVersionMinorMax = 2 ///< Maximum of minor component
+};
+
+/// Versions of point record format.
+enum PointFormat
+{
+    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
+};
+
+/// Number of bytes of point record storage in particular format.
+enum PointSize
+{
+    ePointSize0 = 20, ///< Size of point record in data format \e 0
+    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
+    ePointSizeUnknown = -99
+};
+    
 } // namespace liblas
 
 #endif // LIBLAS_HPP_INCLUDED
diff -r 2e26e1c57ce4 -r a55ca271c41e src/detail/reader10.cpp
--- a/src/detail/reader10.cpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/src/detail/reader10.cpp	Tue Jan 19 16:08:36 2010 -0600
@@ -149,21 +149,21 @@
 
     // 16. Point Data Format ID
     read_n(n1, m_ifs, sizeof(n1));
-    if (n1 == LASHeader::ePointFormat0)
+    if (n1 == liblas::ePointFormat0)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat0);
+        header.SetDataFormatId(liblas::ePointFormat0);
     } 
-    else if (n1 == LASHeader::ePointFormat1)
+    else if (n1 == liblas::ePointFormat1)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat1);
+        header.SetDataFormatId(liblas::ePointFormat1);
     }
-    else if (n1 == LASHeader::ePointFormat2)
+    else if (n1 == liblas::ePointFormat2)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat2);
+        header.SetDataFormatId(liblas::ePointFormat2);
     }
-    else if (n1 == LASHeader::ePointFormat3)
+    else if (n1 == liblas::ePointFormat3)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat3);
+        header.SetDataFormatId(liblas::ePointFormat3);
     }
     else
     {
@@ -248,7 +248,7 @@
         
         detail::PointRecord record;
         // TODO: Replace with compile-time assert
-        assert(LASHeader::ePointSize0 == sizeof(record));
+        assert(liblas::ePointSize0 == sizeof(record));
 
         try
         {
@@ -265,7 +265,7 @@
         Reader::FillPoint(record, point, header);
         point.SetCoordinates(header, point.GetX(), point.GetY(), point.GetZ());
 
-        if (header.GetDataFormatId() == LASHeader::ePointFormat1)
+        if (header.GetDataFormatId() == liblas::ePointFormat1)
         {
             double gpst(0);
 
@@ -297,7 +297,7 @@
 
     // TODO: Replace with compile-time assert
     detail::PointRecord record;
-    assert(LASHeader::ePointSize0 == sizeof(record));
+    assert(liblas::ePointSize0 == sizeof(record));
     
     // accounting to keep track of the fact that the DataRecordLength 
     // might not map to ePointSize0 or ePointSize1 (see http://liblas.org/ticket/142)
@@ -310,7 +310,7 @@
     Reader::FillPoint(record, point, header);
     point.SetCoordinates(header, point.GetX(), point.GetY(), point.GetZ());
 
-    if (header.GetDataFormatId() == LASHeader::ePointFormat1)
+    if (header.GetDataFormatId() == liblas::ePointFormat1)
     {
         double gpst(0);
         detail::read_n(gpst, m_ifs, sizeof(double));
diff -r 2e26e1c57ce4 -r a55ca271c41e src/detail/reader11.cpp
--- a/src/detail/reader11.cpp	Tue Jan 19 15:48:21 2010 -0600
+++ b/src/detail/reader11.cpp	Tue Jan 19 16:08:36 2010 -0600
@@ -150,21 +150,21 @@
 
     // 17. Point Data Format ID
     read_n(n1, m_ifs, sizeof(n1));
-    if (n1 == LASHeader::ePointFormat0)
+    if (n1 == liblas::ePointFormat0)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat0);
+        header.SetDataFormatId(liblas::ePointFormat0);
     } 
-    else if (n1 == LASHeader::ePointFormat1)
+    else if (n1 == liblas::ePointFormat1)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat1);
+        header.SetDataFormatId(liblas::ePointFormat1);
     }
-    else if (n1 == LASHeader::ePointFormat2)
+    else if (n1 == liblas::ePointFormat2)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat2);
+        header.SetDataFormatId(liblas::ePointFormat2);
     }
-    else if (n1 == LASHeader::ePointFormat3)
+    else if (n1 == liblas::ePointFormat3)
     {
-        header.SetDataFormatId(LASHeader::ePointFormat3);
+        header.SetDataFormatId(liblas::ePointFormat3);
     }
     else
     {
@@ -247,7 +247,7 @@
         
         detail::PointRecord record;
         // TODO: Replace with compile-time assert
-        assert(LASHeader::ePointSize0 == sizeof(record));
+        assert(liblas::ePointSize0 == sizeof(record));
 
         try
         {
@@ -266,7 +266,7 @@


More information about the Liblas-commits mailing list