public bool Update(cpBBTree tree) { var root = tree.root; var obj = this.obj; if (!this.ContainsObj(obj)) { this.bb = tree.GetBB(this.obj); root = tree.SubtreeRemove(root, this); tree.root = tree.SubtreeInsert(root, this); //tree.root = SubtreeInsert(root, this, tree); this.ClearPairs(tree); this.stamp = tree.GetStamp(); return(true); } return(false); }
public override void MarkSubtree(cpBBTree tree, Node staticRoot, cpSpatialIndexQueryFunc func) { if (this.stamp == tree.GetStamp()) { if (staticRoot != null) { staticRoot.MarkLeafQuery(this, false, tree, func); } for (Node node = this; node.parent != null; node = node.parent) { if (node == node.parent.A) { node.parent.B.MarkLeafQuery(this, true, tree, func); } else { node.parent.A.MarkLeafQuery(this, false, tree, func); } } } else { var pair = this.pairs; while (pair != null) { if (this == pair.b.leaf) { if (func != null) { func(pair.a.leaf.obj, this.obj, pair.id, null); } pair = pair.b.next; } else { pair = pair.a.next; } } } }