[Liblas-commits] libpc: rationalize placement of drivers,
public headers
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Mar 15 15:02:33 EDT 2011
details: http://hg.liblas.orglibpc/rev/67a6ad5470c9
changeset: 241:67a6ad5470c9
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 15 15:02:00 2011 -0400
description:
rationalize placement of drivers, public headers
Subject: libpc: merge
details: http://hg.liblas.orglibpc/rev/873d1b6d1bf1
changeset: 242:873d1b6d1bf1
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Mar 15 15:02:28 2011 -0400
description:
merge
diffstat:
.hgignore | 2 +
CMakeLists.txt | 8 +-
apps/CMakeLists.txt | 2 -
apps/pc2pc.cpp | 10 +-
apps/pcinfo.cpp | 4 +-
include/libpc/Chipper.hpp | 142 ++++
include/libpc/FauxReader.hpp | 84 --
include/libpc/FauxWriter.hpp | 90 ---
include/libpc/LasHeader.hpp | 414 --------------
include/libpc/LasHeaderReader.hpp | 76 --
include/libpc/LasHeaderWriter.hpp | 74 --
include/libpc/LasReader.hpp | 74 --
include/libpc/LasWriter.hpp | 69 --
include/libpc/chipper.hpp | 142 ----
include/libpc/drivers/faux/Reader.hpp | 84 ++
include/libpc/drivers/faux/Writer.hpp | 90 +++
include/libpc/drivers/las/Header.hpp | 414 ++++++++++++++
include/libpc/drivers/las/Reader.hpp | 74 ++
include/libpc/drivers/las/Writer.hpp | 69 ++
include/libpc/drivers/liblas/header.hpp | 63 ++
include/libpc/drivers/liblas/reader.hpp | 102 +++
include/libpc/drivers/liblas/writer.hpp | 95 +++
include/libpc/drivers/oci/reader.hpp | 74 ++
include/libpc/drivers/oci/writer.hpp | 120 ++++
src/CMakeLists.txt | 57 +-
src/Chipper.cpp | 390 +++++++++++++
src/FauxReader.cpp | 168 -----
src/FauxWriter.cpp | 129 ----
src/LasHeader.cpp | 929 --------------------------------
src/LasHeaderReader.cpp | 454 ---------------
src/LasHeaderWriter.cpp | 398 -------------
src/LasReader.cpp | 253 --------
src/LasWriter.cpp | 254 --------
src/chipper.cpp | 390 -------------
src/drivers/CMakeLists.txt | 4 +-
src/drivers/faux/CMakeLists.txt | 19 +
src/drivers/faux/Reader.cpp | 168 +++++
src/drivers/faux/Writer.cpp | 129 ++++
src/drivers/las/CMakeLists.txt | 18 +-
src/drivers/las/Header.cpp | 929 ++++++++++++++++++++++++++++++++
src/drivers/las/LasHeaderReader.cpp | 454 +++++++++++++++
src/drivers/las/LasHeaderReader.hpp | 76 ++
src/drivers/las/LasHeaderWriter.cpp | 398 +++++++++++++
src/drivers/las/LasHeaderWriter.hpp | 74 ++
src/drivers/las/Reader.cpp | 253 ++++++++
src/drivers/las/Writer.cpp | 254 ++++++++
src/drivers/liblas/CMakeLists.txt | 8 +-
src/drivers/liblas/header.cpp | 2 +-
src/drivers/liblas/header.hpp | 63 --
src/drivers/liblas/reader.cpp | 4 +-
src/drivers/liblas/reader.hpp | 102 ---
src/drivers/liblas/writer.cpp | 4 +-
src/drivers/liblas/writer.hpp | 95 ---
src/drivers/oci/CMakeLists.txt | 7 +-
src/drivers/oci/reader.hpp | 74 --
src/drivers/oci/writer.hpp | 120 ----
56 files changed, 4553 insertions(+), 4500 deletions(-)
diffs (truncated from 9412 to 300 lines):
diff -r 298237820520 -r 873d1b6d1bf1 .hgignore
--- a/.hgignore Tue Mar 15 13:44:03 2011 -0400
+++ b/.hgignore Tue Mar 15 15:02:28 2011 -0400
@@ -32,3 +32,5 @@
# generated swig files
csharp/libpc_swig_cs/*.cs
csharp/libpc_swig_cpp/libpc_wrap.cpp
+
+Makefile
diff -r 298237820520 -r 873d1b6d1bf1 CMakeLists.txt
--- a/CMakeLists.txt Tue Mar 15 13:44:03 2011 -0400
+++ b/CMakeLists.txt Tue Mar 15 15:02:28 2011 -0400
@@ -310,8 +310,7 @@
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)
+find_package(LibLAS 1.6.0)
if(LIBLAS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${LIBLAS_LIBRARY})
include_directories(${LIBLAS_INCLUDE_DIR})
@@ -320,10 +319,13 @@
mark_as_advanced(CLEAR LIBLAS_VERSION)
set(LIBPC_HAVE_LIBLAS 1)
endif()
+
+if (NOT LIBLAS_FOUND)
+ message(FATAL_ERROR
+ "libPC currently requires a working libLAS installation 1.6.0 or greater")
endif()
-
#------------------------------------------------------------------------------
# installation path settings
#------------------------------------------------------------------------------
diff -r 298237820520 -r 873d1b6d1bf1 apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Tue Mar 15 13:44:03 2011 -0400
+++ b/apps/CMakeLists.txt Tue Mar 15 15:02:28 2011 -0400
@@ -85,8 +85,6 @@
# if(WITH_GDAL)
# set(PKGCFG_INC_DIR "${PKGCFG_INC_DIR} ${GDAL_INCLUDE_DIR}")
# endif()
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpc.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/libpc.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpc.pc
DESTINATION ${LIBPC_LIB_DIR}/pkgconfig
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
diff -r 298237820520 -r 873d1b6d1bf1 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Tue Mar 15 13:44:03 2011 -0400
+++ b/apps/pc2pc.cpp Tue Mar 15 15:02:28 2011 -0400
@@ -23,16 +23,16 @@
//#include "libpc/MosaicFilter.hpp"
//#include "libpc/FauxReader.hpp"
//#include "libpc/FauxWriter.hpp"
-#include "libpc/LasReader.hpp"
+#include "libpc/drivers/las/Reader.hpp"
//#include "libpc/LasHeader.hpp"
-#include "libpc/LasWriter.hpp"
+#include "libpc/drivers/las/Writer.hpp"
#include "libpc/CacheFilter.hpp"
-#include "libpc/../../src/drivers/liblas/writer.hpp"
-#include "libpc/../../src/drivers/liblas/reader.hpp"
+#include "libpc/drivers/liblas/writer.hpp"
+#include "libpc/drivers/liblas/reader.hpp"
#ifdef HAVE_ORACLE
-#include "libpc/../../src/drivers/oci/writer.hpp"
+#include "libpc/drivers/oci/writer.hpp"
#endif
#include "Application.hpp"
diff -r 298237820520 -r 873d1b6d1bf1 apps/pcinfo.cpp
--- a/apps/pcinfo.cpp Tue Mar 15 13:44:03 2011 -0400
+++ b/apps/pcinfo.cpp Tue Mar 15 15:02:28 2011 -0400
@@ -10,8 +10,8 @@
**************************************************************************/
-#include "libpc/LasReader.hpp"
-#include "libpc/../../src/drivers/liblas/reader.hpp"
+#include "libpc/drivers/las/Reader.hpp"
+#include "libpc/drivers/liblas/reader.hpp"
#include <iostream>
diff -r 298237820520 -r 873d1b6d1bf1 include/libpc/Chipper.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/Chipper.hpp Tue Mar 15 15:02:28 2011 -0400
@@ -0,0 +1,142 @@
+#ifndef LIBLAS_CHIPPER_H
+#define LIBLAS_CHIPPER_H
+
+#include <libpc/Stage.hpp>
+#include <libpc/Bounds.hpp>
+#include <libpc/export.hpp>
+#include <libpc/Dimension.hpp>
+
+#include <vector>
+
+namespace libpc
+{
+
+namespace chipper
+{
+
+enum Direction
+{
+ DIR_X,
+ DIR_Y,
+ DIR_NONE
+};
+
+class LIBPC_DLL PtRef
+{
+public:
+ double m_pos;
+ boost::uint32_t m_ptindex;
+ boost::uint32_t m_oindex;
+
+ bool operator < (const PtRef& pt) const
+ { return m_pos < pt.m_pos; }
+};
+
+struct LIBPC_DLL RefList
+{
+public:
+ std::vector<PtRef> m_vec;
+ Direction m_dir;
+
+ RefList(Direction dir = DIR_NONE) : m_dir(dir)
+ {}
+ std::vector<PtRef>::size_type size() const
+ { return m_vec.size(); }
+ void reserve(std::vector<PtRef>::size_type n)
+ { m_vec.reserve(n); }
+ void resize(std::vector<PtRef>::size_type n)
+ { m_vec.resize(n); }
+ void push_back(const PtRef& ref)
+ { m_vec.push_back(ref); }
+ std::vector<PtRef>::iterator begin()
+ { return m_vec.begin(); }
+ std::vector<PtRef>::iterator end()
+ { return m_vec.end(); }
+ PtRef& operator[](boost::uint32_t pos)
+ { return m_vec[pos]; }
+ std::string Dir()
+ {
+ if (m_dir == DIR_X)
+ return "X";
+ else if (m_dir == DIR_Y)
+ return "Y";
+ else
+ return "NONE";
+ }
+};
+
+class LIBPC_DLL Chipper;
+
+class LIBPC_DLL Block
+{
+ friend class Chipper;
+
+private:
+ RefList *m_list_p;
+ boost::uint32_t m_left;
+ boost::uint32_t m_right;
+ libpc::Bounds<double> m_bounds;
+ // double m_xmin;
+ // double m_ymin;
+ // double m_xmax;
+ // double m_ymax;
+
+public:
+ std::vector<boost::uint32_t> GetIDs() const;
+ libpc::Bounds<double> const& GetBounds() const {return m_bounds;}
+ void SetBounds(libpc::Bounds<double> const& bounds) {m_bounds = bounds;}
+ // double GetXmin() const
+ // { return m_xmin; }
+ // double GetYmin() const
+ // { return m_ymin; }
+ // double GetXmax() const
+ // { return m_xmax; }
+ // double GetYmax() const
+ // { return m_ymax; }
+};
+
+class LIBPC_DLL Chipper
+{
+public:
+ Chipper(Stage& prevStage, boost::uint32_t max_partition_size) :
+ m_stage(prevStage), m_threshold(max_partition_size),
+ m_xvec(DIR_X), m_yvec(DIR_Y), m_spare(DIR_NONE)
+ {}
+
+ void Chip();
+ std::vector<Block>::size_type GetBlockCount()
+ { return m_blocks.size(); }
+ const Block& GetBlock(std::vector<Block>::size_type i)
+ { return m_blocks[i]; }
+
+private:
+ void Load(RefList& xvec, RefList& yvec, RefList& spare);
+ void Partition(boost::uint32_t size);
+ void Split(RefList& xvec, RefList& yvec, RefList& spare);
+ void DecideSplit(RefList& v1, RefList& v2, RefList& spare,
+ boost::uint32_t left, boost::uint32_t right);
+ void Split(RefList& wide, RefList& narrow, RefList& spare,
+ boost::uint32_t left, boost::uint32_t right);
+ void FinalSplit(RefList& wide, RefList& narrow,
+ boost::uint32_t pleft, boost::uint32_t pcenter);
+ void Emit(RefList& wide, boost::uint32_t widemin, boost::uint32_t widemax,
+ RefList& narrow, boost::uint32_t narrowmin, boost::uint32_t narrowmax );
+
+ // Reader *m_reader;
+ Stage& m_stage;
+ boost::uint32_t m_threshold;
+ std::vector<Block> m_blocks;
+ std::vector<boost::uint32_t> m_partitions;
+ RefList m_xvec;
+ RefList m_yvec;
+ RefList m_spare;
+
+ Chipper& operator=(const Chipper&); // not implemented
+ Chipper(const Chipper&); // not implemented
+};
+
+} // namespace chipper
+
+} // namespace liblas
+
+#endif
diff -r 298237820520 -r 873d1b6d1bf1 include/libpc/FauxReader.hpp
--- a/include/libpc/FauxReader.hpp Tue Mar 15 13:44:03 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/******************************************************************************
-* 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_FAUXREADER_HPP
-#define INCLUDED_FAUXREADER_HPP
-
-#include "libpc/Producer.hpp"
-
-namespace libpc
-{
-
-// The FauxReader doesn't read from disk, but instead just makes up data for its
-// points. The reader is constructed with a given bounding box and a given
-// number of points.
-//
-// This reader knows about 4 fields (Dimensions):
-// X,Y,Z - floats
-// Time - uint64
-//
-// It supports two modes: "random" generates points that are randomly
-// distributed within the given bounding box, and "constant" generates its
-// points to always be at the minimum of the bounding box. The Time field
-// is always set to the point number.
-//
-class LIBPC_DLL FauxReader : public Producer
-{
-public:
- enum Mode
- {
- Constant,
- Random
More information about the Liblas-commits
mailing list