GEOS  3.6.1
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 
40 using namespace geos::index::strtree;
41 
42 
43 namespace geos {
44 namespace index {
45 namespace strtree {
46 class BoundablePair {
47  private:
48  const Boundable* boundable1;
49  const Boundable* boundable2;
50  ItemDistance* itemDistance;
51  double mDistance;
52 
53  public:
54  struct BoundablePairQueueCompare {
55  bool operator()(const BoundablePair* a, const BoundablePair* b) {
56  return a->getDistance() > b->getDistance();
57  }
58  };
59 
60  typedef std::priority_queue<BoundablePair*, std::vector<BoundablePair*>, BoundablePairQueueCompare> BoundablePairQueue;
61  BoundablePair(const Boundable* boundable1, const Boundable* boundable2, ItemDistance* itemDistance);
62 
70  const Boundable* getBoundable(int i) const;
71 
81  double distance() const;
82 
93  double getDistance() const;
94 
100  bool isLeaves() const;
101 
102  static bool isComposite(const Boundable* item);
103 
104  static double area(const Boundable* b);
105 
106  void expandToQueue(BoundablePairQueue &, double minDistance);
107  void expand(const Boundable* bndComposite, const Boundable* bndOther, BoundablePairQueue & priQ, double minDistance);
108 };
109 }
110 }
111 }
112 
113 #endif
114 
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
A spatial object in an AbstractSTRtree.
Definition: Boundable.h:25
Contains 2-D and 1-D versions of the Sort-Tile-Recursive (STR) tree, a query-only R-tree...
Definition: SIRtreePointInRing.h:32