[Liblas-commits] hg: account for LASzip's rename of DEFAULT_COMPRESSION

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jan 5 22:35:33 EST 2011


details:   http://hg.liblas.orghg/rev/f797616d8827
changeset: 2699:f797616d8827
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Jan 05 21:35:25 2011 -0600
description:
account for LASzip's rename of DEFAULT_COMPRESSION

diffstat:

 src/detail/reader/zipreader.cpp |    4 +-
 src/detail/writer/zipwriter.cpp |   44 ++--
 src/detail/zippoint.cpp         |  316 ++++++++++++++++++++--------------------
 3 files changed, 182 insertions(+), 182 deletions(-)

diffs (truncated from 486 to 300 lines):

diff -r ddba37c0a960 -r f797616d8827 src/detail/reader/zipreader.cpp
--- a/src/detail/reader/zipreader.cpp	Wed Jan 05 16:10:05 2011 -0800
+++ b/src/detail/reader/zipreader.cpp	Wed Jan 05 21:35:25 2011 -0600
@@ -121,7 +121,7 @@
         unsigned int stat = 1;
         try
         {
-            stat = m_unzipper->open(m_ifs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::COMPRESSION_DEFAULT);
+            stat = m_unzipper->open(m_ifs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::DEFAULT_COMPRESSION);
         }
         catch(...)
         {
@@ -281,7 +281,7 @@
     try
     {
         m_unzipper->close();
-        stat = m_unzipper->open(m_ifs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::COMPRESSION_DEFAULT);
+        stat = m_unzipper->open(m_ifs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::DEFAULT_COMPRESSION);
     }
     catch(...)
     {
diff -r ddba37c0a960 -r f797616d8827 src/detail/writer/zipwriter.cpp
--- a/src/detail/writer/zipwriter.cpp	Wed Jan 05 16:10:05 2011 -0800
+++ b/src/detail/writer/zipwriter.cpp	Wed Jan 05 21:35:25 2011 -0600
@@ -2,7 +2,7 @@
  * $Id$
  *
  * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  laszip writer implementation for C++ libLAS 
+ * Purpose:  laszip writer implementation for C++ libLAS 
  * Author:   Michael P. Gerlek (mpg at flaxen.com)
  *
  ******************************************************************************
@@ -46,9 +46,9 @@
 #include <liblas/detail/writer/header.hpp>
 #include <liblas/detail/writer/point.hpp>
 #include <liblas/detail/private_utility.hpp>
-#include <liblas/detail/zippoint.hpp>
-// laszip
-#include <laszip/laszipper.hpp>
+#include <liblas/detail/zippoint.hpp>
+// laszip
+#include <laszip/laszipper.hpp>
 // std
 #include <vector>
 #include <fstream>
@@ -115,13 +115,13 @@
             throw liblas_error("Error opening compression engine (1)");
         }
 
-        PointFormatName format = m_header->GetDataFormatId();
+        PointFormatName format = m_header->GetDataFormatId();
         m_zipPoint = new ZipPoint(format);
 
         unsigned int stat = 1;
         try
         {
-            stat = m_zipper->open(m_ofs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::COMPRESSION_DEFAULT);
+            stat = m_zipper->open(m_ofs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::DEFAULT_COMPRESSION);
         }
         catch(...)
         {
@@ -132,27 +132,27 @@
             throw liblas_error("Error opening compression engine (2)");
         }
     }
-
-    const std::vector<boost::uint8_t>& v = point.GetData();
-    for (unsigned int i=0; i<m_zipPoint->m_lz_point_size; i++)
-    {
-        m_zipPoint->m_lz_point_data[i] = v[i];
-        //printf("%d %d\n", v[i], i);
+
+    const std::vector<boost::uint8_t>& v = point.GetData();
+    for (unsigned int i=0; i<m_zipPoint->m_lz_point_size; i++)
+    {
+        m_zipPoint->m_lz_point_data[i] = v[i];
+        //printf("%d %d\n", v[i], i);
     }
 
     bool ok = false;
     try
     {
-        ok = m_zipper->write(m_zipPoint->m_lz_point);
-    }
-    catch(...)
-    {
-        throw liblas_error("Error writing compressed point data (1)");
-    }
-    if (!ok)
-    {
-        throw liblas_error("Error writing compressed point data (2)");
-    }
+        ok = m_zipper->write(m_zipPoint->m_lz_point);
+    }
+    catch(...)
+    {
+        throw liblas_error("Error writing compressed point data (1)");
+    }
+    if (!ok)
+    {
+        throw liblas_error("Error writing compressed point data (2)");
+    }
 
     ++m_pointCount;
 
diff -r ddba37c0a960 -r f797616d8827 src/detail/zippoint.cpp
--- a/src/detail/zippoint.cpp	Wed Jan 05 16:10:05 2011 -0800
+++ b/src/detail/zippoint.cpp	Wed Jan 05 21:35:25 2011 -0600
@@ -1,90 +1,90 @@
-/******************************************************************************
- * $Id$
- *
- * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  laszip helper functions for C++ libLAS 
- * Author:   Michael P. Gerlek (mpg at flaxen.com)
- *
- ******************************************************************************
- * Copyright (c) 2010, Michael P. Gerlek
- *
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
- * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
- *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
- *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- ****************************************************************************/
-
-#ifdef HAVE_LASZIP
-
-#include <liblas/liblas.hpp>
-#include <liblas/detail/private_utility.hpp>
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  laszip helper functions for C++ libLAS 
+ * Author:   Michael P. Gerlek (mpg at flaxen.com)
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Michael P. Gerlek
+ *
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following 
+ * conditions are met:
+ * 
+ *     * Redistributions of source code must retain the above copyright 
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright 
+ *       notice, this list of conditions and the following disclaimer in 
+ *       the documentation and/or other materials provided 
+ *       with the distribution.
+ *     * Neither the name of the Martin Isenburg or Iowa Department 
+ *       of Natural Resources nor the names of its contributors may be 
+ *       used to endorse or promote products derived from this software 
+ *       without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ ****************************************************************************/
+
+#ifdef HAVE_LASZIP
+
+#include <liblas/liblas.hpp>
+#include <liblas/detail/private_utility.hpp>
 #include <liblas/detail/zippoint.hpp>
 // laszip
 #include <laszip/laszip.hpp>
-// std
-#include <vector>
-#include <fstream>
-#include <stdexcept>
-#include <cstdlib> // std::size_t
-#include <cassert>
-
-namespace liblas { namespace detail { 
-
-static std::string laszip_userid("laszip encoded");
-static boost::uint16_t laszip_recordid = 22204;
-static std::string laszip_description = "encoded for sequential access";
-
-
-ZipPoint::ZipPoint(PointFormatName format) :
+// std
+#include <vector>
+#include <fstream>
+#include <stdexcept>
+#include <cstdlib> // std::size_t
+#include <cassert>
+
+namespace liblas { namespace detail { 
+
+static std::string laszip_userid("laszip encoded");
+static boost::uint16_t laszip_recordid = 22204;
+static std::string laszip_description = "encoded for sequential access";
+
+
+ZipPoint::ZipPoint(PointFormatName format) :
     m_num_items(0),
     m_items(NULL),
     m_lz_point(NULL),
     m_lz_point_data(NULL),
     m_lz_point_size(0)
-{
-    ConstructItems(format);
-    return;
-}
-
-ZipPoint::~ZipPoint()
-{
+{
+    ConstructItems(format);
+    return;
+}
+
+ZipPoint::~ZipPoint()
+{
     m_num_items = 0;
     delete[] m_items;
     m_items = NULL;
 
     delete[] m_lz_point;
     delete[] m_lz_point_data;
-
-    return;
-}
-
-void ZipPoint::ConstructItems(PointFormatName format)
-{
+
+    return;
+}
+
+void ZipPoint::ConstructItems(PointFormatName format)
+{
     switch (format)
     {
     case ePointFormat0:
@@ -143,33 +143,33 @@
         m_lz_point[i] = &(m_lz_point_data[point_offset]);
         point_offset += m_items[i].size;
     }
-
-    return;
-}
-
-template<class T>
-static inline boost::uint8_t* PutBytes(boost::uint8_t* p, T d)
-{
-    LIBLAS_SWAP_BYTES(d);
-    memcpy(p, &d, sizeof(T));
-    return p+sizeof(T);
-}
-
-template<class T>
-static inline boost::uint8_t* GetBytes(boost::uint8_t* p, T& d)
-{
-    memcpy(&d, p, sizeof(T));
-    LIBLAS_SWAP_BYTES(d);
-    return p+sizeof(T);
-}
-
-
-void ZipPoint::ConstructVLR(VariableRecord& v) const
-{


More information about the Liblas-commits mailing list