[Liblas-commits] hg: refactor the zip point support code;
add laszip VLR reading/...
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jan 3 13:37:27 EST 2011
details: http://hg.liblas.orghg/rev/fa6834d7fbf1
changeset: 2669:fa6834d7fbf1
user: Michael P. Gerlek <mpg at flaxen.com>
date: Mon Jan 03 09:53:30 2011 -0800
description:
refactor the zip point support code; add laszip VLR reading/writing
Subject: hg: cleanup I/O, added endiannessing
details: http://hg.liblas.orghg/rev/61dcbb1101c4
changeset: 2670:61dcbb1101c4
user: Michael P. Gerlek <mpg at flaxen.com>
date: Mon Jan 03 10:16:57 2011 -0800
description:
cleanup I/O, added endiannessing
Subject: hg: pull-merge
details: http://hg.liblas.orghg/rev/c43faf6300aa
changeset: 2671:c43faf6300aa
user: Michael P. Gerlek <mpg at flaxen.com>
date: Mon Jan 03 10:17:30 2011 -0800
description:
pull-merge
Subject: hg: VS2010 lint
details: http://hg.liblas.orghg/rev/5fae42ddbc14
changeset: 2672:5fae42ddbc14
user: Michael P. Gerlek <mpg at flaxen.com>
date: Mon Jan 03 10:35:29 2011 -0800
description:
VS2010 lint
diffstat:
CMakeLists.txt | 5 +-
apps/CMakeLists.txt | 12 +-
apps/lasblock.cpp | 2 +-
apps/liblas-config.in | 4 +-
include/liblas/detail/reader/zipreader.hpp | 9 +-
include/liblas/detail/writer/zipwriter.hpp | 9 +-
include/liblas/detail/zippoint.hpp | 90 ++++++
include/liblas/spatialreference.hpp | 2 +-
src/CMakeLists.txt | 6 +-
src/c_api.cpp | 9 +-
src/detail/reader/header.cpp | 13 +-
src/detail/reader/zipreader.cpp | 94 +------
src/detail/writer/header.cpp | 14 +
src/detail/writer/zipwriter.cpp | 85 +-----
src/detail/zippoint.cpp | 375 +++++++++++++++++++++++++++++
src/spatialreference.cpp | 8 +-
16 files changed, 549 insertions(+), 188 deletions(-)
diffs (truncated from 1061 to 300 lines):
diff -r 20328697f704 -r 5fae42ddbc14 CMakeLists.txt
--- a/CMakeLists.txt Thu Dec 30 15:25:24 2010 -0600
+++ b/CMakeLists.txt Mon Jan 03 10:35:29 2011 -0800
@@ -400,9 +400,10 @@
SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
+
set(CPACK_SOURCE_PACKAGE_FILE_NAME
- "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-
+ "${CMAKE_PROJECT_NAME}-${VERSION}")
+
list(APPEND CPACK_SOURCE_IGNORE_FILES "/test/data/TO_core_last_zoom.las")
list(APPEND CPACK_SOURCE_IGNORE_FILES "_CPack_Packages")
list(APPEND CPACK_SOURCE_IGNORE_FILES ".gz")
diff -r 20328697f704 -r 5fae42ddbc14 apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Thu Dec 30 15:25:24 2010 -0600
+++ b/apps/CMakeLists.txt Mon Jan 03 10:35:29 2011 -0800
@@ -218,10 +218,18 @@
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
-
+
+ GET_DIRECTORY_PROPERTY(LIBLAS_DEFINITIONS DIRECTORY ${libLAS_SOURCE_DIR}/ COMPILE_DEFINITIONS)
+
+ set(LIBLAS_CONFIG_DEFINITIONS "")
+ foreach(definition ${LIBLAS_DEFINITIONS})
+ set(LIBLAS_CONFIG_DEFINITIONS "${LIBLAS_CONFIG_DEFINITIONS} -D${definition}")
+ endforeach()
+
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liblas-config.in
${CMAKE_CURRENT_BINARY_DIR}/liblas-config @ONLY)
-
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas-config
DESTINATION bin/
PERMISSIONS
diff -r 20328697f704 -r 5fae42ddbc14 apps/lasblock.cpp
--- a/apps/lasblock.cpp Thu Dec 30 15:25:24 2010 -0600
+++ b/apps/lasblock.cpp Mon Jan 03 10:35:29 2011 -0800
@@ -144,7 +144,7 @@
}
void write_index(std::string& output,
liblas::chipper::Chipper& c,
- liblas::Reader& reader,
+ liblas::Reader& /*reader*/,
long precision,
bool verbose)
{
diff -r 20328697f704 -r 5fae42ddbc14 apps/liblas-config.in
--- a/apps/liblas-config.in Thu Dec 30 15:25:24 2010 -0600
+++ b/apps/liblas-config.in Mon Jan 03 10:35:29 2011 -0800
@@ -95,7 +95,7 @@
;;
--defines)
- echo
+ echo @LIBLAS_CONFIG_DEFINITIONS@
;;
--includes)
@@ -103,7 +103,7 @@
;;
--cflags)
- echo -I${prefix}/include
+ echo @CMAKE_C_FLAGS@
;;
--cxxflags)
diff -r 20328697f704 -r 5fae42ddbc14 include/liblas/detail/reader/zipreader.hpp
--- a/include/liblas/detail/reader/zipreader.hpp Thu Dec 30 15:25:24 2010 -0600
+++ b/include/liblas/detail/reader/zipreader.hpp Mon Jan 03 10:35:29 2011 -0800
@@ -46,7 +46,6 @@
#include <liblas/detail/fwd.hpp>
#include <liblas/detail/reader/header.hpp>
-#include <liblas/liblas.hpp>
// boost
#include <boost/cstdint.hpp>
// std
@@ -59,6 +58,7 @@
namespace liblas { namespace detail {
+class ZipPoint;
typedef boost::shared_ptr< reader::Header > HeaderReaderPtr;
class ZipReaderImpl : public ReaderI
@@ -101,15 +101,10 @@
std::vector<liblas::TransformPtr> m_transforms;
private:
- void ConstructItems();
void ReadIdiom();
LASunzipper* m_unzipper;
- unsigned int m_num_items;
- LASitem* m_items;
- unsigned char** m_lz_point;
- unsigned char* m_lz_point_data;
- unsigned int m_lz_point_size;
+ ZipPoint* m_zipPoint;
// Blocked copying operations, declared but not defined.
ZipReaderImpl(ZipReaderImpl const& other);
diff -r 20328697f704 -r 5fae42ddbc14 include/liblas/detail/writer/zipwriter.hpp
--- a/include/liblas/detail/writer/zipwriter.hpp Thu Dec 30 15:25:24 2010 -0600
+++ b/include/liblas/detail/writer/zipwriter.hpp Mon Jan 03 10:35:29 2011 -0800
@@ -58,6 +58,7 @@
namespace liblas { namespace detail {
+class ZipPoint;
typedef boost::shared_ptr< writer::Point > PointWriterPtr;
typedef boost::shared_ptr< writer::Header > HeaderWriterPtr;
@@ -94,14 +95,8 @@
private:
boost::uint32_t m_pointCount;
- void ConstructItems();
-
LASzipper* m_zipper;
- unsigned int m_num_items;
- LASitem* m_items;
- unsigned char** m_lz_point;
- unsigned char* m_lz_point_data;
- unsigned int m_lz_point_size;
+ ZipPoint* m_zipPoint;
// block copying operations
ZipWriterImpl(ZipWriterImpl const& other);
diff -r 20328697f704 -r 5fae42ddbc14 include/liblas/detail/zippoint.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/liblas/detail/zippoint.hpp Mon Jan 03 10:35:29 2011 -0800
@@ -0,0 +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.
+ ****************************************************************************/
+
+#ifndef LIBLAS_DETAIL_ZIPPOINT_HPP_INCLUDED
+#define LIBLAS_DETAIL_ZIPPOINT_HPP_INCLUDED
+
+#ifdef HAVE_LASZIP
+
+#include <liblas/detail/fwd.hpp>
+#include <liblas/liblas.hpp>
+
+// boost
+#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
+
+// liblaszip
+class LASzipper;
+class LASitem;
+
+namespace liblas { namespace detail {
+
+class ZipPoint
+{
+public:
+ ZipPoint(PointFormatName);
+ ~ZipPoint();
+
+ void ConstructVLR(VariableRecord&) const;
+
+ // these will return false iff we find a laszip VLR and it doesn't match
+ // the point format this object wasd constructed with
+ bool ValidateVLR(std::vector<VariableRecord> const& vlrs) const;
+ bool ValidateVLR(const VariableRecord& vlr) const;
+
+ bool IsZipVLR(const VariableRecord& vlr) const;
+
+private:
+ void ConstructItems(PointFormatName);
+
+public: // for now
+ unsigned int m_num_items;
+ LASitem* m_items;
+ unsigned char** m_lz_point;
+ unsigned char* m_lz_point_data;
+ unsigned int m_lz_point_size;
+};
+
+}} // namespace liblas::detail
+
+#endif // HAVE_LASZIP
+
+#endif // LIBLAS_DETAIL_ZIPPOINT_HPP_INCLUDED
diff -r 20328697f704 -r 5fae42ddbc14 include/liblas/spatialreference.hpp
--- a/include/liblas/spatialreference.hpp Thu Dec 30 15:25:24 2010 -0600
+++ b/include/liblas/spatialreference.hpp Mon Jan 03 10:35:29 2011 -0800
@@ -101,7 +101,7 @@
/// you have libgeotiff linked in.
const GTIF* GetGTIF();
- void SetGTIF(const GTIF* pgtiff, const ST_TIFF* ptiff);
+ void SetGTIF(GTIF* pgtiff, ST_TIFF* ptiff);
/// Returns the OGC WKT describing Spatial Reference System.
/// If GDAL is linked, it uses GDAL's operations and methods to determine
diff -r 20328697f704 -r 5fae42ddbc14 src/CMakeLists.txt
--- a/src/CMakeLists.txt Thu Dec 30 15:25:24 2010 -0600
+++ b/src/CMakeLists.txt Mon Jan 03 10:35:29 2011 -0800
@@ -88,7 +88,8 @@
${LIBLAS_HEADERS_DIR}/detail/pointrecord.hpp
${LIBLAS_HEADERS_DIR}/detail/sha1.hpp
${LIBLAS_HEADERS_DIR}/detail/timer.hpp
- ${LIBLAS_HEADERS_DIR}/detail/private_utility.hpp)
+ ${LIBLAS_HEADERS_DIR}/detail/private_utility.hpp
+ ${LIBLAS_HEADERS_DIR}/detail/zippoint.hpp)
set(LIBLAS_DETAIL_INDEX_HPP
${LIBLAS_HEADERS_DIR}/detail/index/indexoutput.hpp
@@ -129,7 +130,8 @@
version.cpp)
set(LIBLAS_DETAIL_CPP
- detail/utility.cpp)
+ detail/utility.cpp
+ detail/zippoint.cpp)
set(LIBLAS_DETAIL_INDEX_CPP
detail/index/indexcell.cpp
diff -r 20328697f704 -r 5fae42ddbc14 src/c_api.cpp
--- a/src/c_api.cpp Thu Dec 30 15:25:24 2010 -0600
+++ b/src/c_api.cpp Mon Jan 03 10:35:29 2011 -0800
@@ -136,6 +136,7 @@
#ifdef _MSC_VER
# pragma warning(disable: 4127) // warning C4127: conditional expression is constant
+# pragma warning(disable: 4702) // unreachable code
#endif
#define VALIDATE_LAS_POINTER0(ptr, func) \
@@ -1900,7 +1901,12 @@
VALIDATE_LAS_POINTER1(pgtiff, "LASSRS_SetGTIF", LE_Failure);
VALIDATE_LAS_POINTER1(ptiff, "LASSRS_SetGTIF", LE_Failure);
try {
- ((liblas::SpatialReference*) hSRS)->SetGTIF((const GTIF*)pgtiff, (const ST_TIFF*) ptiff);
+ const GTIF* cgtiff = static_cast<const GTIF*>(pgtiff);
+ const ST_TIFF* ctiff = static_cast<const ST_TIFF*>(ptiff);
+ GTIF* gtiff = const_cast<GTIF*>(cgtiff);
+ ST_TIFF* tiff = const_cast<ST_TIFF*>(ctiff);
+
+ ((liblas::SpatialReference*) hSRS)->SetGTIF(gtiff, tiff);
}
catch (std::exception const& e) {
LASError_PushError(LE_Failure, e.what(), "LASSRS_SetGTIF");
@@ -2126,4 +2132,5 @@
#ifdef _MSC_VER
# pragma warning(default: 4127) // enable warning C4127: conditional expression is constant
+# pragma warning(default: 4702) // unreachable code
#endif
diff -r 20328697f704 -r 5fae42ddbc14 src/detail/reader/header.cpp
--- a/src/detail/reader/header.cpp Thu Dec 30 15:25:24 2010 -0600
+++ b/src/detail/reader/header.cpp Mon Jan 03 10:35:29 2011 -0800
@@ -43,6 +43,7 @@
More information about the Liblas-commits
mailing list