MrSID Decode SDK for LiDAR Reference Manual  1.1.4.4709
PointIterator.h
Go to the documentation of this file.
00001 /* //////////////////////////////////////////////////////////////////////////
00002 //                                                                         //
00003 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western      //
00004 // Avenue, Suite 200, Seattle, WA 98104.  Unauthorized use or distribution //
00005 // prohibited.  Access to and use of this code is permitted only under     //
00006 // license from LizardTech, Inc.  Portions of the code are protected by    //
00007 // US and foreign patents and other filings. All Rights Reserved.          //
00008 //                                                                         //
00010 /* PUBLIC */
00011 
00012 #ifndef __LIDAR_POINT_ITERATOR_H__
00013 #define __LIDAR_POINT_ITERATOR_H__
00014 
00015 #include "lidar/Types.h"
00016 #include "lidar/Object.h"
00017 #include "lidar/PointData.h"
00018 #include "lidar/ProgressDelegate.h"
00019 
00020 LT_BEGIN_LIDAR_NAMESPACE
00021 
00031 class PointIterator : public Object
00032 {
00033    ABSTRACT_OBJECT(PointIterator);
00034 public:
00043    virtual size_t getNextPoints(PointData &points) = 0;
00044 
00045 protected:
00060    void init(const Bounds &bounds,
00061              double fraction,
00062              const PointInfo &pointInfo,
00063              ProgressDelegate *delegate);
00064 
00068    inline bool useSample(double x, double y, double z)
00069    {
00070       if(!m_bounds.contains(x, y, z))
00071          return false;
00072       else
00073       {
00074          m_accumulator += m_fraction;
00075          if(m_accumulator > m_cutoff)
00076          {
00077             m_accumulator -= 1;
00078             return true;
00079          }
00080          else
00081             return false;
00082       }
00083    }
00084 
00085    Bounds m_bounds;
00086    double m_fraction;
00087    double m_accumulator;
00088    double m_cutoff;
00089    ProgressDelegate *m_delegate;
00090 };
00091 
00092 
00093 #define CONCRETE_ITERATOR(classname) \
00094    DISABLE_COPY(classname); \
00095    public: \
00096       static classname *create(void) \
00097       { \
00098          return new classname(); \
00099       }
00100 
00101 LT_END_LIDAR_NAMESPACE
00102 #endif // __LIDAR_POINT_ITERATOR_H__