[Liblas-commits] hg-main-tree: removed Reader class;
add some iter support code
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Mar 17 13:26:48 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/898dbce5a9b9
changeset: 332:898dbce5a9b9
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 17 13:12:31 2011 -0400
description:
removed Reader class; add some iter support code
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/517a086b3e6e
changeset: 333:517a086b3e6e
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 17 13:12:51 2011 -0400
description:
merge
Subject: hg-main-tree: repair init order
details: http://hg.libpc.orghg-main-tree/rev/9821c483080e
changeset: 334:9821c483080e
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 17 13:26:18 2011 -0400
description:
repair init order
diffstat:
apps/pcinfo.cpp | 2 +-
cmake/modules/FindMrSID.cmake | 58 ++++++++++++++++++++++++++++++
include/libpc/Iterator.hpp | 14 ++++---
include/libpc/Reader.hpp | 56 ----------------------------
include/libpc/Stage.hpp | 14 ++++--
include/libpc/Writer.hpp | 2 +-
include/libpc/drivers/faux/Reader.hpp | 6 ++-
include/libpc/drivers/las/Reader.hpp | 6 ++-
include/libpc/drivers/liblas/Reader.hpp | 6 ++-
include/libpc/filters/CacheFilter.hpp | 2 +
include/libpc/filters/ColorFilter.hpp | 2 +
include/libpc/filters/CropFilter.hpp | 2 +
include/libpc/filters/DecimationFilter.hpp | 2 +
include/libpc/filters/MosaicFilter.hpp | 2 +
src/CMakeLists.txt | 4 +-
src/Iterator.cpp | 3 +-
src/Reader.cpp | 48 ------------------------
src/drivers/CMakeLists.txt | 4 ++
src/drivers/faux/Reader.cpp | 10 ++++-
src/drivers/las/Reader.cpp | 12 +++++-
src/drivers/liblas/Reader.cpp | 11 ++++-
src/drivers/oci/Writer.cpp | 4 +-
src/filters/CacheFilter.cpp | 8 ++++
src/filters/ColorFilter.cpp | 7 +++
src/filters/CropFilter.cpp | 12 +++++-
src/filters/DecimationFilter.cpp | 8 ++++
src/filters/MosaicFilter.cpp | 14 ++++++-
test/unit/CacheFilterTest.cpp | 11 ++---
test/unit/ChipperTest.cpp | 4 +-
test/unit/LiblasReaderTest.cpp | 5 +-
test/unit/LiblasWriterTest.cpp | 10 ++---
test/unit/main.cpp | 47 ++----------------------
test/unit/support.cpp | 13 ++++++
test/unit/support.hpp | 5 ++
34 files changed, 216 insertions(+), 198 deletions(-)
diffs (truncated from 970 to 300 lines):
diff -r 0ab6915ad1d7 -r 9821c483080e apps/pcinfo.cpp
--- a/apps/pcinfo.cpp Thu Mar 17 11:06:31 2011 -0400
+++ b/apps/pcinfo.cpp Thu Mar 17 13:26:18 2011 -0400
@@ -78,7 +78,7 @@
std::istream* ifs = Utils::openFile(m_inputFile);
- libpc::Reader* reader = NULL;
+ libpc::Stage* reader = NULL;
if (hasOption("native"))
{
reader = new libpc::drivers::las::LasReader(*ifs);
diff -r 0ab6915ad1d7 -r 9821c483080e cmake/modules/FindMrSID.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/modules/FindMrSID.cmake Thu Mar 17 13:26:18 2011 -0400
@@ -0,0 +1,58 @@
+###############################################################################
+#
+# CMake module to search for MrSID/MG4 libraries
+#
+# On success, the macro sets the following variables:
+# MRSID_FOUND = if the library was found
+# MRSID_LIBRARY = full path to the library
+# MRSID_INCLUDE_DIR = full path to the headers
+# MRSID_VERSION = version of library which was found
+#
+# Copyright (c) 2009 Mateusz Loskot <mateusz at loskot.net>
+#
+# Developed with inspiration from Petr Vanek <petr at scribus.info>
+# who wrote similar macro for TOra - http://torasql.com/
+#
+# 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.
+#
+###############################################################################
+
+if(MRSID_INCLUDE_DIR AND MRSID_LIBRARY)
+ # Already in cache, be silent
+ set(MRSID_FIND_QUIETLY TRUE)
+endif()
+
+if(NOT MRSID_FIND_QUIETLY)
+ message(STATUS "Searching for MrSID LiDAR library ${MrSID_FIND_VERSION}+")
+endif()
+
+if(NOT DEFINED ENV{MRSID_HOME})
+ message(FATAL_ERROR "Missing environment variable MRSID_HOME with location of MrSID LiDAR sdk")
+endif()
+
+set(MRSID_HOME $ENV{MRSID_HOME})
+
+find_path(MRSID_INCLUDE_DIR
+ lidar/Base.h
+ PATHS
+ ${MRSID_HOME}/include
+ ${MRSID_HOME}/Lidar_DSDK/include
+ NO_DEFAULT_PATH)
+
+find_library(MRSID_LIBRARY
+ NAMES
+ lti_lidar_dsdk
+ liblti_lidar_dsdk
+ HINTS
+ ${MRSID_INCLUDE_DIR}/../lib
+ NO_DEFAULT_PATH)
+
+
+# Handle the QUIETLY and REQUIRED arguments and set MRSID_FOUND to TRUE
+# if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MrSID DEFAULT_MSG MRSID_LIBRARY MRSID_INCLUDE_DIR)
+
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/Iterator.hpp
--- a/include/libpc/Iterator.hpp Thu Mar 17 11:06:31 2011 -0400
+++ b/include/libpc/Iterator.hpp Thu Mar 17 13:26:18 2011 -0400
@@ -36,6 +36,7 @@
#define INCLUDED_ITERATOR_HPP
#include <libpc/Stage.hpp>
+#include <libpc/Bounds.hpp>
namespace libpc
{
@@ -43,7 +44,7 @@
class LIBPC_DLL Iterator
{
public:
- Iterator(const Stage& stage);
+ Iterator(const Stage& stage, const Bounds<double>& bounds);
const Stage& getStage() const;
@@ -65,16 +66,16 @@
// function to call.
virtual void seekToPoint(boost::uint64_t pointNum) = 0;
+ // returns true after we've read all the points available to this stage
+ // (actually a convenience function that compares getCurrentPointIndex and getNumPoints)
+ bool atEnd() const;
+
+protected:
// Returns the current point number. The first point is 0.
// If this number if > getNumPoints(), then no more points
// may be read (and atEnd() should be true).
boost::uint64_t getCurrentPointIndex() const;
- // returns true after we've read all the points available to this stage
- // (actually a convenience function that compares getCurrentPointIndex and getNumPoints)
- bool atEnd() const;
-
-protected:
// Implement this to do the actual work to fill in a buffer of points.
virtual boost::uint32_t readBuffer(PointData&) = 0;
@@ -89,6 +90,7 @@
private:
const Stage& m_stage;
boost::uint64_t m_currentPointIndex;
+ const Bounds<double> m_bounds;
Iterator& operator=(const Iterator&); // not implemented
Iterator(const Iterator&); // not implemented
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/Reader.hpp
--- a/include/libpc/Reader.hpp Thu Mar 17 11:06:31 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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_READER_HPP
-#define INCLUDED_READER_HPP
-
-#include <libpc/Stage.hpp>
-#include <libpc/Header.hpp>
-
-namespace libpc
-{
-
-class LIBPC_DLL Reader : public Stage
-{
-public:
- Reader();
-
-private:
- Reader& operator=(const Reader&); // not implemented
- Reader(const Reader&); // not implemented
-};
-
-} // namespace libpc
-
-#endif
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp Thu Mar 17 11:06:31 2011 -0400
+++ b/include/libpc/Stage.hpp Thu Mar 17 13:26:18 2011 -0400
@@ -45,6 +45,8 @@
namespace libpc
{
+class Iterator;
+
// every stage owns its own header, they are not shared
class LIBPC_DLL Stage
{
@@ -75,11 +77,6 @@
// function to call.
virtual void seekToPoint(boost::uint64_t pointNum) = 0;
- // Returns the current point number. The first point is 0.
- // If this number if > getNumPoints(), then no more points
- // may be read (and atEnd() should be true).
- boost::uint64_t getCurrentPointIndex() const;
-
// returns the number of points this stage has available
// (actually a convenience function that gets it from the header)
boost::uint64_t getNumPoints() const;
@@ -91,6 +88,8 @@
const Header& getHeader() const;
Header& getHeader();
+ virtual Iterator* createIterator(const Bounds<double>& bounds) = 0;
+
protected:
// Implement this to do the actual work to fill in a buffer of points.
virtual boost::uint32_t readBuffer(PointData& pointData, const Bounds<double>& bounds) = 0;
@@ -105,6 +104,11 @@
void setHeader(Header*); // stage takes ownership
+ // Returns the current point number. The first point is 0.
+ // If this number if > getNumPoints(), then no more points
+ // may be read (and atEnd() should be true).
+ boost::uint64_t getCurrentPointIndex() const;
+
private:
Header* m_header;
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/Writer.hpp
--- a/include/libpc/Writer.hpp Thu Mar 17 11:06:31 2011 -0400
+++ b/include/libpc/Writer.hpp Thu Mar 17 13:26:18 2011 -0400
@@ -35,7 +35,7 @@
#ifndef INCLUDED_WRITER_HPP
#define INCLUDED_WRITER_HPP
-#include <libpc/Filter.hpp>
+#include <libpc/Stage.hpp>
namespace libpc
{
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/drivers/faux/Reader.hpp
--- a/include/libpc/drivers/faux/Reader.hpp Thu Mar 17 11:06:31 2011 -0400
+++ b/include/libpc/drivers/faux/Reader.hpp Thu Mar 17 13:26:18 2011 -0400
@@ -35,7 +35,7 @@
#ifndef INCLUDED_DRIVERS_FAUX_READER_HPP
#define INCLUDED_DRIVERS_FAUX_READER_HPP
-#include <libpc/Reader.hpp>
+#include <libpc/Stage.hpp>
namespace libpc { namespace drivers { namespace faux {
@@ -52,7 +52,7 @@
// points to always be at the minimum of the bounding box. The Time field
// is always set to the point number.
//
-class LIBPC_DLL Reader : public libpc::Reader
+class LIBPC_DLL Reader : public libpc::Stage
{
public:
enum Mode
@@ -69,6 +69,8 @@
void seekToPoint(boost::uint64_t);
+ Iterator* createIterator(const Bounds<double>& bounds);
+
private:
boost::uint32_t readBuffer(PointData&, const Bounds<double>& bounds);
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/drivers/las/Reader.hpp
--- a/include/libpc/drivers/las/Reader.hpp Thu Mar 17 11:06:31 2011 -0400
+++ b/include/libpc/drivers/las/Reader.hpp Thu Mar 17 13:26:18 2011 -0400
@@ -37,13 +37,13 @@
#include <iostream>
-#include <libpc/Reader.hpp>
+#include <libpc/Stage.hpp>
#include <libpc/drivers/las/Header.hpp>
namespace libpc { namespace drivers { namespace las {
-class LIBPC_DLL LasReader : public Reader
+class LIBPC_DLL LasReader : public Stage
{
public:
LasReader(std::istream&);
@@ -56,6 +56,8 @@
const LasHeader& getLasHeader() const;
+ Iterator* createIterator(const Bounds<double>& bounds);
+
protected:
boost::uint32_t readBuffer(PointData& data, const Bounds<double>& bounds);
diff -r 0ab6915ad1d7 -r 9821c483080e include/libpc/drivers/liblas/Reader.hpp
More information about the Liblas-commits
mailing list