public void Dispose() { if (FInternalNodeListener != null) { FInternalNodeListener.Dispose(); FInternalNodeListener = null; } if (FPins != null) { foreach (Pin pin in FPins) { pin.Dispose(); } FPins.Clear(); } if (FLabelPin != null) { FLabelPin.Changed -= HandleLabelPinChanged; } if (FNodes != null) { foreach (Node childNode in FNodes) { childNode.Dispose(); } FNodes.Clear(); } FNodeInfoFactory.NodeInfoUpdated -= HandleNodeInfoUpdated; }
/// <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); } } }
/// <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); }