/// <summary>Renders a graphical representation of this tree's cells using the specified shape renderer.</summary> /// <param name="index">The tree to render.</param> /// <param name="shape">The shape renderer to paint with.</param> /// <param name="translation">The translation to apply to all draw operation.</param> public static void Draw<T>(this SpatialHashedQuadTree<T> index, AbstractShape shape, TPoint translation) { foreach (var tree in index.GetTreeEnumerable()) { // ReSharper disable RedundantCast Necessary for FarCollections. tree.Item2.Draw(shape, (Vector2) (tree.Item1 + translation)); // ReSharper restore RedundantCast } }
/// <summary>Creates a deep copy of the object, reusing the given object.</summary> /// <param name="into">The object to copy into.</param> /// <returns>The copy.</returns> public void CopyInto(SpatialHashedQuadTree <T> into) { Copyable.CopyInto(this, into); into._cells.Clear(); foreach (var entry in _cells) { var treeCopy = entry.Value.NewInstance(); entry.Value.CopyInto(treeCopy); into._cells.Add(entry.Key, treeCopy); } into._entryBounds.Clear(); foreach (var bound in _entryBounds) { into._entryBounds.Add(bound.Key, bound.Value); } }