Esempio n. 1
0
            /// <summary>
            /// Retrieves the items that intersect with the given bounds.
            /// </summary>
            public IEnumerable <T> GetItemsIntersecting(Rect bounds)
            {
                if (TopRight?.Extent.IntersectsWith(bounds) ?? false)
                {
                    foreach (var item in TopRight.GetItemsIntersecting(bounds))
                    {
                        yield return(item);
                    }
                }

                if (TopLeft?.Extent.IntersectsWith(bounds) ?? false)
                {
                    foreach (var item in TopLeft.GetItemsIntersecting(bounds))
                    {
                        yield return(item);
                    }
                }

                if (BottomRight?.Extent.IntersectsWith(bounds) ?? false)
                {
                    foreach (var item in BottomRight.GetItemsIntersecting(bounds))
                    {
                        yield return(item);
                    }
                }

                if (BottomLeft?.Extent.IntersectsWith(bounds) ?? false)
                {
                    foreach (var item in BottomLeft.GetItemsIntersecting(bounds))
                    {
                        yield return(item);
                    }
                }

                //add all the items in this quadrant that intersect the given bounds
                foreach (var item in ItemsInQuadrant)
                {
                    if (item.Bounds.IntersectsWith(bounds))
                    {
                        yield return(item);
                    }
                }
            }