コード例 #1
0
            /// <summary>
            /// Removes an item from this Quadrant.
            /// Returns true if item was found and removed, false otherwise.
            /// </summary>
            public bool Remove(T item, Rect bounds)
            {
                bool removed;

                if (TopRight != null && topRightBounds.Contains(bounds))
                {
                    removed = TopRight.Remove(item, bounds);
                }
                else if (TopLeft != null && topLeftBounds.Contains(bounds))
                {
                    removed = TopLeft.Remove(item, bounds);
                }
                else if (BottomRight != null && bottomRightBounds.Contains(bounds))
                {
                    removed = BottomRight.Remove(item, bounds);
                }
                else if (BottomLeft != null && bottomLeftBounds.Contains(bounds))
                {
                    removed = BottomLeft.Remove(item, bounds);
                }
                else
                {
                    removed = ItemsInQuadrant.Remove(item);
                }

                if (removed)
                {
                    Count--;
                }
                return(removed);
            }