GEOS  3.9.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 
26 namespace geos {
27 namespace index {
28 namespace strtree {
29 
45 private:
46  const Boundable* boundable1;
47  const Boundable* boundable2;
48  ItemDistance* itemDistance;
49  double mDistance;
50 
51 public:
52  struct BoundablePairQueueCompare {
53  bool
54  operator()(const BoundablePair* a, const BoundablePair* b)
55  {
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 
83  double distance() const;
84 
95  double getDistance() const;
96 
102  bool isLeaves() const;
103 
110  double maximumDistance();
111 
112  static bool isComposite(const Boundable* item);
113 
114  static double area(const Boundable* b);
115 
116  void expandToQueue(BoundablePairQueue&, double minDistance);
117  void expand(const Boundable* bndComposite, const Boundable* bndOther, bool isFlipped, BoundablePairQueue& priQ,
118  double minDistance);
119 };
120 }
121 }
122 }
123 
124 #endif
125 
A pair of Boundables, whose leaf items support a distance metric between them.
Definition: BoundablePair.h:44
const Boundable * getBoundable(int i) const
double distance() const
Computes the distance between the Boundables in this pair. The boundables are either composites or le...
double maximumDistance()
Computes the maximum distance between any two items in the pair of nodes.
double getDistance() const
Gets the minimum possible distance between the Boundables in this pair.
A spatial object in an AbstractSTRtree.
Definition: Boundable.h:25
A function method which computes the distance between two ItemBoundables in an STRtree....
Definition: ItemDistance.h:34
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26