#region CPL License /* Nuclex Framework Copyright (C) 2002-2007 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; using System.Diagnostics; namespace Nuclex.Support.SpatialPartitioning { /// Node in a two-dimensional R-Tree /// Type of items that the R-Tree manages internal class RTreeNode2 { /// Initializes a new R-Tree node /// Number of items that can fit in the node public RTreeNode2(int capacity) { this.leafs = new RTreeLeaf2[capacity]; this.leafCount = 0; } /// Inserts an item into this node /// Item to be inserted /// Bounding rectangle of the item private void insertEntry(ItemType item, BoundingRectangle boundingRectangle) { Debug.Assert(leafCount < this.leafs.Length); this.leafs[this.leafCount].Item = item; this.leafs[this.leafCount].BoundingRectangle = boundingRectangle; BoundingRectangle.CreateMerged( ref this.boundingRectangle, ref boundingRectangle, out this.boundingRectangle ); } /// The node's minimum bounding rectangle /// /// This bounding rectangle is just large enough to contain all the items /// belonging to this node and recursively all of its child nodes. /// private BoundingRectangle boundingRectangle; /// Leafs of this node private RTreeLeaf2[] leafs; /// Number of leafes in use private int leafCount; } } // namespace Nuclex.Support.SpatialPartitioning