[Liblas-commits] hg-main-tree: fix compare_approx to work more betterer

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Mar 25 15:09:38 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/2cd3f72e8b4c
changeset: 469:2cd3f72e8b4c
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Mar 25 12:09:22 2011 -0700
description:
fix compare_approx to work more betterer
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/bea6869b72d7
changeset: 470:bea6869b72d7
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Mar 25 12:09:34 2011 -0700
description:
merge

diffstat:

 include/libpc/Chipper.hpp                 |  204 -------------
 include/libpc/ChipperIterator.hpp         |   68 ----
 include/libpc/FilterIterator.hpp          |   19 +
 include/libpc/Iterator.hpp                |    3 +
 include/libpc/Utils.hpp                   |    7 +-
 include/libpc/drivers/oci/Writer.hpp      |    8 +-
 include/libpc/filters/Chipper.hpp         |  209 +++++++++++++
 include/libpc/filters/ChipperIterator.hpp |   66 ++++
 src/CMakeLists.txt                        |    8 +-
 src/Chipper.cpp                           |  454 -----------------------------
 src/ChipperIterator.cpp                   |  115 -------
 src/drivers/oci/Writer.cpp                |    8 +-
 src/filters/Chipper.cpp                   |  455 ++++++++++++++++++++++++++++++
 src/filters/ChipperIterator.cpp           |  114 +++++++
 test/unit/ChipperTest.cpp                 |    4 +-
 test/unit/UtilsTest.cpp                   |   11 +
 16 files changed, 895 insertions(+), 858 deletions(-)

diffs (truncated from 1935 to 300 lines):

diff -r 5f4c981a6a19 -r bea6869b72d7 include/libpc/Chipper.hpp
--- a/include/libpc/Chipper.hpp	Fri Mar 25 11:35:56 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/******************************************************************************
- * $Id$
- *
- * Project:  libPC - http://libpc.org - A BSD library for point cloud data.
- * Purpose:  libPC chipper class
- * Author:   Howard Butler, hobu.inc at gmail.com
- *
- ******************************************************************************
- * Copyright (c) 2011, Howard Butler
- *
- * 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 the Martin Isenburg or Iowa Department
- *       of Natural Resources 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 LIBPC_CHIPPER_H
-#define LIBPC_CHIPPER_H
-
-#include <libpc/libpc.hpp>
-
-#include <vector>
-
-#include <libpc/Filter.hpp>
-#include <libpc/Bounds.hpp>
-#include <libpc/PointBuffer.hpp>
-
-namespace libpc
-{
-
-class Stage;
-
-namespace chipper
-{
-
-enum Direction
-{
-    DIR_X,
-    DIR_Y,
-    DIR_NONE
-};
-
-class LIBPC_DLL PtRef
-{
-public:
-    double m_pos;
-    boost::uint32_t m_ptindex;
-    boost::uint32_t m_oindex;
-
-    bool operator < (const PtRef& pt) const
-        { return m_pos < pt.m_pos; }
-};
-
-struct LIBPC_DLL RefList
-{
-public:
-    std::vector<PtRef> m_vec;
-    Direction m_dir;
-
-    RefList(Direction dir = DIR_NONE) : m_dir(dir)
-        {}
-    std::vector<PtRef>::size_type size() const
-        { return m_vec.size(); }
-    void reserve(std::vector<PtRef>::size_type n)
-        { m_vec.reserve(n); }
-    void resize(std::vector<PtRef>::size_type n)
-        { m_vec.resize(n); }
-    void push_back(const PtRef& ref)
-        { m_vec.push_back(ref); }
-    std::vector<PtRef>::iterator begin()
-        { return m_vec.begin(); }
-    std::vector<PtRef>::iterator end()
-        { return m_vec.end(); }
-    PtRef& operator[](boost::uint32_t pos)
-        { return m_vec[pos]; }
-    std::string Dir()
-    {
-        if (m_dir == DIR_X)
-            return "X";
-        else if (m_dir == DIR_Y)
-            return "Y";
-        else
-            return "NONE";
-    }
-};
-
-class LIBPC_DLL Chipper;
-
-class LIBPC_DLL Block
-{
-    friend class Chipper;
-
-private:
-    RefList *m_list_p;
-    boost::uint32_t m_left;
-    boost::uint32_t m_right;
-    libpc::Bounds<double> m_bounds;
-    // double m_xmin;
-    // double m_ymin;
-    // double m_xmax;
-    // double m_ymax;
-
-public:
-    std::vector<boost::uint32_t> GetIDs() const; 
-    libpc::Bounds<double> const& GetBounds() const {return m_bounds;} 
-    void SetBounds(libpc::Bounds<double> const& bounds) {m_bounds = bounds;}
-    PointBuffer GetBuffer( Stage& stage) const;    
-    // double GetXmin() const
-    //     { return m_xmin; }
-    // double GetYmin() const
-    //     { return m_ymin; }
-    // double GetXmax() const
-    //     { return m_xmax; }
-    // double GetYmax() const
-    //     { return m_ymax; }
-};
-
-class LIBPC_DLL Chipper : public libpc::Filter
-{
-public:
-    Chipper(Stage& prevStage, boost::uint32_t max_partition_size) :
-        libpc::Filter(prevStage), m_stage(prevStage), m_threshold(max_partition_size),
-        m_xvec(DIR_X), m_yvec(DIR_Y), m_spare(DIR_NONE) 
-    {}
-
-    void Chip();
-    std::vector<Block>::size_type GetBlockCount()
-        { return m_blocks.size(); }
-    const Block& GetBlock(std::vector<Block>::size_type i)
-        { return m_blocks[i]; }
-
-    const std::string& getName() const ;
-
-    inline boost::uint8_t getIteratorSupport () const
-    {   
-        // FIXME: make this represent what this reader actually supports!
-        boost::uint8_t mask(0); 
-        mask |= StageIterator_Block; 
-        return mask;
-    }
-
-    bool supportsSequentialIterator() const { return true; }
-    bool supportsRandomIterator() const { return false; }
-    libpc::SequentialIterator* createSequentialIterator() const;
-    libpc::RandomIterator* createRandomIterator() const;
-
-private:
-    void Load(RefList& xvec, RefList& yvec, RefList& spare);
-    void Partition(boost::uint32_t size);
-    void Split(RefList& xvec, RefList& yvec, RefList& spare);
-    void DecideSplit(RefList& v1, RefList& v2, RefList& spare,
-        boost::uint32_t left, boost::uint32_t right);
-    void Split(RefList& wide, RefList& narrow, RefList& spare,
-        boost::uint32_t left, boost::uint32_t right);
-    void FinalSplit(RefList& wide, RefList& narrow,
-        boost::uint32_t pleft, boost::uint32_t pcenter);
-    void Emit(RefList& wide, boost::uint32_t widemin, boost::uint32_t widemax,
-        RefList& narrow, boost::uint32_t narrowmin, boost::uint32_t narrowmax );
-    
-    void ConstructBuffers();
-    
-    // Reader *m_reader;
-    Stage& m_stage;
-    boost::uint32_t m_threshold;
-    std::vector<Block> m_blocks;
-    std::vector<boost::uint32_t> m_partitions;
-    RefList m_xvec;
-    RefList m_yvec;
-    RefList m_spare;
-
-    Chipper& operator=(const Chipper&); // not implemented
-    Chipper(const Chipper&); // not implemented
-};
-
-} // namespace chipper
-
-} // namespace liblas
-
-#endif
diff -r 5f4c981a6a19 -r bea6869b72d7 include/libpc/ChipperIterator.hpp
--- a/include/libpc/ChipperIterator.hpp	Fri Mar 25 11:35:56 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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_CHIPPERITERATOR_HPP
-#define INCLUDED_CHIPPERITERATOR_HPP
-
-#include <libpc/libpc.hpp>
-
-#include <libpc/FilterIterator.hpp>
-
-namespace libpc {
-
-namespace chipper
-{
-    class Chipper;
-}
-    
-namespace filters {
-
-
-class ChipperSequentialIterator : public libpc::FilterSequentialIterator
-{
-public:
-    ChipperSequentialIterator(const chipper::Chipper& chipper);
-
-private:
-    boost::uint64_t skipImpl(boost::uint64_t);
-    boost::uint32_t readImpl(PointBuffer&);
-    bool atEndImpl() const;
-
-    const chipper::Chipper& m_chipper;
-};
-
-
-} } // namespaces
-
-#endif
diff -r 5f4c981a6a19 -r bea6869b72d7 include/libpc/FilterIterator.hpp
--- a/include/libpc/FilterIterator.hpp	Fri Mar 25 11:35:56 2011 -0700
+++ b/include/libpc/FilterIterator.hpp	Fri Mar 25 12:09:34 2011 -0700
@@ -83,6 +83,25 @@
     RandomIterator* m_prevIterator;
 };
 
+class FilterBlockIterator : public BlockIterator
+{
+public:
+    FilterBlockIterator(const Filter&);
+    virtual ~FilterBlockIterator();
+
+protected:
+    // from RandomIterator
+    virtual boost::uint32_t readImpl(PointBuffer&) = 0;
+    virtual boost::uint64_t seekImpl(boost::uint64_t pointNum) = 0;
+
+    BlockIterator& getPrevIterator();
+    const BlockIterator& getPrevIterator() const;


More information about the Liblas-commits mailing list