[Liblas-commits] hg-main-tree: starting reprojection filter

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Apr 25 17:57:19 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/a14e91eee15e
changeset: 648:a14e91eee15e
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Mon Apr 25 14:57:08 2011 -0700
description:
starting reprojection filter

diffstat:

 include/libpc/filters/ReprojectionFilter.hpp         |   84 +++++++++++
 include/libpc/filters/ReprojectionFilterIterator.hpp |   62 ++++++++
 src/CMakeLists.txt                                   |    4 +
 src/filters/ReprojectionFilter.cpp                   |  101 ++++++++++++++
 src/filters/ReprojectionFilterIterator.cpp           |   72 ++++++++++
 test/unit/SpatialReferenceTest.cpp                   |  134 +++++++++---------
 6 files changed, 387 insertions(+), 70 deletions(-)

diffs (truncated from 522 to 300 lines):

diff -r 01dc35d4bc19 -r a14e91eee15e include/libpc/filters/ReprojectionFilter.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/filters/ReprojectionFilter.hpp	Mon Apr 25 14:57:08 2011 -0700
@@ -0,0 +1,84 @@
+/******************************************************************************
+* 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_FILTERS_REPROJECTIONFILTER_HPP
+#define INCLUDED_FILTERS_REPROJECTIONFILTER_HPP
+
+#include <libpc/libpc.hpp>
+//#include <boost/cstdint.hpp>
+//
+//#include <libpc/export.hpp>
+#include <libpc/Filter.hpp>
+//#include <libpc/FilterIterator.hpp>
+
+namespace libpc
+{
+    class PointBuffer;
+}
+
+namespace libpc { namespace filters {
+
+class ReprojectionFilterSequentialIterator;
+
+class LIBPC_DLL ReprojectionFilter : public Filter
+{
+public:
+    ReprojectionFilter(const Stage& prevStage);
+
+    const std::string& getDescription() const;
+    const std::string& getName() const;
+
+    bool supportsIterator (StageIteratorType t) const
+    {   
+        if (t == StageIterator_Sequential ) return true;
+
+        return false;
+    }
+
+    libpc::SequentialIterator* createSequentialIterator() const;
+    libpc::RandomIterator* createRandomIterator() const { return NULL; }
+
+    void processBuffer(PointBuffer& data) const;
+
+private:
+    void checkImpedance();
+
+    ReprojectionFilter& operator=(const ReprojectionFilter&); // not implemented
+    ReprojectionFilter(const ReprojectionFilter&); // not implemented
+};
+
+
+} } // namespaces
+
+#endif
diff -r 01dc35d4bc19 -r a14e91eee15e include/libpc/filters/ReprojectionFilterIterator.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/filters/ReprojectionFilterIterator.hpp	Mon Apr 25 14:57:08 2011 -0700
@@ -0,0 +1,62 @@
+/******************************************************************************
+* 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_FILTERS_REPROJECTIONFILTERITERATOR_HPP
+#define INCLUDED_FILTERS_REPROJECTIONFILTERITERATOR_HPP
+
+#include <libpc/libpc.hpp>
+
+#include <libpc/filters/ReprojectionFilter.hpp>
+#include <libpc/FilterIterator.hpp>
+
+namespace libpc { namespace filters {
+
+
+class ReprojectionFilterSequentialIterator : public libpc::FilterSequentialIterator
+{
+public:
+    ReprojectionFilterSequentialIterator(const ReprojectionFilter& filter);
+
+private:
+    boost::uint64_t skipImpl(boost::uint64_t);
+    boost::uint32_t readImpl(PointBuffer&);
+    bool atEndImpl() const;
+
+    const ReprojectionFilter& m_reprojectionFilter;
+};
+
+
+} } // namespaces
+
+#endif
diff -r 01dc35d4bc19 -r a14e91eee15e src/CMakeLists.txt
--- a/src/CMakeLists.txt	Mon Apr 25 14:43:03 2011 -0700
+++ b/src/CMakeLists.txt	Mon Apr 25 14:57:08 2011 -0700
@@ -241,6 +241,8 @@
   ${LIBPC_HEADERS_DIR}/filters/DecimationFilterIterator.hpp
   ${LIBPC_HEADERS_DIR}/filters/MosaicFilter.hpp
   ${LIBPC_HEADERS_DIR}/filters/MosaicFilterIterator.hpp
+  ${LIBPC_HEADERS_DIR}/filters/ReprojectionFilter.hpp
+  ${LIBPC_HEADERS_DIR}/filters/ReprojectionFilterIterator.hpp
 )
 
 set (LIBPC_FILTERS_CPP 
@@ -256,6 +258,8 @@
   ./filters/DecimationFilterIterator.cpp
   ./filters/MosaicFilter.cpp
   ./filters/MosaicFilterIterator.cpp
+  ./filters/ReprojectionFilter.cpp
+  ./filters/ReprojectionFilterIterator.cpp
 )
 
 FOREACH(file ${LIBPC_FILTERS_HPP})
diff -r 01dc35d4bc19 -r a14e91eee15e src/filters/ReprojectionFilter.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/filters/ReprojectionFilter.cpp	Mon Apr 25 14:57:08 2011 -0700
@@ -0,0 +1,101 @@
+/******************************************************************************
+* 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.
+****************************************************************************/
+
+#include <libpc/filters/ReprojectionFilter.hpp>
+
+#include <libpc/Dimension.hpp>
+#include <libpc/Schema.hpp>
+#include <libpc/exceptions.hpp>
+#include <libpc/PointBuffer.hpp>
+#include <libpc/filters/ReprojectionFilterIterator.hpp>
+
+namespace libpc { namespace filters {
+
+ReprojectionFilter::ReprojectionFilter(const Stage& prevStage)
+    : Filter(prevStage)
+{
+    checkImpedance();
+
+    return;
+}
+
+
+void ReprojectionFilter::checkImpedance()
+{
+    return;
+}
+
+
+const std::string& ReprojectionFilter::getDescription() const
+{
+    static std::string name("Reprojection Filter");
+    return name;
+}
+
+const std::string& ReprojectionFilter::getName() const
+{
+    static std::string name("filters.reprojection");
+    return name;
+}
+
+void ReprojectionFilter::processBuffer(PointBuffer& data) const
+{
+    const boost::uint32_t numPoints = data.getNumPoints();
+
+    //const SchemaLayout& schemaLayout = data.getSchemaLayout();
+    //const Schema& schema = schemaLayout.getSchema();
+
+    //const int indexZ = schema.getDimensionIndex(Dimension::Field_Z, Dimension::Int32);
+    //const Dimension& zDim = schema.getDimension(indexZ);
+
+    for (boost::uint32_t pointIndex=0; pointIndex<numPoints; pointIndex++)
+    {
+        //const boost::int32_t zraw = data.getField<boost::int32_t>(pointIndex, indexZ);
+        //const double z = zDim.applyScaling(zraw);
+
+        //data.setField<boost::uint16_t>(pointIndex, indexB, blue);
+
+        data.setNumPoints(pointIndex+1);
+    }
+
+    return;
+}
+
+
+libpc::SequentialIterator* ReprojectionFilter::createSequentialIterator() const
+{
+    return new ReprojectionFilterSequentialIterator(*this);
+}
+
+} } // namespaces
diff -r 01dc35d4bc19 -r a14e91eee15e src/filters/ReprojectionFilterIterator.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/filters/ReprojectionFilterIterator.cpp	Mon Apr 25 14:57:08 2011 -0700
@@ -0,0 +1,72 @@
+/******************************************************************************
+* 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


More information about the Liblas-commits mailing list