GEOS  3.9.1dev
BoundablePair.h
Go to the documentation of this file.
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 
24 #include <queue>
25 
26 namespace geos {
27 namespace index {
28 namespace strtree {
29 
45 private:
49  double mDistance;
50 
51 public:
53  bool
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 
void expand(const Boundable *bndComposite, const Boundable *bndOther, bool isFlipped, BoundablePairQueue &priQ, double minDistance)
const Boundable * getBoundable(int i) const
double getDistance() const
Gets the minimum possible distance between the Boundables in this pair.
void expandToQueue(BoundablePairQueue &, double minDistance)
static bool isComposite(const Boundable *item)
BoundablePair(const Boundable *boundable1, const Boundable *boundable2, ItemDistance *itemDistance)
std::priority_queue< BoundablePair *, std::vector< BoundablePair * >, BoundablePairQueueCompare > BoundablePairQueue
Definition: BoundablePair.h:60
A function method which computes the distance between two ItemBoundables in an STRtree. Used for Nearest Neighbour searches.
Definition: ItemDistance.h:34
double maximumDistance()
Computes the maximum distance between any two items in the pair of nodes.
Basic namespace for all GEOS functionalities.
bool operator()(const BoundablePair *a, const BoundablePair *b)
Definition: BoundablePair.h:54
A spatial object in an AbstractSTRtree.
Definition: Boundable.h:25
double distance() const
Computes the distance between the Boundables in this pair. The boundables are either composites or le...
A pair of Boundables, whose leaf items support a distance metric between them.
Definition: BoundablePair.h:44
static double area(const Boundable *b)