/// <summary> Get or set the element at a specific point. </summary> public object this[Point point] { get { KDTree.Node node = _tree.Query(point); if (node != null) { return(node.Object); } else { return(null); } } set { // Remove any item at this spot KDTree.Node node = _tree.Query(point); if (node != null) { _tree.Remove(node); _nodes.Remove(node.Object); } // Add the new item at the spot if (value != null) { node = new KDTree.Node(point, value); _tree.Add(node); _nodes.Add(value, node); } } }
/// <summary> Removes the object at a given point. </summary> public void Remove(object element) { KDTree.Node node = (KDTree.Node)_nodes[element]; _tree.Remove(node); _nodes.Remove(element); }