/// <summary> /// Also builds the tree, if necessary. /// </summary> /// <param name="searchBounds"></param> /// <param name="visitor"></param> protected virtual void Query(Object searchBounds, IItemVisitor visitor) { if (!built) { Build(); } if (itemBoundables.Count == 0) { Assert.IsTrue(root.Bounds == null); } if (IntersectsOp.Intersects(root.Bounds, searchBounds)) { Query(searchBounds, root, visitor); } }
/// <summary> /// Also builds the tree, if necessary. /// </summary> /// <param name="searchBounds"></param> protected virtual IList Query(object searchBounds) { if (!built) { Build(); } ArrayList matches = new ArrayList(); if (itemBoundables.Count == 0) { Assert.IsTrue(root.Bounds == null); return(matches); } if (IntersectsOp.Intersects(root.Bounds, searchBounds)) { Query(searchBounds, root, matches); } return(matches); }
protected void Query(T searchBounds, IItemVisitor <TItem> visitor) { Build(); if (IsEmpty) { return; } //if (_itemBoundables.Count == 0) //{ // //nothing in tree, so return // //Assert.IsTrue(_root.Bounds == null); // return; //} if (IntersectsOp.Intersects(_root.Bounds, searchBounds)) { Query(searchBounds, _root, visitor); } }
private void Query(T searchBounds, AbstractNode <T, TItem> node, IItemVisitor <TItem> visitor) { foreach (var childBoundable in node.ChildBoundables) { if (!IntersectsOp.Intersects(childBoundable.Bounds, searchBounds)) { continue; } if (childBoundable is AbstractNode <T, TItem> ) { Query(searchBounds, (AbstractNode <T, TItem>)childBoundable, visitor); } else if (childBoundable is ItemBoundable <T, TItem> ) { visitor.VisitItem(((ItemBoundable <T, TItem>)childBoundable).Item); } else { Assert.ShouldNeverReachHere(); } } }
private void Query(T searchBounds, AbstractNode <T, TItem> node, IList <TItem> matches) { foreach (var childBoundable in node.ChildBoundables) { if (!IntersectsOp.Intersects(childBoundable.Bounds, searchBounds)) { continue; } if (childBoundable is AbstractNode <T, TItem> ) { Query(searchBounds, (AbstractNode <T, TItem>)childBoundable, matches); } else if (childBoundable is ItemBoundable <T, TItem> ) { matches.Add(((ItemBoundable <T, TItem>)childBoundable).Item); } else { Assert.ShouldNeverReachHere(); } } }
/// <summary> /// Also builds the tree, if necessary. /// </summary> /// <param name="searchBounds"></param> protected IList <TItem> Query(T searchBounds) { Build(); var matches = new List <TItem>(); if (IsEmpty) { return(matches); } //if (_itemBoundables.Count == 0) //{ // //Assert.IsTrue(_root.Bounds == null); // return matches; //} if (IntersectsOp.Intersects(_root.Bounds, searchBounds)) { Query(searchBounds, _root, matches); } return(matches); }
/// <summary> /// /// </summary> /// <param name="searchBounds"></param> /// <param name="node"></param> /// <param name="visitor"></param> private void Query(object searchBounds, AbstractNode node, IItemVisitor visitor) { foreach (object obj in node.ChildBoundables) { IBoundable childBoundable = (IBoundable)obj; if (!IntersectsOp.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 { Assert.ShouldNeverReachHere(); } } }
private void Query(object searchBounds, AbstractNode node, IList matches) { foreach (var obj in node.ChildBoundables) { var childBoundable = (IBoundable)obj; if (!IntersectsOp.Intersects(childBoundable.Bounds, searchBounds)) { continue; } if (childBoundable is AbstractNode) { Query(searchBounds, (AbstractNode)childBoundable, matches); } else if (childBoundable is ItemBoundable) { matches.Add(((ItemBoundable)childBoundable).Item); } else { Assert.ShouldNeverReachHere(); } } }