/// <summary> /// /// </summary> /// <param name="node"></param> /// <param name="addEnv"></param> /// <returns></returns> public static Node CreateExpanded(Node node, IEnvelope addEnv) { Envelope expandEnv = new Envelope(addEnv); if (node != null) { expandEnv.ExpandToInclude(node._env); } Node largerNode = CreateNode(expandEnv); if (node != null) { largerNode.InsertNode(node); } return(largerNode); }
/// <summary> /// /// </summary> /// <param name="node"></param> public virtual void InsertNode(Node node) { Assert.IsTrue(_env == null || _env.Contains(node.Envelope)); int index = GetSubnodeIndex(node._env, _centre); if (node._level == _level - 1) { Nodes[index] = node; } else { // the quad is not a direct child, so make a new child quad to contain it // and recursively insert the quad Node childNode = CreateSubnode(index); childNode.InsertNode(node); Nodes[index] = childNode; } }