IPolylineIndex.hpp
1 #ifndef DM_ILINE_INDEX_HPP_INCLUDED
2 #define DM_ILINE_INDEX_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/Handle.hpp"
10 #include "DM/Iterator.hpp"
11 #include "DM/IGeometry.hpp"
12 #include "DM/IIndexStats.hpp"
13 #include "DM/IBox.hpp"
14 #include "DM/SpatialQueryMode.hpp"
15 
16 DM_NAMESPACE_BEGIN
17 
18 /// \brief Interface to an polyline and polygon index object managing all non point objects within the datamanager
19 class DM_API IPolylineIndex : public ObjectBase
20 {
21  public:
22  // Iterator typedefs ============================================================================
23  typedef ConstIterator<IGeometry> const_iterator_geometry; ///< Geometry iterator
24  typedef ConstIterator<IPolyline> const_iterator_line; ///< Polyline iterator
25 
26  typedef InsertIterator<IGeometry> insert_iterator_geometry; ///< Geometry insert iterator (used in searchGeometry functions)
27  typedef InsertIterator<IPolyline> insert_iterator_line; ///< Polyline insert iterator (used in searchPolyline functions)
28 
29  virtual ~IPolylineIndex() {}
30 
31  // General memeber functions ====================================================================
32  virtual BoxHandle getLimit() const = 0;
33 
34  virtual int64_t sizeGeometry() const = 0;
35 
36  virtual int64_t sizePolyline() const = 0;
37  virtual int64_t sizePolylinePoint() const = 0;
38 
39  virtual int64_t sizePolygon() const = 0;
40  virtual int64_t sizePolygonPoint() const = 0;
41 
42  // access functions ============================================================================
43  virtual PolylineHandle getPolyline(int64_t id) const = 0;
44  virtual PolygonHandle getPolygon(int64_t id) const = 0;
45  virtual GeometryHandle getGeometry(int64_t id) const = 0;
46 
47  // modifier functions ==========================================================================
48  virtual int64_t addPolyline(PolylineHandle l) = 0;
49 
50  virtual void replacePolyline(PolylineHandle l) = 0;
51 
52  /// remove an element by its id
53  virtual void remove(int64_t id) = 0;
54 
55  // Iterator function ============================================================================
56  virtual const_iterator_geometry beginGeometry(E_IteratorOrder order = eORDER_INTERNAL) const = 0;
57  virtual const_iterator_geometry endGeometry(E_IteratorOrder order = eORDER_INTERNAL) const = 0;
58 
59  virtual const_iterator_line beginPolyline(E_IteratorOrder order = eORDER_INTERNAL) const = 0;
60  virtual const_iterator_line endPolyline(E_IteratorOrder order = eORDER_INTERNAL) const = 0;
61 
62  // Spatial access functions =====================================================================
63  virtual void searchGeometry(const IWindow &win, SpatialQueryMode::Type mode, insert_iterator_geometry &instIt, bool includeRightBoundary = true) = 0;
64  virtual void searchGeometry(const IBox &box, SpatialQueryMode::Type mode, insert_iterator_geometry &instIt, bool includeRightBoundary = true) = 0;
65  virtual void searchGeometry(const IPolygon &p, SpatialQueryMode::Type mode, insert_iterator_geometry &instIt) = 0;
66 
67  /// \brief k nearest neighbour search
68  /// \param[in] nnCount number of k neighbour to find
69  /// \param[in] queryPt base point for the neighbour search
70  /// \param[in] instIt insert iterator for collecting the found geometry objects
71  /// \param[in] maxDistance maximum distance (not squared distance) for finding geometry objects (use -1 disabling the distance limit)
72  /// \return distance to the furthest found geometry object or 'maxDistance' in case on object was found
73  virtual double searchGeometry(int nnCount, const IPoint &queryPt, insert_iterator_geometry &instIt,
74  double maxDistance = -1) = 0;
75 
76  // Statistics memeber functions ====================================================================
77  virtual IndexStatsHandle getIndexStatistics() const = 0;
78 };
79 
80 typedef Handle< IPolylineIndex > PolylineIndexHandle;
81 
82 DM_NAMESPACE_END
83 
84 #endif //DM_ILINE_INDEX_HPP_INCLUDED