I am wondering how I would select a link, delete that link and delete everything that comes underneath that link. So if I have A—>B-----C----->D and I deleted the link from B–C, then the nodes C and D and the link between them would get deleted.
Right now I am using the SelectionDeleting Event handler
What I would like is for basically any node that does not have any incoming links after a link is deleted, to also be deleted. So a random floating node with no links attached to it will never be on screen.
Is there a way to remove everything? Like, if I remove a link, remove everything that stems from that link or removing the node, everything is removed, like how the Tree App works? Basically handling both cases?
ok… replace AddSubtrees in TreeDraggingTool with this:
// extend the collection by recursively adding all of the destination links and nodes
// of all of the collection's nodes and links
public static void AddSubtrees(IGoCollection sel) {
Hashtable coll = new Hashtable();
foreach (GoObject o in sel) {
GoObject obj = o;
IGoLink link = obj as IGoLink;
if (link != null)
{
obj = (GoObject)link.ToNode;
}
AddReachable(coll, obj as IGoNode);
}
foreach (GoObject obj in coll.Keys) {
sel.Add(obj);
}
}