Exemplo n.º 1
0
        public void Add(BoxF2D box, T item)
        {
            this._count = this._count + 1;
            if (this._root == null)
            {
                this._root = new RTreeMemoryIndex <T> .Node();

                this._root.Boxes    = new List <BoxF2D>();
                this._root.Children = (IList) new List <T>();
            }
            RTreeMemoryIndex <T> .Node node = RTreeMemoryIndex <T> .Add(RTreeMemoryIndex <T> .ChooseLeaf(this._root, box), box, item, this._minLeafSize, this._maxLeafSize);

            if (node == null)
            {
                return;
            }
            this._root = node;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new item with the corresponding box.
        /// </summary>
        /// <param name="box"></param>
        /// <param name="item"></param>
        public void Add(BoxF2D box, T item)
        {
            _count++;

            if (_root == null)
            { // create the root.
                _root          = new Node();
                _root.Boxes    = new List <BoxF2D>();
                _root.Children = new List <T>();
            }

            // add new data.
            Node leaf = RTreeMemoryIndex <T> .ChooseLeaf(_root, box);

            Node newRoot = RTreeMemoryIndex <T> .Add(leaf, box, item, _minLeafSize, _maxLeafSize);

            if (newRoot != null)
            { // there should be a new root.
                _root = newRoot;
            }
        }