GEOS  3.8.0dev
BoundablePair.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2016 Daniel Baston
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: index/strtree/BoundablePair.java (JTS-1.14)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_INDEX_STRTREE_BOUNDABLEPAIR_H
20 #define GEOS_INDEX_STRTREE_BOUNDABLEPAIR_H
21 
22 #include <geos/index/strtree/Boundable.h>
23 #include <geos/index/strtree/ItemDistance.h>
24 #include <queue>
25 
39 namespace geos {
40 namespace index {
41 namespace strtree {
42 
43 class BoundablePair {
44 private:
45  const Boundable* boundable1;
46  const Boundable* boundable2;
47  ItemDistance* itemDistance;
48  double mDistance;
49 
50 public:
51  struct BoundablePairQueueCompare {
52  bool
53  operator()(const BoundablePair* a, const BoundablePair* b)
54  {
55  return a->getDistance() > b->getDistance();
56  }
57  };
58 
59  typedef std::priority_queue<BoundablePair*, std::vector<BoundablePair*>, BoundablePairQueueCompare> BoundablePairQueue;
60  BoundablePair(const Boundable* boundable1, const Boundable* boundable2, ItemDistance* itemDistance);
61 
69  const Boundable* getBoundable(int i) const;
70 
80  double distance() const;
81 
92  double getDistance() const;
93 
99  bool isLeaves() const;
100 
101  static bool isComposite(const Boundable* item);
102 
103  static double area(const Boundable* b);
104 
105  void expandToQueue(BoundablePairQueue&, double minDistance);
106  void expand(const Boundable* bndComposite, const Boundable* bndOther, BoundablePairQueue& priQ, double minDistance);
107 };
108 }
109 }
110 }
111 
112 #endif
113 
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25