From 4f583b10f2e6b177757981fd38ffb4aa0822fbd4 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Thu, 10 Dec 2015 14:12:45 -0600 Subject: [PATCH] Use old method of point count for density for now. --- plugins/hexbin/filters/HexBin.cpp | 6 ++++-- plugins/hexbin/filters/HexBin.hpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/hexbin/filters/HexBin.cpp b/plugins/hexbin/filters/HexBin.cpp index c266fe2c4b..d1e0fa88e7 100644 --- a/plugins/hexbin/filters/HexBin.cpp +++ b/plugins/hexbin/filters/HexBin.cpp @@ -66,6 +66,7 @@ void HexBin::processOptions(const Options& options) void HexBin::ready(PointTableRef table) { + m_count = 0; if (m_edgeLength == 0.0) // 0 can always be represented exactly. { m_grid.reset(new HexGrid(m_density)); @@ -84,6 +85,7 @@ void HexBin::filter(PointView& view) double y = view.getFieldAs(pdal::Dimension::Id::Y, idx); m_grid->addPoint(x, y); } + m_count += view.size(); } @@ -173,8 +175,8 @@ void HexBin::done(PointTableRef table) m_metadata.add("boundary", smooth, "Approximated MULTIPOLYGON of domain"); double area = Geometry::computeArea(polygon.str()); - double density = (double) m_grid->densePointCount() / area ; -std::cerr << "Area/count = " << area << "/" << m_grid->densePointCount() << "!\n"; +// double density = (double) m_grid->densePointCount() / area ; + double density = (double) m_count/ area ; m_metadata.add("density", density, "Number of points per square unit"); m_metadata.add("area", area, "Area in square units of tessellated polygon"); } diff --git a/plugins/hexbin/filters/HexBin.hpp b/plugins/hexbin/filters/HexBin.hpp index 2a73bcc3ab..50bf09d1da 100644 --- a/plugins/hexbin/filters/HexBin.hpp +++ b/plugins/hexbin/filters/HexBin.hpp @@ -62,6 +62,7 @@ class PDAL_DLL HexBin : public Filter int32_t m_density; double m_edgeLength; bool m_outputTesselation; + point_count_t m_count; virtual void processOptions(const Options& options); virtual void ready(PointTableRef table);