[Liblas-commits] libpc: outdated, already moved

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Feb 24 13:56:05 EST 2011


details:   http://hg.liblas.orglibpc/rev/679773abbd15
changeset: 90:679773abbd15
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Feb 24 10:50:54 2011 -0800
description:
outdated, already moved
Subject: libpc: added libLAS support, added some config tests

details:   http://hg.liblas.orglibpc/rev/127025fd0a26
changeset: 91:127025fd0a26
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Feb 24 10:54:21 2011 -0800
description:
added libLAS support, added some config tests
Subject: libpc: stubbing in liblas support

details:   http://hg.liblas.orglibpc/rev/e3294e88851a
changeset: 92:e3294e88851a
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Feb 24 10:55:38 2011 -0800
description:
stubbing in liblas support

diffstat:

 .hgignore                      |    1 +
 CMakeLists.txt                 |   18 ++++++-
 apps/pc2pc.cpp                 |   12 ++--
 cmake/modules/FindLibLAS.cmake |  106 +++++++++++++++++++++++++++++++++++++++++
 include/libpc/LiblasHeader.hpp |   63 ++++++++++++++++++++++++
 include/libpc/LiblasReader.hpp |   75 +++++++++++++++++++++++++++++
 include/libpc/LiblasWriter.hpp |   69 ++++++++++++++++++++++++++
 include/libpc/libpc_config.hpp |   20 ++++---
 libpc_config.hpp               |   60 -----------------------
 libpc_defines.h.in             |    1 +
 mpg-config.bat                 |   10 ++-
 src/CMakeLists.txt             |    6 ++
 src/LiblasHeader.cpp           |   66 +++++++++++++++++++++++++
 src/LiblasReader.cpp           |   81 +++++++++++++++++++++++++++++++
 src/LiblasWriter.cpp           |   72 +++++++++++++++++++++++++++
 src/libpc_config.cpp           |   39 +++++++++++---
 test/unit/CMakeLists.txt       |    3 +
 test/unit/ConfigTest.cpp       |   63 ++++++++++++++++++++++++
 test/unit/LiblasReaderTest.cpp |   22 ++++++++
 test/unit/LiblasWriterTest.cpp |   30 +++++++++++
 20 files changed, 729 insertions(+), 88 deletions(-)

diffs (truncated from 1043 to 300 lines):

diff -r 93a80c037628 -r e3294e88851a .hgignore
--- a/.hgignore	Thu Feb 24 09:07:46 2011 -0800
+++ b/.hgignore	Thu Feb 24 10:55:38 2011 -0800
@@ -12,6 +12,7 @@
 CPackSourceConfig.cmake
 cmake_install.cmake
 CTestTestfile.cmake
+Testing/
 
 # visual studio cruft
 Debug/
diff -r 93a80c037628 -r e3294e88851a CMakeLists.txt
--- a/CMakeLists.txt	Thu Feb 24 09:07:46 2011 -0800
+++ b/CMakeLists.txt	Thu Feb 24 10:55:38 2011 -0800
@@ -272,7 +272,7 @@
 
 # LASZIP support - optional, default=OFF
 set(WITH_LASZIP FALSE CACHE BOOL "Choose if LASzip support should be built")
-set(WITH_STATIC_LASZIP FALSE CACHE BOOL "Choose of LASzip should be statically linked")
+set(WITH_STATIC_LASZIP FALSE CACHE BOOL "Choose if LASzip should be statically linked")
 mark_as_advanced(WITH_STATIC_LASZIP)
 
 if(WITH_LASZIP)
@@ -287,6 +287,22 @@
     endif()
 endif()
 
+# LIBLAS support - optional, default=OFF
+set(WITH_LIBLAS FALSE CACHE BOOL "Choose if libLAS support should be built")
+set(WITH_STATIC_LIBLAS FALSE CACHE BOOL "Choose if libLAS should be statically linked")
+mark_as_advanced(WITH_STATIC_LIBLAS)
+
+if(WITH_LIBLAS)
+    find_package(LibLAS 1.6.0)
+    if(LIBLAS_FOUND)
+        set(CMAKE_REQUIRED_LIBRARIES ${LIBLAS_LIBRARY})
+        include_directories(${LIBLAS_INCLUDE_DIR})
+        mark_as_advanced(CLEAR LIBLAS_INCLUDE_DIR) 
+        mark_as_advanced(CLEAR LIBLAS_LIBRARY) 
+        mark_as_advanced(CLEAR LIBLAS_VERSION) 
+        set(LIBPC_HAVE_LIBLAS 1)
+    endif()
+endif()
 
 
 
diff -r 93a80c037628 -r e3294e88851a apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Thu Feb 24 09:07:46 2011 -0800
+++ b/apps/pc2pc.cpp	Thu Feb 24 10:55:38 2011 -0800
@@ -100,16 +100,16 @@
     }
 
     {
-        const int major = getVersionMajor();
-        const int minor = getVersionMinor();
-        const int patch = getVersionPatch();
-        const int verInt = getVersionInteger();
+        const int major = GetVersionMajor();
+        const int minor = GetVersionMinor();
+        const int patch = GetVersionPatch();
+        const int verInt = GetVersionInteger();
         std::cout << "Version: " << major << " " << minor << " " << patch << " (" << verInt << ")" << std::endl;
 
-        const std::string verString = getVersionString();
+        const std::string verString = GetVersionString();
         std::cout << " string: " << verString << std::endl;
 
-        const std::string fullString = getFullVersion();
+        const std::string fullString = GetFullVersionString();
         std::cout << "Full version string: " << fullString << std::endl;
     }
 
diff -r 93a80c037628 -r e3294e88851a cmake/modules/FindLibLAS.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/modules/FindLibLAS.cmake	Thu Feb 24 10:55:38 2011 -0800
@@ -0,0 +1,106 @@
+###############################################################################
+#
+# CMake module to search for libLAS library
+#
+# On success, the macro sets the following variables:
+# LIBLAS_FOUND       = if the library found
+# LIBLAS_LIBRARIES   = full path to the library
+# LIBLAS_INCLUDE_DIR = where to find the library headers also defined,
+#                       but not for general use are
+# LIBLAS_LIBRARY     = where to find the PROJ.4 library.
+# LIBLAS_VERSION     = version of library which was found, e.g. "1.2.5"
+#
+# Copyright (c) 2009 Mateusz Loskot <mateusz at loskot.net>
+#
+# Module source: http://github.com/mloskot/workshop/tree/master/cmake/
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+###############################################################################
+MESSAGE(STATUS "Searching for libPC ${LibPC_FIND_VERSION}+ library")
+
+IF(LIBLAS_INCLUDE_DIR)
+  # Already in cache, be silent
+  SET(LIBLAS_FIND_QUIETLY TRUE)
+ENDIF()
+
+IF(WIN32)
+  SET(OSGEO4W_IMPORT_LIBRARY liblas)
+  IF(DEFINED ENV{OSGEO4W_ROOT})
+    SET(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT})
+    MESSAGE(STATUS "Trying OSGeo4W using environment variable OSGEO4W_ROOT=$ENV{OSGEO4W_ROOT}")
+  ELSE()
+    SET(OSGEO4W_ROOT_DIR c:/OSGeo4W)
+    MESSAGE(STATUS "Trying OSGeo4W using default location OSGEO4W_ROOT=${OSGEO4W_ROOT_DIR}")
+  ENDIF()
+ENDIF()
+
+
+FIND_PATH(LIBLAS_INCLUDE_DIR
+  liblas.hpp
+  PATH_PREFIXES liblas
+  PATHS
+  /usr/include
+  /usr/local/include
+  /tmp/lasjunk/include
+  ${OSGEO4W_ROOT_DIR}/include)
+
+SET(LIBLAS_NAMES ${OSGEO4W_IMPORT_LIBRARY} liblas)
+
+FIND_LIBRARY(LIBLAS_LIBRARY
+  NAMES ${LIBLAS_NAMES}
+  PATHS
+  /usr/lib
+  /usr/local/lib
+  /tmp/lasjunk/lib
+  ${OSGEO4W_ROOT_DIR}/lib)
+
+IF(LIBLAS_FOUND)
+  SET(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY})
+ENDIF()
+
+IF(LIBLAS_INCLUDE_DIR)
+  SET(LIBLAS_VERSION 0)
+
+  SET(LIBLAS_VERSION_H "${LIBLAS_INCLUDE_DIR}/liblas/version.hpp")
+  FILE(READ ${LIBLAS_VERSION_H} LIBLAS_VERSION_H_CONTENTS)
+
+  IF (DEFINED LIBLAS_VERSION_H_CONTENTS)
+  
+    # string will be something like "106000", which is xyyzzz (x=major, y=minor, z=patch)
+    string(REGEX REPLACE ".*#define[ \t]LIBLAS_VERSION[ \t]+([0-9]).*" "\\1" LIBLAS_VERSION_MAJOR "${LIBLAS_VERSION_H_CONTENTS}")
+    string(REGEX REPLACE ".*#define[ \t]LIBLAS_VERSION[ \t]+[0-9]([0-9][0-9]).*" "\\1" LIBLAS_VERSION_MINOR "${LIBLAS_VERSION_H_CONTENTS}")
+    string(REGEX REPLACE ".*#define[ \t]LIBLAS_VERSION[ \t]+[0-9][0-9][0-9]([0-9][0-9][0-9]).*"   "\\1" LIBLAS_VERSION_PATCH   "${LIBLAS_VERSION_H_CONTENTS}")
+    #message(FATAL_ERROR "${LIBLAS_VERSION_MAJOR}.${LIBLAS_VERSION_MINOR}.${LIBLAS_VERSION_PATCH}")
+
+    if(NOT ${LIBLAS_VERSION_MAJOR} MATCHES "[0-9]+")
+      message(FATAL_ERROR "libPC version parsing failed for LIBLAS_VERSION_MAJOR!")
+    endif()
+    if(NOT ${LIBLAS_VERSION_MINOR} MATCHES "[0-9]+")
+      message(FATAL_ERROR "libPC version parsing failed for LIBLAS_VERSION_MINOR!")
+    endif()
+    if(NOT ${LIBLAS_VERSION_PATCH} MATCHES "[0-9]+")
+      message(FATAL_ERROR "libPC version parsing failed for LIBLAS_VERSION_PATCH!")
+    endif()
+
+
+    SET(LIBLAS_VERSION "${LIBLAS_VERSION_MAJOR}.${LIBLAS_VERSION_MINOR}.${LIBLAS_VERSION_PATCH}"
+      CACHE INTERNAL "The version string for libLAS library")
+
+    IF (LIBLAS_VERSION VERSION_EQUAL LibLAS_FIND_VERSION OR
+        LIBLAS_VERSION VERSION_GREATER LibLAS_FIND_VERSION)
+      MESSAGE(STATUS "Found libPC version: ${LIBLAS_VERSION}")
+    ELSE()
+      MESSAGE(FATAL_ERROR "libPC version check failed. Version ${LIBLAS_VERSION} was found, at least version ${LibLAS_FIND_VERSION} is required")
+    ENDIF()
+  ELSE()
+    MESSAGE(FATAL_ERROR "Failed to open ${LIBLAS_VERSION_H} file")
+  ENDIF()
+
+ENDIF()
+
+# Handle the QUIETLY and REQUIRED arguments and set LIBLAS_FOUND to TRUE
+# if all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(libLAS DEFAULT_MSG LIBLAS_LIBRARY LIBLAS_INCLUDE_DIR)
diff -r 93a80c037628 -r e3294e88851a include/libpc/LiblasHeader.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/LiblasHeader.hpp	Thu Feb 24 10:55:38 2011 -0800
@@ -0,0 +1,63 @@
+/******************************************************************************
+* Copyright (c) 2011, Michael P. Gerlek (mpg at flaxen.com)
+*
+* 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 Hobu, Inc. or Flaxen Geo Consulting 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 INCLUDED_LIBLASHEADER_HPP
+#define INCLUDED_LIBLASHEADER_HPP
+
+#include <iostream>
+#include <string>
+
+#include <boost/cstdint.hpp>
+#include <boost/uuid/uuid.hpp>
+
+#include "libpc/Header.hpp"
+
+namespace libpc
+{
+
+class LIBPC_DLL LiblasHeader : public Header
+{
+public:
+    LiblasHeader();
+    
+private:
+    LiblasHeader& operator=(const LiblasHeader&); // nope
+    LiblasHeader(const LiblasHeader&); // nope
+};
+
+LIBPC_DLL std::ostream& operator<<(std::ostream& ostr, const LiblasHeader&);
+
+} // namespace libpc
+
+#endif
diff -r 93a80c037628 -r e3294e88851a include/libpc/LiblasReader.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/LiblasReader.hpp	Thu Feb 24 10:55:38 2011 -0800
@@ -0,0 +1,75 @@
+/******************************************************************************
+* Copyright (c) 2011, Michael P. Gerlek (mpg at flaxen.com)
+*
+* 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 Hobu, Inc. or Flaxen Geo Consulting 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 INCLUDED_LIBLASREADER_HPP
+#define INCLUDED_LIBLASREADER_HPP
+
+#include <iostream>
+
+#include "libpc/Reader.hpp"
+#include "libpc/LiblasHeader.hpp"
+
+namespace libpc
+{
+
+class LIBPC_DLL LiblasReader : public Reader
+{


More information about the Liblas-commits mailing list