[Liblas-commits] hg-main-tree: add generic
createIterator(StageIteratorType t) me...
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Mar 25 12:51:45 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/f213cdafcaea
changeset: 451:f213cdafcaea
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Mar 25 11:51:27 2011 -0500
description:
add generic createIterator(StageIteratorType t) method to stages
Subject: hg-main-tree: merge
details: http://hg.libpc.orghg-main-tree/rev/e2ac4f057402
changeset: 452:e2ac4f057402
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Mar 25 11:51:37 2011 -0500
description:
merge
diffstat:
include/libpc/Stage.hpp | 4 ++
include/libpc/drivers/faux/Reader.hpp | 2 +
include/libpc/drivers/las/Reader.hpp | 2 +
include/libpc/drivers/liblas/Reader.hpp | 2 +
include/libpc/drivers/oci/Reader.hpp | 2 +
include/libpc/filters/CacheFilter.hpp | 1 +
include/libpc/filters/ColorFilter.hpp | 3 +-
include/libpc/filters/CropFilter.hpp | 5 ++-
include/libpc/filters/DecimationFilter.hpp | 3 +-
include/libpc/filters/MosaicFilter.hpp | 2 +
src/drivers/faux/Reader.cpp | 10 +++++
src/drivers/las/Reader.cpp | 8 ++++
src/drivers/liblas/Reader.cpp | 9 +++++
src/filters/CacheFilter.cpp | 8 ++++
src/filters/ColorFilter.cpp | 7 +++
src/filters/CropFilter.cpp | 8 ++++
src/filters/DecimationFilter.cpp | 9 +++++
src/filters/MosaicFilter.cpp | 8 ++++
test/unit/FauxReaderTest.cpp | 54 +++++++++++++++---------------
test/unit/LiblasReaderTest.cpp | 4 +-
test/unit/support.hpp | 6 +++
21 files changed, 125 insertions(+), 32 deletions(-)
diffs (truncated from 430 to 300 lines):
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/Stage.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -44,6 +44,7 @@
{
class Header;
+class Iterator;
class SequentialIterator;
class RandomIterator;
@@ -67,6 +68,9 @@
Header& getHeader();
virtual boost::uint8_t getIteratorSupport () const { return 0; }
+
+ virtual libpc::Iterator* createIterator(StageIteratorType type) const { return NULL; }
+
virtual bool supportsSequentialIterator() const { return false; }
virtual bool supportsRandomIterator() const { return false; }
virtual SequentialIterator* createSequentialIterator() const { return NULL; }
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/drivers/faux/Reader.hpp
--- a/include/libpc/drivers/faux/Reader.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/drivers/faux/Reader.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -89,6 +89,8 @@
return mask;
}
+ libpc::Iterator* createIterator(StageIteratorType t) const;
+
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return true; }
libpc::SequentialIterator* createSequentialIterator() const;
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/drivers/las/Reader.hpp
--- a/include/libpc/drivers/las/Reader.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/drivers/las/Reader.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -68,6 +68,8 @@
return mask;
}
+ libpc::Iterator* createIterator(StageIteratorType t) const;
+
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return true; }
libpc::SequentialIterator* createSequentialIterator() const;
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/drivers/liblas/Reader.hpp
--- a/include/libpc/drivers/liblas/Reader.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/drivers/liblas/Reader.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -80,6 +80,8 @@
return mask;
}
+ libpc::Iterator* createIterator(StageIteratorType t) const;
+
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return true; }
libpc::SequentialIterator* createSequentialIterator() const;
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/drivers/oci/Reader.hpp
--- a/include/libpc/drivers/oci/Reader.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/drivers/oci/Reader.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -70,6 +70,8 @@
return mask;
}
+ // libpc::Iterator* createIterator(StageIteratorType t) const;
+
private:
Reader& operator=(const Reader&); // not implemented
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/filters/CacheFilter.hpp
--- a/include/libpc/filters/CacheFilter.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/filters/CacheFilter.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -94,6 +94,7 @@
return mask;
}
+ libpc::Iterator* createIterator(StageIteratorType t) const;
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return true; }
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/filters/ColorFilter.hpp
--- a/include/libpc/filters/ColorFilter.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/filters/ColorFilter.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -68,7 +68,8 @@
mask |= StageIterator_Sequential;
return mask;
}
-
+
+ libpc::Iterator* createIterator(StageIteratorType t) const;
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return false; }
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/filters/CropFilter.hpp
--- a/include/libpc/filters/CropFilter.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/filters/CropFilter.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -38,7 +38,7 @@
#include <libpc/libpc.hpp>
//#include <libpc/export.hpp>
#include <libpc/Filter.hpp>
-//#include <libpc/FilterIterator.hpp>
+#include <libpc/FilterIterator.hpp>
#include <libpc/Bounds.hpp>
namespace libpc
@@ -69,6 +69,9 @@
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return false; }
+
+ libpc::Iterator* createIterator(StageIteratorType type) const;
+
libpc::SequentialIterator* createSequentialIterator() const;
libpc::RandomIterator* createRandomIterator() const { return NULL; }
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/filters/DecimationFilter.hpp
--- a/include/libpc/filters/DecimationFilter.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/filters/DecimationFilter.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -64,7 +64,8 @@
return mask;
}
-
+ libpc::Iterator* createIterator(StageIteratorType t) const;
+
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return false; }
libpc::SequentialIterator* createSequentialIterator() const;
diff -r 7373e867d8a5 -r e2ac4f057402 include/libpc/filters/MosaicFilter.hpp
--- a/include/libpc/filters/MosaicFilter.hpp Fri Mar 25 11:29:51 2011 -0500
+++ b/include/libpc/filters/MosaicFilter.hpp Fri Mar 25 11:51:37 2011 -0500
@@ -66,6 +66,8 @@
return mask;
}
+ libpc::Iterator* createIterator(StageIteratorType t) const;
+
bool supportsSequentialIterator() const { return true; }
bool supportsRandomIterator() const { return false; } // BUG: could be true
libpc::SequentialIterator* createSequentialIterator() const;
diff -r 7373e867d8a5 -r e2ac4f057402 src/drivers/faux/Reader.cpp
--- a/src/drivers/faux/Reader.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/drivers/faux/Reader.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -111,6 +111,16 @@
return new RandomIterator(*this);
}
+libpc::Iterator* Reader::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new SequentialIterator(*this);
+ if (t == StageIterator_Random)
+ return new RandomIterator(*this);
+ return 0;
+}
+
+
boost::uint32_t Reader::processBuffer(PointBuffer& data, boost::uint64_t index) const
{
const SchemaLayout& schemaLayout = data.getSchemaLayout();
diff -r 7373e867d8a5 -r e2ac4f057402 src/drivers/las/Reader.cpp
--- a/src/drivers/las/Reader.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/drivers/las/Reader.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -98,6 +98,14 @@
return new RandomIterator(*this);
}
+libpc::Iterator* LasReader::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new SequentialIterator(*this);
+ if (t == StageIterator_Random)
+ return new RandomIterator(*this);
+ return 0;
+}
boost::uint32_t LasReader::processBuffer(PointBuffer& data, std::istream& stream) const
{
diff -r 7373e867d8a5 -r e2ac4f057402 src/drivers/liblas/Reader.cpp
--- a/src/drivers/liblas/Reader.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/drivers/liblas/Reader.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -263,4 +263,13 @@
return new RandomIterator(*this);
}
+libpc::Iterator* LiblasReader::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new SequentialIterator(*this);
+ if (t == StageIterator_Random)
+ return new RandomIterator(*this);
+ return 0;
+}
+
} } } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 src/filters/CacheFilter.cpp
--- a/src/filters/CacheFilter.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/filters/CacheFilter.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -151,5 +151,13 @@
return new CacheFilterRandomIterator(*this);
}
+libpc::Iterator* CacheFilter::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new CacheFilterSequentialIterator(*this);
+ if (t == StageIterator_Random)
+ return new CacheFilterRandomIterator(*this);
+ return 0;
+}
} } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 src/filters/ColorFilter.cpp
--- a/src/filters/ColorFilter.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/filters/ColorFilter.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -143,5 +143,12 @@
return new ColorFilterSequentialIterator(*this);
}
+libpc::Iterator* ColorFilter::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new ColorFilterSequentialIterator(*this);
+
+ return 0;
+}
} } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 src/filters/CropFilter.cpp
--- a/src/filters/CropFilter.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/filters/CropFilter.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -114,5 +114,13 @@
return new CropFilterSequentialIterator(*this);
}
+libpc::Iterator* CropFilter::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new CropFilterSequentialIterator(*this);
+
+ return 0;
+}
+
} } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 src/filters/DecimationFilter.cpp
--- a/src/filters/DecimationFilter.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/filters/DecimationFilter.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -94,5 +94,14 @@
return new DecimationFilterSequentialIterator(*this);
}
+libpc::Iterator* DecimationFilter::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new DecimationFilterSequentialIterator(*this);
+
+ return 0;
+}
+
+
} } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 src/filters/MosaicFilter.cpp
--- a/src/filters/MosaicFilter.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/src/filters/MosaicFilter.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -115,5 +115,13 @@
return new MosaicFilterSequentialIterator(*this);
}
+libpc::Iterator* MosaicFilter::createIterator(StageIteratorType t) const
+{
+ if (t == StageIterator_Sequential)
+ return new MosaicFilterSequentialIterator(*this);
+
+ return 0;
+}
+
} } // namespaces
diff -r 7373e867d8a5 -r e2ac4f057402 test/unit/FauxReaderTest.cpp
--- a/test/unit/FauxReaderTest.cpp Fri Mar 25 11:29:51 2011 -0500
+++ b/test/unit/FauxReaderTest.cpp Fri Mar 25 11:51:37 2011 -0500
@@ -76,9 +76,9 @@
double z = data.getField<double>(i, offsetZ);
boost::uint64_t t = data.getField<boost::uint64_t>(i, offsetT);
- BOOST_CHECK_CLOSE(x, 1.0, (std::numeric_limits<double>::min)());
- BOOST_CHECK_CLOSE(y, 2.0, (std::numeric_limits<double>::min)());
- BOOST_CHECK_CLOSE(z, 3.0, (std::numeric_limits<double>::min)());
+ BOOST_CHECK_CLOSE(x, 1.0, 0.00001);
+ BOOST_CHECK_CLOSE(y, 2.0, 0.00001);
+ BOOST_CHECK_CLOSE(z, 3.0, 0.00001);
BOOST_CHECK_EQUAL(t, i);
}
@@ -118,9 +118,9 @@
double z = data.getField<double>(i, offsetZ);
boost::uint64_t t = data.getField<boost::uint64_t>(i, offsetT);
More information about the Liblas-commits
mailing list