IPointIndex.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/Handle.hpp"
5 #include "DM/Iterator.hpp"
6 #include "DM/IPoint.hpp"
7 #include "DM/IPointIndexLeaf.hpp"
8 #include "DM/IAddInfoStatistics.hpp"
9 #include "DM/IIndexStats.hpp"
10 #include "DM/IControlObject.hpp"
11 
12 DM_NAMESPACE_BEGIN
13 
14 /// \brief Interface to a point index object managing the point objects within the datamanager
15 class DM_API IPointIndex : public ObjectBase
16 {
17  public:
18  // Iterator typedefs ============================================================================
19  typedef ConstIterator<IPoint> const_iterator_point; ///< Point iterator
20  typedef InsertIterator<IPoint> insert_iterator_point; ///< Point insert iterator (used in searchPoint functions)
21 
23  typedef Iterator<IPointIndexLeaf> iterator_leaf; ///< Leaf iterator
24  typedef InsertIterator<IPointIndexLeaf> insert_iterator_leaf; ///< Leaf insert iterator (used in searchPoint functions)
25 
26  virtual ~IPointIndex() {}
27 
28  // General memeber functions ====================================================================
29  virtual BoxHandle getLimit() const = 0; ///< get points based bounding box
30  virtual BoxHandle getIndexLimit() const = 0; ///< get index based bounding box (if no index bounding available the points based bounding box is returned)
31 
32  virtual int64_t sizePoint() const=0;
33 
34  virtual int64_t sizeLeaf() const=0;
35 
36  virtual double estimatePointDensity(bool fastEstimation = true) const = 0;
37 
38  // Iterator function ============================================================================
39  virtual const_iterator_point beginPoint(IteratorOrder order = IteratorOrder::internal) const = 0;
40  virtual const_iterator_point endPoint(IteratorOrder order = IteratorOrder::internal) const = 0;
41 
42  virtual const_iterator_leaf beginLeaf(IteratorOrder order = IteratorOrder::internal) const = 0;
43  virtual const_iterator_leaf endLeaf(IteratorOrder order = IteratorOrder::internal) const = 0;
44  virtual iterator_leaf beginLeaf(IteratorOrder order = IteratorOrder::internal) = 0;
45  virtual iterator_leaf endLeaf(IteratorOrder order = IteratorOrder::internal) = 0;
46 
47  virtual const_iterator_leaf beginLeaf(FilterHandle filter, WindowHandle limits = WindowHandle()) const = 0;
48  virtual const_iterator_leaf endLeaf(FilterHandle filter, WindowHandle limits = WindowHandle()) const = 0;
49 
50  virtual PointIndexLeafHandle getLeaf(const_iterator_point &it) = 0;
51  virtual PointIndexLeafHandle getLeaf(int64_t leafId) = 0;
52 
53  // access functions ============================================================================
54  virtual PointHandle getPoint(int64_t id) const = 0; ///< get point by id (if the id doesn't exist an empty handle is returned)
55 
56  // Spatial access functions =====================================================================
57  virtual void searchPoint(const IWindow &win, insert_iterator_point &insIt, bool includeRightBoundary = true, ControlObjectHandle control = ControlObjectHandle()) = 0;
58  virtual void searchPoint(const IBox &box, insert_iterator_point &insIt, bool includeRightBoundary = true, ControlObjectHandle control = ControlObjectHandle()) = 0;
59  virtual void searchPoint(const IPolygon &p, insert_iterator_point &insIt) = 0;
60  virtual void searchPoint(const ICircle &c, insert_iterator_point &instIt) = 0;
61  virtual void searchPoint(const ISphere &s, insert_iterator_point &instIt) = 0;
62  virtual void searchPoint(const ICylinder &c, insert_iterator_point &instIt) = 0;
63 
64  virtual void searchPoint(const IWindow &win, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
65  virtual void searchPoint(const IBox &box, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
66  virtual void searchPoint(const IPolygon &p, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf) = 0;
67  virtual void searchPoint(const ICircle &c, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
68  virtual void searchPoint(const ISphere &s, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
69  virtual void searchPoint(const ICylinder &c, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
70 
71  /// \brief k nearest neighbour search
72  /// potentially slow for the overall point index object. consider building a local kd tree -> IPointIndexLeaf
73  ///
74  /// \param[in] nnCount number of k neighbour to find
75  /// \param[in] queryPt base point for the neighbour search
76  /// \param[in] instIt insert iterator for collecting the found geometry objects
77  /// \param[in] maxDistance maximum distance (not squared distance) for finding geometry objects (use -1 disabling the distance limit)
78  /// \return distance to the furthest found geometry object or 'maxDistance' in case on object was found
79  virtual double searchPoint(int nnCount, const IPoint &queryPt, insert_iterator_point &instIt,
80  double maxDistance = -1) = 0;
81  /// \brief k nearest neighbour search
82  /// potentially slow for the overall point index object. consider building a local kd tree -> IPointIndexLeaf
83  ///
84  /// \param[in] nnCount number of k neighbour to find
85  /// \param[in] queryPt base point for the neighbour search
86  /// \param[in] instIt insert iterator for collecting the found geometry objects
87  /// \param[in] insLeaf leaf inster iterator for storing all leafs for which nearest neighbour points where returned
88  /// \param[in] maxDistance maximum distance (not squared distance) for finding geometry objects (use -1 disabling the distance limit)
89  /// \return distance to the furthest found geometry object or 'maxDistance' in case on object was found
90  virtual double searchPoint(int nnCount, const IPoint &queryPt, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf,
91  double maxDistance = -1) = 0;
92 
93  // Memory consumption functions ================================================================
94  virtual int64_t sizePointCache() const = 0;
95  virtual void sizePointCache(int64_t size) = 0;
96 
97  // efficiency function. access leaf properties without loading point data into memory ===========
98  virtual BoxHandle getLimit(const const_iterator_leaf &it) const = 0;
99  virtual BoxHandle getIndexLimit(const const_iterator_leaf &it) const = 0;
100  virtual int64_t sizePoint(const const_iterator_leaf &it) const = 0;
101  virtual int64_t id(const const_iterator_leaf &it) const = 0;
102 
103  virtual AddInfoStatisticsHandle getAddInfoStatistics() const = 0;
104  virtual AddInfoStatisticsHandle getLeafAddInfoStatistics(const const_iterator_leaf &it) const = 0;
105  virtual IndexStatsHandle getIndexStatistics() const = 0;
106 
107  // get all leafs within window ==================================================================
108  virtual void searchLeaf(const IWindow &win, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
109 
110  //drop all freeable memory object
111  virtual void freeMemory() const = 0;
112 
113  //gives the pointindex a hint for a possible tile size
114  virtual void tileSizeHint(double tilesize) = 0;
115 };
116 
117 typedef Handle< IPointIndex > PointIndexHandle;
118 
119 DM_NAMESPACE_END
Iterator< IPointIndexLeaf > iterator_leaf
Leaf iterator.
Definition: IPointIndex.hpp:23
Definition: Iterator.hpp:96
InsertIterator< IPoint > insert_iterator_point
Point insert iterator (used in searchPoint functions)
Definition: IPointIndex.hpp:20
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: IPointIndex.hpp:19
ConstIterator< IPointIndexLeaf > const_iterator_leaf
Leaf iterator.
Definition: IPointIndex.hpp:22
Geometry object describing a 3d box.
Definition: IBox.hpp:11
interface to a 2.5d polygon of arbitrary complexity
Definition: IPolygon.hpp:33
3d sphere object
Definition: ISphere.hpp:10
IteratorOrder
Definition: Iterator.hpp:9
Interface to a point index object managing the point objects within the datamanager.
Definition: IPointIndex.hpp:15
Definition: Iterator.hpp:17
Geometry object describing a 2d circle.
Definition: ICircle.hpp:11
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
InsertIterator< IPointIndexLeaf > insert_iterator_leaf
Leaf insert iterator (used in searchPoint functions)
Definition: IPointIndex.hpp:24
3d point object
Definition: IPoint.hpp:14