Exemplo n.º 1
0
 /// <summary>
 /// Gets a list of items intersecting a specified rectangle
 /// </summary>
 /// <param name="Rect">The rectangle</param>
 /// <param name="ItemsFound">The list to add found items to (list will not be cleared first)</param>
 /// <remarks>ItemsFound is assumed to be initialized, and will not be cleared</remarks>
 public void GetItems(FRect Rect, ref List <QuadTreePositionItem <T> > ItemsFound)
 {
     // test the point against this node
     if (Rect.Intersects(Rect))
     {
         //CreamXProfiler.StartProfiling(ProfilerName.QuadTreeGetItems);
         // test the point in each item
         foreach (QuadTreePositionItem <T> Item in Items)
         {
             //object o = Item.Parent;
             if (Item.Rect.Intersects(Rect))
             {
                 ItemsFound.Add(Item);
             }
         }
         //CreamXProfiler.StopProfiling(ProfilerName.QuadTreeGetItems);
         // query all subtrees
         if (IsPartitioned)
         {
             TopLeftNode.GetItems(Rect, ref ItemsFound);
             TopRightNode.GetItems(Rect, ref ItemsFound);
             BottomLeftNode.GetItems(Rect, ref ItemsFound);
             BottomRightNode.GetItems(Rect, ref ItemsFound);
         }
     }
 }