public void VisitItemsByBounds( IsoRect bounds, IContentLookUpper look_upper) { if (bounds.Overlaps(SelfBounds)) { for (int i = 0, e = Items.Count; i < e; ++i) { var item = Items[i]; if (bounds.Overlaps(item.Bounds)) { look_upper.LookUp(item.Content); } } for (int i = 0, e = Nodes.Length; i < e; ++i) { var node = Nodes[i]; if (node != null) { node.VisitItemsByBounds(bounds, look_upper); } } } }
void BackwardVisitNodes(Node node, IsoRect bounds, IContentLookUpper loop_upper) { while (node != null) { for (int i = 0, e = node.Items.Count; i < e; ++i) { var item = node.Items[i]; if (bounds.Overlaps(item.Bounds)) { loop_upper.LookUp(item.Content); } } node = node.Parent; } }