IPointIndexLeaf.hpp
1 #pragma once
2 
3 
4 #include "DM/config.hpp"
5 #include "DM/Handle.hpp"
6 #include "DM/Iterator.hpp"
7 #include "DM/IPoint.hpp"
8 #include "DM/IPolygon.hpp"
9 #include "DM/IWindow.hpp"
10 #include "DM/IBox.hpp"
11 #include "DM/ICircle.hpp"
12 #include "DM/ISphere.hpp"
13 #include "DM/ICylinder.hpp"
14 #include "DM/ObjectBase.hpp"
15 #include "DM/IKnnQueryDescriptor.hpp"
16 #include "DM/IFilter.hpp"
17 #include "DM/IColBufferManagerWrite.hpp"
18 #include "DM/AutoLink.hpp" //enable autolink
19 
20 DM_NAMESPACE_BEGIN
21 
22 class IIndexMapSet;
23 class IIndexHelperSet;
24 class IClassificationMatrix;
25 
26 /// \brief object representing a spatial leaf within a point index
27 /** Whereas IPointIndexLeaf objects are fully kept in memory, IPointIndex objects may consists of multiple
28  IPointIndexLeaf objects that can be swapped to disk. For details see \ref dm_structure
29 */
30 class DM_API IPointIndexLeaf : public ObjectBase
31 {
32 public:
33  struct kd_tree_tag {};
35 
36  /// create a new kd tree object
37  static IPointIndexLeaf* New(const kd_tree_tag &, int dimension, bool threadsafe);
38  static IPointIndexLeaf* New(const kd_tree_with_lazy_deletion_tag &, int dimension, bool threadsafe);
39 
40 
41  // Iterator typedefs ============================================================================
42  typedef ConstIterator<IPoint> const_iterator_point; ///< Point iterator
43  typedef InsertIterator<IPoint> insert_iterator_point; ///< Point insert iterator (used in searchPoint functions)
44 
45 protected:
46  virtual ~IPointIndexLeaf() {}
47 
48 public:
49  // General memeber functions ====================================================================
50  virtual BoxHandle getLimit() const = 0; ///< get points based bounding box
51  virtual BoxHandle getIndexLimit() const = 0; ///< get index based bounding box (if no index bounding available the points based bounding box is returned)
52 
53  virtual int64_t sizePoint() const = 0;
54  virtual int indexDim() const = 0;
55 
56  virtual int64_t id() const = 0; ///< identifier for direct leaf access by the IPointIndex object
57  virtual int64_t storageId() const = 0; ///< get id of storage manager
58 
59  virtual double estimatePointDensity() const = 0;
60 
61  virtual IPointIndexLeaf* clone() const = 0;
62 
63  // Iterator function ============================================================================
64  virtual const_iterator_point beginPoint() const = 0;
65  virtual const_iterator_point endPoint() const = 0;
66 
67  // access functions ============================================================================
68  virtual PointHandle getPoint(int64_t id) const = 0; ///< get point by id (if the id doesn't exist within the leaf an empty handle is returned)
69 
70  // modifier functions ==========================================================================
71  virtual void addPoint(const IPoint &pt) = 0;
72  virtual void addPoint(PointHandle pt) = 0;
73 
74  virtual void removePoint(int64_t id) = 0;
75 
76  virtual void build() = 0;
77  virtual void clear() = 0;
78 
79  virtual void setChanged(bool changed) = 0;
80  virtual bool isChanged() const = 0;
81 
82  // Spatial access functions =====================================================================
83  virtual void searchPoint(const IWindow &win, insert_iterator_point &instIt, bool includeRightBoundary = true) = 0;
84  virtual void searchPoint(const IBox &box, insert_iterator_point &instIt, bool includeRightBoundary = true) = 0;
85  virtual void searchPoint(const IPolygon &p, insert_iterator_point &instIt) = 0;
86  virtual void searchPoint(const ICircle &c, insert_iterator_point &instIt) = 0;
87  virtual void searchPoint(const ISphere &s, insert_iterator_point &instIt) = 0;
88  virtual void searchPoint(const ICylinder &c, insert_iterator_point &instIt) = 0;
89 
90  virtual void searchPoint(int nnCount, const IPoint &queryPt, insert_iterator_point &instIt,
91  double maxDistance = -1, SelectionMode selectionMode = SelectionMode::nearest) = 0;
92  virtual void searchPoint(int nnCount, const IPoint &queryPt, const IFilter &filter, insert_iterator_point &instIt,
93  double maxDistance = -1, SelectionMode selectionMode = SelectionMode::nearest) = 0;
94 
95  // Comparision operator =========================================================================
96  virtual bool operator==(const IPointIndexLeaf &ref) const = 0;
97  virtual bool operator!=(const IPointIndexLeaf &ref) const = 0;
98 
99 };
100 typedef Handle< IPointIndexLeaf > PointIndexLeafHandle;
101 
102 DM_NAMESPACE_END
Definition: Iterator.hpp:96
2d window object
Definition: IWindow.hpp:11
Geometry object describing a finite 3d cylinder.
Definition: ICylinder.hpp:10
ConstIterator< IPoint > const_iterator_point
Point iterator.
Definition: IPointIndexLeaf.hpp:42
Geometry object describing a 3d box.
Definition: IBox.hpp:11
InsertIterator< IPoint > insert_iterator_point
Point insert iterator (used in searchPoint functions)
Definition: IPointIndexLeaf.hpp:43
interface to a 2.5d polygon of arbitrary complexity
Definition: IPolygon.hpp:33
3d sphere object
Definition: ISphere.hpp:10
object representing a spatial leaf within a point index
Definition: IPointIndexLeaf.hpp:30
Definition: IFilter.hpp:21
Geometry object describing a 2d circle.
Definition: ICircle.hpp:11
Definition: IPointIndexLeaf.hpp:34
Definition: IPointIndexLeaf.hpp:33
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
Definition: M/c++_api/inc/DM/ObjectBase.hpp:8
3d point object
Definition: IPoint.hpp:14