public void Dispose() { SpatialCollection <T> .DisposeSeenList(ref _SeenList); _Sectors.Dispose(); _Sector = null; }
internal ItemInfo(T item, SpatialCollection <T> parent) { Item = item; Bounds = item.Bounds; TopLeft = parent._Partition.GetIndexFromPoint(Bounds.TopLeft); BottomRight = parent._Partition.GetIndexFromPoint(Bounds.BottomRight); HashCode = item.GetHashCode(); }
public void UpdateItemBoundsDoesNotCallAddRemoveNotificationMethods() { var c2 = new SpatialCollection <BoundedObject>(); var c3 = new SpatialCollection <BoundedObject>(); var a = new BoundedObjectWithParentList(new Vector2(0, 0), new Vector2(15, 15)); Collection.Add(a); c2.Add(a); c3.Add(a); a.Bounds = a.Bounds.Translate(Vector2.One * 128f); foreach (var collection in a.Parents) { var strongCollection = (SpatialCollection <BoundedObject>)collection.Target; strongCollection.UpdateItemBounds(a); } }
public ItemBoundsEnumerator(SpatialCollection <T> collection, SectorIndex tl, SectorIndex br, bool allowDuplicates) { _Collection = collection; _Sectors = new SpatialPartition <Sector> .GetSectorsFromBoundsEnumerator(collection._Partition, tl, br, false); _Sector = null; _Current = null; _SectorEnumerator = default(HashSet <ItemInfo> .Enumerator); _AllowDuplicates = allowDuplicates; if (!allowDuplicates) { _SeenList = SpatialCollection <T> .GetSeenList(); } else { _SeenList = null; } }
public void SetUp() { Collection = new SpatialCollection <BoundedObject>(16); }