[Liblas-commits] hg: make liblas::Summary a FilterI so it can be
used accordingly
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Jan 21 10:53:42 EST 2011
details: http://hg.liblas.orghg/rev/b1dbaf051135
changeset: 2806:b1dbaf051135
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Jan 21 09:53:35 2011 -0600
description:
make liblas::Summary a FilterI so it can be used accordingly
diffstat:
include/liblas/utility.hpp | 10 ++++++++--
src/utility.cpp | 27 ++++++++++++++++++++++-----
2 files changed, 30 insertions(+), 7 deletions(-)
diffs (135 lines):
diff -r 55c57172f51c -r b1dbaf051135 include/liblas/utility.hpp
--- a/include/liblas/utility.hpp Fri Jan 21 08:36:37 2011 -0600
+++ b/include/liblas/utility.hpp Fri Jan 21 09:53:35 2011 -0600
@@ -47,6 +47,7 @@
#include <liblas/detail/fwd.hpp>
#include <liblas/external/property_tree/ptree.hpp>
#include <liblas/export.hpp>
+#include <liblas/filter.hpp>
// boost
#include <boost/cstdint.hpp>
#include <boost/foreach.hpp>
@@ -61,18 +62,20 @@
namespace liblas {
/// A summarization utililty for LAS points
-class LAS_DLL Summary
+class LAS_DLL Summary : public FilterI
{
public:
Summary();
Summary(Summary const& other);
Summary& operator=(Summary const& rhs);
+ bool filter(const Point& point);
void AddPoint(liblas::Point const& p);
ptree GetPTree() const;
void SetHeader(liblas::Header const& h);
+ ~Summary() {};
private:
classes_type classes;
@@ -91,18 +94,21 @@
bool bHaveTime;
};
-class LAS_DLL CoordinateSummary
+class LAS_DLL CoordinateSummary : public FilterI
{
public:
CoordinateSummary();
CoordinateSummary(CoordinateSummary const& other);
CoordinateSummary& operator=(CoordinateSummary const& rhs);
+ bool filter(const Point& point);
void AddPoint(liblas::Point const& p);
ptree GetPTree() const;
void SetHeader(liblas::Header const& h);
+ ~CoordinateSummary() {};
+
private:
boost::uint32_t count;
diff -r 55c57172f51c -r b1dbaf051135 src/utility.cpp
--- a/src/utility.cpp Fri Jan 21 08:36:37 2011 -0600
+++ b/src/utility.cpp Fri Jan 21 09:53:35 2011 -0600
@@ -49,7 +49,8 @@
namespace liblas {
-Summary::Summary() :
+Summary::Summary() :
+ FilterI(liblas::FilterI::eInclusion),
synthetic(0),
withheld(0),
keypoint(0),
@@ -58,6 +59,7 @@
bHaveHeader(false),
bHaveColor(true),
bHaveTime(true)
+
{
classes.assign(0);
@@ -66,7 +68,8 @@
}
Summary::Summary(Summary const& other)
- : classes(other.classes)
+ : FilterI(liblas::FilterI::eInclusion)
+ , classes(other.classes)
, synthetic(other.synthetic)
, withheld(other.withheld)
, keypoint(other.keypoint)
@@ -308,6 +311,12 @@
bHaveHeader = true;
}
+bool Summary::filter(liblas::Point const& p)
+{
+ AddPoint(p);
+ return true;
+}
+
ptree Summary::GetPTree() const
{
ptree pt;
@@ -553,7 +562,8 @@
}
CoordinateSummary::CoordinateSummary() :
- count(0)
+ FilterI(eInclusion)
+ , count(0)
, first(true)
, bHaveHeader(false)
, bHaveColor(true)
@@ -565,8 +575,8 @@
}
CoordinateSummary::CoordinateSummary(CoordinateSummary const& other)
- :
- count(other.count)
+ : FilterI(eInclusion)
+ , count(other.count)
, points_by_return(other.points_by_return)
, returns_of_given_pulse(other.returns_of_given_pulse)
, first(other.first)
@@ -711,6 +721,13 @@
return top;
}
+bool CoordinateSummary::filter(liblas::Point const& p)
+{
+ AddPoint(p);
+ return true;
+}
+
+
boost::uint32_t GetStreamPrecision(double scale)
{
double frac = 0;
More information about the Liblas-commits
mailing list