[Liblas-commits] hg-main-tree: fix up LAS readers to use capacity
instead of numP...
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Mar 17 13:59:30 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/ffdd8083e52c
changeset: 335:ffdd8083e52c
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Mar 17 12:58:59 2011 -0500
description:
fix up LAS readers to use capacity instead of numPoints
Subject: hg-main-tree: comment about bounds fix
details: http://hg.libpc.orghg-main-tree/rev/f3e003517836
changeset: 336:f3e003517836
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Mar 17 12:59:09 2011 -0500
description:
comment about bounds fix
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/df3ab3809733
changeset: 337:df3ab3809733
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Mar 17 12:59:24 2011 -0500
description:
merge
diffstat:
apps/pcinfo.cpp | 2 +-
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/Chipper.cpp | 1 +
src/Iterator.cpp | 3 +-
src/Reader.cpp | 48 -------------------------
src/drivers/faux/Reader.cpp | 10 ++++-
src/drivers/las/Reader.cpp | 19 ++++++++--
src/drivers/liblas/Reader.cpp | 16 ++++++--
src/drivers/oci/Writer.cpp | 2 +-
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 ++---
27 files changed, 132 insertions(+), 147 deletions(-)
diffs (truncated from 745 to 300 lines):
diff -r fcf3cc21be42 -r df3ab3809733 apps/pcinfo.cpp
--- a/apps/pcinfo.cpp Thu Mar 17 11:38:16 2011 -0500
+++ b/apps/pcinfo.cpp Thu Mar 17 12:59:24 2011 -0500
@@ -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 fcf3cc21be42 -r df3ab3809733 include/libpc/Iterator.hpp
--- a/include/libpc/Iterator.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/Iterator.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -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 fcf3cc21be42 -r df3ab3809733 include/libpc/Reader.hpp
--- a/include/libpc/Reader.hpp Thu Mar 17 11:38:16 2011 -0500
+++ /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 fcf3cc21be42 -r df3ab3809733 include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/Stage.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -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 fcf3cc21be42 -r df3ab3809733 include/libpc/Writer.hpp
--- a/include/libpc/Writer.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/Writer.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -35,7 +35,7 @@
#ifndef INCLUDED_WRITER_HPP
#define INCLUDED_WRITER_HPP
-#include <libpc/Filter.hpp>
+#include <libpc/Stage.hpp>
namespace libpc
{
diff -r fcf3cc21be42 -r df3ab3809733 include/libpc/drivers/faux/Reader.hpp
--- a/include/libpc/drivers/faux/Reader.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/drivers/faux/Reader.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -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 fcf3cc21be42 -r df3ab3809733 include/libpc/drivers/las/Reader.hpp
--- a/include/libpc/drivers/las/Reader.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/drivers/las/Reader.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -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 fcf3cc21be42 -r df3ab3809733 include/libpc/drivers/liblas/Reader.hpp
--- a/include/libpc/drivers/liblas/Reader.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/drivers/liblas/Reader.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -35,7 +35,7 @@
#ifndef INCLUDED_LIBLASREADER_HPP
#define INCLUDED_LIBLASREADER_HPP
-#include <libpc/Reader.hpp>
+#include <libpc/Stage.hpp>
#include <iostream>
@@ -50,7 +50,7 @@
namespace libpc { namespace drivers { namespace liblas {
-class LIBPC_DLL LiblasReader : public Reader
+class LIBPC_DLL LiblasReader : public Stage
{
public:
LiblasReader(std::istream&);
@@ -64,6 +64,8 @@
boost::int8_t getPointFormatNumber() const;
+ Iterator* createIterator(const Bounds<double>& bounds);
+
private:
virtual boost::uint32_t readBuffer(PointData& data, const Bounds<double>& bounds);
diff -r fcf3cc21be42 -r df3ab3809733 include/libpc/filters/CacheFilter.hpp
--- a/include/libpc/filters/CacheFilter.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/filters/CacheFilter.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -77,6 +77,8 @@
boost::uint64_t& numCacheInsertMisses,
boost::uint64_t& numCacheInsertHits) const;
+ Iterator* createIterator(const Bounds<double>& bounds);
+
private:
boost::uint32_t readBuffer(PointData& data, const Bounds<double>& bounds);
diff -r fcf3cc21be42 -r df3ab3809733 include/libpc/filters/ColorFilter.hpp
--- a/include/libpc/filters/ColorFilter.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/filters/ColorFilter.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -51,6 +51,8 @@
const std::string& getName() const;
+ Iterator* createIterator(const Bounds<double>& bounds);
+
private:
boost::uint32_t readBuffer(PointData& data, const Bounds<double>& bounds);
void checkImpedance();
diff -r fcf3cc21be42 -r df3ab3809733 include/libpc/filters/CropFilter.hpp
--- a/include/libpc/filters/CropFilter.hpp Thu Mar 17 11:38:16 2011 -0500
+++ b/include/libpc/filters/CropFilter.hpp Thu Mar 17 12:59:24 2011 -0500
@@ -52,6 +52,8 @@
void seekToPoint(boost::uint64_t pointNum);
+ Iterator* createIterator(const Bounds<double>& bounds);
+
More information about the Liblas-commits
mailing list