Example #1
0
            public void Dispose()
            {
                SpatialCollection <T> .DisposeSeenList(ref _SeenList);

                _Sectors.Dispose();
                _Sector = null;
            }
Example #2
0
 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();
 }
Example #3
0
        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);
            }
        }
Example #4
0
            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;
                }
            }
Example #5
0
 public void SetUp()
 {
     Collection = new SpatialCollection <BoundedObject>(16);
 }