示例#1
0
        /// <summary> Get or set the object at a specific point. </summary>
        public object this[Point APoint]
        {
            get
            {
                KDTree.Node LNode = FTree.Query(APoint);
                if (LNode != null)
                {
                    return(LNode.Object);
                }
                else
                {
                    return(null);
                }
            }
            set
            {
                // Remove any item at this spot
                KDTree.Node LNode = FTree.Query(APoint);
                if (LNode != null)
                {
                    FTree.Remove(LNode);
                    FNodes.Remove(LNode.Object);
                }

                // Add the new item at the spot
                if (value != null)
                {
                    LNode = new KDTree.Node(APoint, value);
                    FTree.Add(LNode);
                    FNodes.Add(value, LNode);
                }
            }
        }
示例#2
0
 /// <summary> Removes the object at a given point. </summary>
 public void Remove(object AObject)
 {
     KDTree.Node LNode = (KDTree.Node)FNodes[AObject];
     FTree.Remove(LNode);
     FNodes.Remove(AObject);
 }