[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Dec 18 00:22:48 EST 2010


changeset 12ba88f12e5b in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=12ba88f12e5b
summary: added zipwriter skeleton; cleaned up factory calls; fixed zipreader name; added runtime versioning info

changeset 82459e1b0262 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=82459e1b0262
summary: add (disabled) LASZIP support to cmake example

diffstat:

 hobu-config.bat                            |    6 +-
 include/liblas/detail/reader/zipreader.hpp |   16 +-
 include/liblas/detail/writer/zipwriter.hpp |  103 +++++++++++++++++++++
 include/liblas/factory.hpp                 |    3 +-
 include/liblas/lasversion.hpp              |    1 +
 src/CMakeLists.txt                         |    2 +
 src/detail/reader/zipreader.cpp            |   30 +++---
 src/detail/writer/zipwriter.cpp            |  140 +++++++++++++++++++++++++++++
 src/factory.cpp                            |   29 +++--
 src/lasversion.cpp                         |   21 ++++
 10 files changed, 315 insertions(+), 36 deletions(-)

diffs (truncated from 592 to 300 lines):

diff -r 3e949cc11eba -r 82459e1b0262 hobu-config.bat
--- a/hobu-config.bat	Fri Dec 17 20:31:38 2010 -0800
+++ b/hobu-config.bat	Fri Dec 17 21:22:40 2010 -0800
@@ -7,6 +7,7 @@
 set OSGEO4W=C:\OSGeo4W
 set BOOST=D:\boost\boost_1_44
 set ORACLE_HOME=%OSGEO4W%
+set LASZIP_ROOT=A:\dev\zip
 REM set BUILD_TYPE=RelWithDebInfo
 REM set BUILD_TYPE=Debug
 set BUILD_TYPE=Release
@@ -18,6 +19,7 @@
     -DWITH_GDAL=ON ^
     -DWITH_GEOTIFF=ON ^
     -DWITH_ORACLE=ON ^
+    -DWITH_LASZIP=OFF ^
     -DTIFF_INCLUDE_DIR=%OSGEO4W%\include ^
     -DTIFF_LIBRARY=%OSGEO4W%\lib\libtiff_i.lib ^
     -DGEOTIFF_INCLUDE_DIR=%OSGEO4W%\include ^
@@ -26,6 +28,8 @@
     -DGDAL_LIBRARY=%OSGEO4W%\apps\gdal-dev\lib\gdal_i.lib ^
     -DORACLE_INCLUDE_DIR=%ORACLE_HOME%\include ^
     -DORACLE_OCI_LIBRARY=%ORACLE_HOME%\lib\oci.lib ^
+    -DLASZIP_INCLUDE_DIR=%LASZIP_ROOT%\include ^
+    -DLASZIP_LIBRARY=%LASZIP_ROOT%\bin\Debug\Debug\liblaszip.lib ^
     -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
     -DCMAKE_VERBOSE_MAKEFILE=ON ^
-    %LIBLAS%
\ No newline at end of file
+    %LIBLAS%
diff -r 3e949cc11eba -r 82459e1b0262 include/liblas/detail/reader/zipreader.hpp
--- a/include/liblas/detail/reader/zipreader.hpp	Fri Dec 17 20:31:38 2010 -0800
+++ b/include/liblas/detail/reader/zipreader.hpp	Fri Dec 17 21:22:40 2010 -0800
@@ -2,8 +2,8 @@
  * $Id$
  *
  * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  LAS 1.0 reader implementation for C++ libLAS 
- * Author:   Mateusz Loskot, mateusz at loskot.net
+ * Purpose:  laszip reader implementation for C++ libLAS 
+ * Author:   Michael P. Gerlek (mpog at flaxen.com)
  *
  ******************************************************************************
  * Copyright (c) 2010, Michael P. Gerlek
@@ -59,12 +59,12 @@
 typedef boost::shared_ptr< reader::Point > PointReaderPtr;
 typedef boost::shared_ptr< reader::Header > HeaderReaderPtr;
 
-class ZReaderImpl : public ReaderI
+class ZipReaderImpl : public ReaderI
 {
 public:
 
-    ZReaderImpl(std::istream& ifs);
-    ~ZReaderImpl();
+    ZipReaderImpl(std::istream& ifs);
+    ~ZipReaderImpl();
 
     void ReadHeader();
     liblas::Header const& GetHeader() const {return *m_header;}
@@ -104,12 +104,12 @@
 private:
 
     // Blocked copying operations, declared but not defined.
-    ZReaderImpl(ZReaderImpl const& other);
-    ZReaderImpl& operator=(ZReaderImpl const& rhs);
+    ZipReaderImpl(ZipReaderImpl const& other);
+    ZipReaderImpl& operator=(ZipReaderImpl const& rhs);
 };
 
 }} // namespace liblas::detail
 
-#endif
+#endif // HAVE_LASZIP
 
 #endif // LIBLAS_DETAIL_ZIPREADERIMPL_HPP_INCLUDED
diff -r 3e949cc11eba -r 82459e1b0262 include/liblas/detail/writer/zipwriter.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/liblas/detail/writer/zipwriter.hpp	Fri Dec 17 21:22:40 2010 -0800
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  laszip writer implementation 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.
+ ****************************************************************************/
+
+#ifndef LIBLAS_DETAIL_ZIPWRITER_HPP_INCLUDED
+#define LIBLAS_DETAIL_ZIPWRITER_HPP_INCLUDED
+
+#ifdef HAVE_LASZIP
+
+#include <liblas/detail/fwd.hpp>
+#include <liblas/liblas.hpp>
+#include <liblas/detail/writer/point.hpp>
+#include <liblas/detail/writer/header.hpp>
+// boost
+#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace liblas { namespace detail { 
+
+typedef boost::shared_ptr< writer::Point > PointWriterPtr;
+typedef boost::shared_ptr< writer::Header > HeaderWriterPtr;
+
+class ZipWriterImpl : public WriterI
+{
+public:
+
+    ZipWriterImpl(std::ostream& ofs);
+    ~ZipWriterImpl();
+    LASVersion GetVersion() const;
+    void WritePoint(liblas::Point const& record);
+
+    liblas::Header& GetHeader() const;
+    void WriteHeader();
+
+    void UpdatePointCount(boost::uint32_t count);
+    void SetHeader(liblas::Header const& header);
+    
+    void SetFilters(std::vector<liblas::FilterPtr> const& filters);
+    void SetTransforms(std::vector<liblas::TransformPtr> const& transforms);
+
+protected:
+
+    std::ostream& m_ofs;
+     
+    PointWriterPtr m_point_writer;
+    HeaderWriterPtr m_header_writer;
+
+    std::vector<liblas::FilterPtr> m_filters;
+    std::vector<liblas::TransformPtr> m_transforms;
+
+    HeaderPtr m_header;
+
+private:
+
+    boost::uint32_t m_pointCount;
+
+    // block copying operations
+    ZipWriterImpl(ZipWriterImpl const& other);
+    ZipWriterImpl& operator=(ZipWriterImpl const& other);
+};
+
+}} // namespace liblas::detail
+
+#endif // HAVE_LASZIP
+
+#endif // LIBLAS_DETAIL_ZIPWRITER_HPP_INCLUDED
diff -r 3e949cc11eba -r 82459e1b0262 include/liblas/factory.hpp
--- a/include/liblas/factory.hpp	Fri Dec 17 20:31:38 2010 -0800
+++ b/include/liblas/factory.hpp	Fri Dec 17 21:22:40 2010 -0800
@@ -89,7 +89,8 @@
     WriterFactory& operator=(WriterFactory const& rhs);    
 
     Writer CreateWithImpl(WriterIPtr w);
-    Writer CreateWithStream(std::ostream& stream);
+    Writer CreateWithStream(std::ostream& stream); // makes a WriterImpl
+    Writer CreateCompressedWithStream(std::ostream& stream); // makes ZipWriterImpl
     
     /// Destructor.
     /// @exception nothrow
diff -r 3e949cc11eba -r 82459e1b0262 include/liblas/lasversion.hpp
--- a/include/liblas/lasversion.hpp	Fri Dec 17 20:31:38 2010 -0800
+++ b/include/liblas/lasversion.hpp	Fri Dec 17 21:22:40 2010 -0800
@@ -92,6 +92,7 @@
 
 bool LAS_DLL IsGDALEnabled(void);
 bool LAS_DLL IsLibGeoTIFFEnabled(void);
+bool LAS_DLL IsLasZipEnabled(void);
 std::string LAS_DLL GetFullVersion(void);
 std::string LAS_DLL GetVersion(void);
 
diff -r 3e949cc11eba -r 82459e1b0262 src/CMakeLists.txt
--- a/src/CMakeLists.txt	Fri Dec 17 20:31:38 2010 -0800
+++ b/src/CMakeLists.txt	Fri Dec 17 21:22:40 2010 -0800
@@ -104,6 +104,7 @@
 
 set(LIBLAS_DETAIL_WRITER_HPP
   ${LIBLAS_HEADERS_DIR}/detail/writer/writer.hpp
+  ${LIBLAS_HEADERS_DIR}/detail/writer/zipwriter.hpp
   ${LIBLAS_HEADERS_DIR}/detail/writer/base.hpp
   ${LIBLAS_HEADERS_DIR}/detail/writer/point.hpp
   ${LIBLAS_HEADERS_DIR}/detail/writer/header.hpp)
@@ -146,6 +147,7 @@
   detail/writer/base.cpp
   detail/writer/header.cpp
   detail/writer/point.cpp
+  detail/writer/zipwriter.cpp
   detail/writer/writer.cpp)
 
 # Group source files for IDE source explorers (e.g. Visual Studio)
diff -r 3e949cc11eba -r 82459e1b0262 src/detail/reader/zipreader.cpp
--- a/src/detail/reader/zipreader.cpp	Fri Dec 17 20:31:38 2010 -0800
+++ b/src/detail/reader/zipreader.cpp	Fri Dec 17 21:22:40 2010 -0800
@@ -2,8 +2,8 @@
  * $Id$
  *
  * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  LAS 1.0 reader implementation for C++ libLAS 
- * Author:   Mateusz Loskot, mateusz at loskot.net
+ * Purpose:  laszip reader implementation for C++ libLAS 
+ * Author:   Michael P. Gerlek (mpg at flaxen.com)
  *
  ******************************************************************************
  * Copyright (c) 2010, Michael P. Gerlek
@@ -64,7 +64,7 @@
 namespace liblas { namespace detail { 
 
 
-ZReaderImpl::ZReaderImpl(std::istream& ifs)
+ZipReaderImpl::ZipReaderImpl(std::istream& ifs)
     : m_ifs(ifs)
     , m_size(0)
     , m_current(0)
@@ -78,11 +78,11 @@
     new LASunzipper();
 }
 
-ZReaderImpl::~ZReaderImpl()
+ZipReaderImpl::~ZipReaderImpl()
 {
 }
 
-void ZReaderImpl::Reset()
+void ZipReaderImpl::Reset()
 {
     m_ifs.clear();
     m_ifs.seekg(0);
@@ -99,7 +99,7 @@
     } 
 }
 
-void ZReaderImpl::TransformPoint(liblas::Point& p)
+void ZipReaderImpl::TransformPoint(liblas::Point& p)
 {    
 
     // Apply the transforms to each point
@@ -113,7 +113,7 @@
 }
 
 
-bool ZReaderImpl::FilterPoint(liblas::Point const& p)
+bool ZipReaderImpl::FilterPoint(liblas::Point const& p)
 {    
     // If there's no filters on this reader, we keep 
     // the point no matter what.
@@ -135,7 +135,7 @@
 
 
     
-void ZReaderImpl::ReadHeader()
+void ZipReaderImpl::ReadHeader()
 {
     // If we're eof, we need to reset the state
     if (m_ifs.eof())
@@ -149,12 +149,12 @@
 
 }
 
-void ZReaderImpl::SetHeader(liblas::Header const& header) 
+void ZipReaderImpl::SetHeader(liblas::Header const& header) 
 {
     m_header = HeaderPtr(new liblas::Header(header));
 }
     


More information about the Liblas-commits mailing list