17 #include <geos/export.h>
18 #include <geos/index/SpatialIndex.h>
19 #include <geos/geom/Envelope.h>
20 #include <geos/index/strtree/SimpleSTRnode.h>
28 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
71 std::deque<SimpleSTRnode> nodesQue;
72 std::vector<SimpleSTRnode*> nodes;
73 std::size_t nodeCapacity;
86 static void sortNodesY(std::vector<SimpleSTRnode*>& nodeList);
87 static void sortNodesX(std::vector<SimpleSTRnode*>& nodeList);
96 std::vector<SimpleSTRnode*> createHigherLevels(
97 std::vector<SimpleSTRnode*>& nodesOfALevel,
int level);
99 void addParentNodesFromVerticalSlice(
100 std::vector<SimpleSTRnode*>& verticalSlice,
102 std::vector<SimpleSTRnode*>& parentNodes);
104 std::vector<SimpleSTRnode*> createParentNodes(
105 std::vector<SimpleSTRnode*>& childNodes,
121 : nodeCapacity(capacity)
126 std::size_t getNodeCapacity()
const {
130 std::size_t getNumLeafNodes()
const {
134 return root->getNumLeafNodes();
139 bool getBuilt()
const {
143 SimpleSTRnode* getRoot() {
148 void insert(geom::Geometry* geom);
150 void insert(
const geom::Envelope* itemEnv,
void* item)
override;
152 void iterate(ItemVisitor& visitor);
154 void query(
const geom::Envelope* searchEnv, std::vector<void*>& matches)
override;
156 void query(
const geom::Envelope* searchEnv, ItemVisitor& visitor)
override;
158 bool remove(
const geom::Envelope* searchBounds,
void* item)
override;
160 friend std::ostream& operator<<(std::ostream& os,
const SimpleSTRtree& tree);
167 std::pair<const void*, const void*> nearestNeighbour(ItemDistance* itemDist);
170 const void* nearestNeighbour(
const geom::Envelope* env,
const void* item, ItemDistance* itemDist);
173 std::pair<const void*, const void*> nearestNeighbour(SimpleSTRtree& tree, ItemDistance* itemDist);
176 bool isWithinDistance(SimpleSTRtree& tree, ItemDistance* itemDist,
double maxDistance);
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatia...
Definition: SimpleSTRtree.h:65
A node of the STR tree.
Definition: SimpleSTRnode.h:37
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:47
A visitor for items in an index.
Definition: ItemVisitor.h:29
SimpleSTRtree(std::size_t capacity=10)
Definition: SimpleSTRtree.h:120