15#ifndef GEOS_INDEX_STRTREE_ABSTRACTSTRTREE_H
16#define GEOS_INDEX_STRTREE_ABSTRACTSTRTREE_H
18#include <geos/export.h>
20#include <geos/index/strtree/AbstractNode.h>
59 ItemsListItem(
void *item_)
64 ItemsListItem(ItemsList* item_)
70 type get_type()
const {
return t; }
72 void* get_geometry()
const
74 assert(t == item_is_geometry);
77 ItemsList* get_itemslist()
const
79 assert(t == item_is_list);
90class ItemsList :
public std::vector<ItemsListItem>
93 typedef std::vector<ItemsListItem> base_type;
95 static void delete_item(ItemsListItem& item)
97 if (ItemsListItem::item_is_list == item.t)
104 std::for_each(begin(), end(), &ItemsList::delete_item);
108 void push_back(
void* item)
110 this->base_type::push_back(ItemsListItem(item));
114 void push_back_owned(ItemsList* itemList)
116 this->base_type::push_back(ItemsListItem(itemList));
152 virtual std::auto_ptr<BoundableList> sortBoundables(
const BoundableList* input)=0;
154 bool remove(
const void* searchBounds,
AbstractNode& node,
void* item);
177 const void* bBounds)=0;
184 std::vector <AbstractNode *> *nodes;
198 assert(!nodeList->empty());
209 virtual void insert(
const void* bounds,
void* item);
212 void query(
const void* searchBounds, std::vector<void*>& foundItems);
216 std::vector<void*>*
query(
const void* searchBounds) {
217 vector<void*>* matches =
new vector<void*>();
218 query(searchBounds, *matches);
228 bool remove(
const void* itemEnv,
void* item);
230 std::auto_ptr<BoundableList> boundablesAtLevel(
int level);
233 std::size_t nodeCapacity;
255 nodeCapacity(newNodeCapacity)
257 assert(newNodeCapacity>1);
260 static bool compareDoubles(
double a,
double b) {
265 return ( a < b ) ? true :
false;
268 virtual ~AbstractSTRtree();
283 virtual void query(
const void* searchBounds,
const AbstractNode* node, std::vector<void*>* matches);
A visitor for items in an index.
Definition ItemVisitor.h:29
A node of the STR tree.
Definition AbstractNode.h:42
A test for intersection between two bounds, necessary because subclasses of AbstractSTRtree have diff...
Definition AbstractSTRtree.h:166
virtual bool intersects(const void *aBounds, const void *bBounds)=0
void iterate(ItemVisitor &visitor)
virtual void insert(const void *bounds, void *item)
Also builds the tree, if necessary.
void query(const void *searchBounds, ItemVisitor &visitor)
Also builds the tree, if necessary.
AbstractSTRtree(std::size_t newNodeCapacity)
Definition AbstractSTRtree.h:250
bool remove(const void *itemEnv, void *item)
Also builds the tree, if necessary.
void query(const void *searchBounds, std::vector< void * > &foundItems)
Also builds the tree, if necessary.
virtual std::size_t getNodeCapacity()
Definition AbstractSTRtree.h:281
virtual std::auto_ptr< BoundableList > createParentBoundables(BoundableList *childBoundables, int newLevel)
virtual void boundablesAtLevel(int level, AbstractNode *top, BoundableList *boundables)
virtual IntersectsOp * getIntersectsOp()=0
A spatial object in an AbstractSTRtree.
Definition Boundable.h:25
Contains 2-D and 1-D versions of the Sort-Tile-Recursive (STR) tree, a query-only R-tree.
Definition SIRtreePointInRing.h:32
std::vector< Boundable * > BoundableList
A list of boundables. TODO: use a list.
Definition AbstractSTRtree.h:44
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25