예제 #1
0
 public void Insert(T item)
 {
     if (!RectUtils.Contains(this.m_BoundingRect, item.boundingRect))
     {
         Rect intersection = new Rect();
         if (!RectUtils.Intersection(item.boundingRect, this.m_BoundingRect, out intersection))
         {
             return;
         }
     }
     if (this.m_ChildrenNodes.Count == 0)
     {
         this.Subdivide();
     }
     using (List <QuadTreeNode <T> > .Enumerator enumerator = this.m_ChildrenNodes.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             QuadTreeNode <T> current = enumerator.Current;
             if (RectUtils.Contains(current.BoundingRect, item.boundingRect))
             {
                 current.Insert(item);
                 return;
             }
         }
     }
     this.m_Elements.Add(item);
 }
예제 #2
0
 public void Insert(T item)
 {
     m_Root.Insert(item);
 }