[geos-commits] r2611 - in trunk/source: headers/geos/index/strtree
index/strtree
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed Jul 15 14:53:03 EDT 2009
Author: pramsey
Date: 2009-07-15 14:53:02 -0400 (Wed, 15 Jul 2009)
New Revision: 2611
Modified:
trunk/source/headers/geos/index/strtree/AbstractSTRtree.h
trunk/source/index/strtree/AbstractSTRtree.cpp
Log:
Add geos::index::strtree::AbstractSTRtree::iterate (#277) Schuyler Erle
Modified: trunk/source/headers/geos/index/strtree/AbstractSTRtree.h
===================================================================
--- trunk/source/headers/geos/index/strtree/AbstractSTRtree.h 2009-07-06 17:35:18 UTC (rev 2610)
+++ trunk/source/headers/geos/index/strtree/AbstractSTRtree.h 2009-07-15 18:53:02 UTC (rev 2611)
@@ -202,6 +202,7 @@
}
virtual AbstractNode* getRoot() {
+ assert(built);
return root;
}
@@ -219,8 +220,6 @@
return matches;
}
#endif
-
-
/// Also builds the tree, if necessary.
void query(const void* searchBounds, ItemVisitor& visitor);
@@ -281,6 +280,13 @@
virtual void query(const void* searchBounds, const AbstractNode* node, std::vector<void*>* matches);
/**
+ * Iterate over all items added thus far. Explicitly does not build
+ * the tree.
+ */
+ void iterate(ItemVisitor& visitor);
+
+
+ /**
* @param level -1 to get items
*/
virtual void boundablesAtLevel(int level, AbstractNode* top,
Modified: trunk/source/index/strtree/AbstractSTRtree.cpp
===================================================================
--- trunk/source/index/strtree/AbstractSTRtree.cpp 2009-07-06 17:35:18 UTC (rev 2610)
+++ trunk/source/index/strtree/AbstractSTRtree.cpp 2009-07-15 18:53:02 UTC (rev 2611)
@@ -288,6 +288,20 @@
}
}
+void
+AbstractSTRtree::iterate(ItemVisitor& visitor)
+{
+ for (BoundableList::const_iterator i=itemBoundables->begin(), e=itemBoundables->end();
+ i!=e; i++)
+ {
+ const Boundable* boundable = *i;
+ if (const ItemBoundable *ib=dynamic_cast<const ItemBoundable *>(boundable))
+ {
+ visitor.visitItem(ib->getItem());
+ }
+ }
+}
+
/*protected*/
std::auto_ptr<BoundableList>
AbstractSTRtree::boundablesAtLevel(int level)
More information about the geos-commits
mailing list