Loading [MathJax]/extensions/tex2jax.js
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 protected:
27  virtual ~IPointIndex() {}
28 
29 public:
30  // General memeber functions ====================================================================
31  virtual BoxHandle getLimit() const = 0; ///< get points based bounding box
32  virtual BoxHandle getIndexLimit() const = 0; ///< get index based bounding box (if no index bounding available the points based bounding box is returned)
33 
34  virtual int64_t sizePoint() const=0;
35 
36  virtual int64_t sizeLeaf() const=0;
37 
38  virtual double estimatePointDensity(bool fastEstimation = true) const = 0;
39 
40  // Iterator function ============================================================================
41  virtual const_iterator_point beginPoint(IteratorOrder order = IteratorOrder::internal) const = 0;
42  virtual const_iterator_point endPoint(IteratorOrder order = IteratorOrder::internal) const = 0;
43 
44  virtual const_iterator_leaf beginLeaf(IteratorOrder order = IteratorOrder::internal) const = 0;
45  virtual const_iterator_leaf endLeaf(IteratorOrder order = IteratorOrder::internal) const = 0;
46  virtual iterator_leaf beginLeaf(IteratorOrder order = IteratorOrder::internal) = 0;
47  virtual iterator_leaf endLeaf(IteratorOrder order = IteratorOrder::internal) = 0;
48 
49  virtual const_iterator_leaf beginLeaf(FilterHandle filter, WindowHandle limits = WindowHandle()) const = 0;
50  virtual const_iterator_leaf endLeaf(FilterHandle filter, WindowHandle limits = WindowHandle()) const = 0;
51 
52  virtual PointIndexLeafHandle getLeaf(const_iterator_point &it) = 0;
53  virtual PointIndexLeafHandle getLeaf(int64_t leafId) = 0;
54 
55  // access functions ============================================================================
56  virtual PointHandle getPoint(int64_t id) const = 0; ///< get point by id (if the id doesn't exist an empty handle is returned)
57 
58  // Spatial access functions =====================================================================
59  virtual void searchPoint(const IWindow &win, insert_iterator_point &insIt, bool includeRightBoundary = true, ControlObjectHandle control = ControlObjectHandle()) = 0;
60  virtual void searchPoint(const IBox &box, insert_iterator_point &insIt, bool includeRightBoundary = true, ControlObjectHandle control = ControlObjectHandle()) = 0;
61  virtual void searchPoint(const IPolygon &p, insert_iterator_point &insIt) = 0;
62  virtual void searchPoint(const ICircle &c, insert_iterator_point &instIt) = 0;
63  virtual void searchPoint(const ISphere &s, insert_iterator_point &instIt) = 0;
64  virtual void searchPoint(const ICylinder &c, insert_iterator_point &instIt) = 0;
65 
66  virtual void searchPoint(const IWindow &win, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
67  virtual void searchPoint(const IBox &box, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
68  virtual void searchPoint(const IPolygon &p, insert_iterator_point &insIt, insert_iterator_leaf &insLeaf) = 0;
69  virtual void searchPoint(const ICircle &c, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
70  virtual void searchPoint(const ISphere &s, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
71  virtual void searchPoint(const ICylinder &c, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf) = 0;
72 
73  /// \brief k nearest neighbour search
74  /// potentially slow for the overall point index object. consider building a local kd tree -> IPointIndexLeaf
75  ///
76  /// \param[in] nnCount number of k neighbour to find
77  /// \param[in] queryPt base point for the neighbour search
78  /// \param[in] instIt insert iterator for collecting the found geometry objects
79  /// \param[in] maxDistance maximum distance (not squared distance) for finding geometry objects (use -1 disabling the distance limit)
80  /// \param[in] selectionMode nearest, quadrant or octant based nn selection
81  /// \return distance to the furthest found geometry object or 'maxDistance' in case on object was found
82  virtual double searchPoint(int nnCount, const IPoint &queryPt, insert_iterator_point &instIt,
83  double maxDistance = -1, SelectionMode selectionMode = SelectionMode::nearest) = 0;
84  /// \brief k nearest neighbour search
85  /// potentially slow for the overall point index object. consider building a local kd tree -> IPointIndexLeaf
86  ///
87  /// \param[in] nnCount number of k neighbour to find
88  /// \param[in] queryPt base point for the neighbour search
89  /// \param[in] instIt insert iterator for collecting the found geometry objects
90  /// \param[in] insLeaf leaf inster iterator for storing all leafs for which nearest neighbour points where returned
91  /// \param[in] maxDistance maximum distance (not squared distance) for finding geometry objects (use -1 disabling the distance limit)
92  /// \param[in] selectionMode nearest, quadrant or octant based nn selection
93  /// \return distance to the furthest found geometry object or 'maxDistance' in case on object was found
94  virtual double searchPoint(int nnCount, const IPoint &queryPt, insert_iterator_point &instIt, insert_iterator_leaf &insLeaf,
95  double maxDistance = -1, SelectionMode selectionMode = SelectionMode::nearest) = 0;
96 
97  // Memory consumption functions ================================================================
98  virtual int64_t sizePointCache() const = 0;
99  virtual void sizePointCache(int64_t size) = 0;
100 
101  // efficiency function. access leaf properties without loading point data into memory ===========
102  virtual BoxHandle getLimit(const const_iterator_leaf &it) const = 0;
103  virtual BoxHandle getIndexLimit(const const_iterator_leaf &it) const = 0;
104  virtual int64_t sizePoint(const const_iterator_leaf &it) const = 0;
105  virtual int64_t id(const const_iterator_leaf &it) const = 0;
106 
107  virtual AddInfoStatisticsHandle getAddInfoStatistics() const = 0;
108  virtual AddInfoStatisticsHandle getLeafAddInfoStatistics(const const_iterator_leaf &it) const = 0;
109  virtual IndexStatsHandle getIndexStatistics() const = 0;
110 
111  // get all leafs within window ==================================================================
112  virtual void searchLeaf(const IWindow &win, insert_iterator_leaf &insLeaf, bool includeRightBoundary = true) = 0;
113 
114  //drop all freeable memory object
115  virtual void freeMemory() const = 0;
116 
117  //gives the pointindex a hint for a possible tile size
118  virtual void tileSizeHint(double tilesize) = 0;
119 };
120 
121 typedef Handle< IPointIndex > PointIndexHandle;
122 
123 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