GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2016 Daniel Baston 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: index/strtree/BoundablePair.java (JTS-1.14) 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_INDEX_STRTREE_BOUNDABLEPAIR_H 00020 #define GEOS_INDEX_STRTREE_BOUNDABLEPAIR_H 00021 00022 #include <geos/index/strtree/Boundable.h> 00023 #include <geos/index/strtree/ItemDistance.h> 00024 #include <queue> 00025 00040 using namespace geos::index::strtree; 00041 00042 00043 namespace geos { 00044 namespace index { 00045 namespace strtree { 00046 class BoundablePair { 00047 private: 00048 const Boundable* boundable1; 00049 const Boundable* boundable2; 00050 ItemDistance* itemDistance; 00051 double mDistance; 00052 00053 public: 00054 struct BoundablePairQueueCompare { 00055 bool operator()(const BoundablePair* a, const BoundablePair* b) { 00056 return a->getDistance() > b->getDistance(); 00057 } 00058 }; 00059 00060 typedef std::priority_queue<BoundablePair*, std::vector<BoundablePair*>, BoundablePairQueueCompare> BoundablePairQueue; 00061 BoundablePair(const Boundable* boundable1, const Boundable* boundable2, ItemDistance* itemDistance); 00062 00070 const Boundable* getBoundable(int i) const; 00071 00081 double distance() const; 00082 00093 double getDistance() const; 00094 00100 bool isLeaves() const; 00101 00102 static bool isComposite(const Boundable* item); 00103 00104 static double area(const Boundable* b); 00105 00106 void expandToQueue(BoundablePairQueue &, double minDistance); 00107 void expand(const Boundable* bndComposite, const Boundable* bndOther, BoundablePairQueue & priQ, double minDistance); 00108 }; 00109 } 00110 } 00111 } 00112 00113 #endif 00114