Example #1
0
        private void Insert(QuadNodeItem item)
        {
            if (!IsvalidBounds(item.Bounds))
            {
                throw new ArgumentException("bounds");
            }

            Rect         bounds = item.Bounds;
            QuadTreeNode node   = _RootNode.Insert(item, ref bounds, 1, _MaxDepth);

            _Table[item.Datum] = node;
        }
Example #2
0
 public QuadTreeNode Insert(QuadNodeItem item, ref Rect bounds, int depth, int maxDepth)
 {
     if (depth < maxDepth)
     {
         QuadTreeNode child = GetItemContainerNode(ref bounds);
         if (child != null)
         {
             return(child.Insert(item, ref bounds, depth + 1, maxDepth));
         }
     }
     _Items.Add(item);
     return(this);
 }