/// <summary> /// Includes a spatial indexing node in these statistics /// </summary> /// <param name="n">The node to include</param> internal void Add(Node n) { m_NumNode++; if (n is RectangleIndex) m_NumParentNode++; m_MaxItemPerNode = Math.Max(m_MaxItemPerNode, n.ItemCount); m_NumItem += n.ItemCount; if (n.ItemCount==0) m_NumEmptyNode++; m_MinSize = Math.Min(m_MinSize, n.Window.Width); m_MinSize = Math.Min(m_MinSize, n.Window.Height); }
/// <summary> /// Creates a child node, remembering it as as child of this node. /// </summary> /// <param name="childWindow">The spatial extent of the new child</param> /// <returns>The created node is either an instance of <see cref="Node"/> (for /// child nodes that are quite small), or a new (smaller) instance of /// this class.</returns> Node CreateChild(Extent childWindow) { // If the child is quite small, make it a leaf node (the number here // means we effectively ignore the 3 low-order bytes in X & Y, meaning // that a leaf node will cover approx 16x16 metres on the ground). Node child; if (childWindow.Width < SMALL && childWindow.Height < SMALL) child = new Node(childWindow); else child = new RectangleIndex(childWindow); if (m_Children==null) m_Children = new List<Node>(1); m_Children.Add(child); return child; }