private void Query(object searchBounds, AbstractNode node, ISpatialIndexVisitor visitor) { for (IEnumerator i = node.ChildBoundables.GetEnumerator(); i.MoveNext();) { IBoundable childBoundable = (IBoundable)i.Current; if (!GetIntersectsOp().Intersects(childBoundable.Bounds, searchBounds)) { continue; } if (childBoundable is AbstractNode) { Query(searchBounds, (AbstractNode)childBoundable, visitor); } else if (childBoundable is ItemBoundable) { visitor.VisitItem(((ItemBoundable)childBoundable).Item); } else { Debug.Assert(true); } } }
public void Query(Envelope searchEnv, ISpatialIndexVisitor visitor) { // the items that are matched are the items in quads which // overlap the search envelope root.Visit(searchEnv, visitor); }
private void VisitItems(Envelope searchEnv, ISpatialIndexVisitor visitor) { // would be nice to filter items based on search envelope, but can't until they contain an envelope for (IEnumerator i = m_arrItems.GetEnumerator(); i.MoveNext();) { visitor.VisitItem(i.Current); } }
/// <summary> Also builds the tree, if necessary.</summary> protected void Query(object searchBounds, ISpatialIndexVisitor visitor) { if (!built) { Build(); } if ((itemBoundables.Count == 0)) { Debug.Assert(m_objRoot.Bounds == null); } if (GetIntersectsOp().Intersects(m_objRoot.Bounds, searchBounds)) { Query(searchBounds, m_objRoot, visitor); } }
public void Visit(Envelope searchEnv, ISpatialIndexVisitor visitor) { if (!IsSearchMatch(searchEnv)) { return; } // this node may have items as well as subnodes (since items may not // be wholely contained in any single subnode VisitItems(searchEnv, visitor); for (int i = 0; i < 4; i++) { if (subnode[i] != null) { subnode[i].Visit(searchEnv, visitor); } } }
/// <summary> /// Queries the index for all items whose extents intersect the /// given search <see cref="Envelope"/>, and applies an /// <see cref="ISpatialIndexVisitor"/> to them. /// Note that some kinds of indexes may also return objects which do not in fact /// intersect the query envelope. /// /// </summary> /// <param name="searchEnv">The envelope to query for.</param> /// <param name="visitor"> /// A visitor object to apply to the items found. /// </param> public void Query(Envelope searchEnv, ISpatialIndexVisitor visitor) { //Yes this method does something. It specifies that the bounds is an //Envelope. super.query takes an Object, not an Envelope. [Jon Aquino 10/24/2003] base.Query(searchEnv, visitor); }