GoSubGraph Layers


#1
I have a GoSubGraph with links and nodes and I want always to display nodes above the links. In GoView it's possible to do it by placing nodes and links in a different layers. How can I do the same inside GoSubGraph?

#2

GoGroup keeps a Z-ordering of its children. (It implements IList.) Make sure you insert the links before/behind, and the nodes after/in-front.
GoGroup.Add inserts the object at the end of the list, thus in front of the other children of the group. Presumably you’ll call this for your nodes. GoGroup.InsertAfter(null, aNode) is equivalent.
GoGroup.InsertBefore(null, aLink) inserts the object at the beginning of the list, thus appearing behind any other children in the group. You’ll call this with your links.
What you are asking for is in fact the default behavior for calls to GoSubGraph.ReparentToCommonSubGraph, by GoView.CreateLink and GoToolLinking.DoRelink. But when you are adding nodes and links programmatically, you need to manage this yourself.


#3

Thanks for your answer!
Is there any way to tell SubGraph that it should use backward enumerator (like in GoGroup.Backwards Property) while painting?


#4

You can either override Paint to do what you want, or you can reverse the order of the objects.
But I thought the default order matches what you wanted.


#5

You are right. GoGroup.InsertBefore(null, aLink) reflects my needs. But I was wondering if there are any other ways