GEOS  3.12.0
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 #pragma once
20 
21 #include <geos/index/strtree/Boundable.h>
22 #include <geos/index/strtree/ItemDistance.h>
23 #include <queue>
24 
25 namespace geos {
26 namespace index {
27 namespace strtree {
28 
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 
82  double distance() const;
83 
94  double getDistance() const;
95 
101  bool isLeaves() const;
102 
109  double maximumDistance();
110 
111  static bool isComposite(const Boundable* item);
112 
113  static double area(const Boundable* b);
114 
115  void expandToQueue(BoundablePairQueue&, double minDistance);
116  void expand(const Boundable* bndComposite, const Boundable* bndOther, bool isFlipped, BoundablePairQueue& priQ,
117  double minDistance);
118 };
119 
120 }
121 }
122 }
A function method which computes the distance between two ItemBoundables in an STRtree. Used for Nearest Neighbour searches.
Definition: ItemDistance.h:33
double maximumDistance()
Computes the maximum distance between any two items in the pair of nodes.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25
double distance() const
Computes the distance between the Boundables in this pair. The boundables are either composites or le...
A spatial object in an AbstractSTRtree.
Definition: Boundable.h:24
double getDistance() const
Gets the minimum possible distance between the Boundables in this pair.
A pair of Boundables, whose leaf items support a distance metric between them.
Definition: BoundablePair.h:43
const Boundable * getBoundable(int i) const