GoPort from specific point on link

I am creating a family tree and have the Orthogonal property set to true.

The FamilyTree sample that comes with goDiagram is very close to what I want but not quite.
I have modified the code so that the mother and father are side-by-side. I know that this could present an issue down the road with multiple spouses but right now I don't care. That being said, I have a horizontal MarriageLink that "relates" the two of them. The next thing I would like to be able to do is have the GoPort (and it's accompanying structure) that currently sprouts from the opposite end of the link coming out of the father node (i.e. the GoPort "attached" to the mother node) and instead create a port in the middle of the link so the resulting tree looks more like the letter "T" as opposed to an inverted "L".
In the FindChildLink method in the FamilyTreeDoc.cs file there is a line that looks something like this:
GoPort cmp = link.GetOtherPort(cp) as GoPort;
When I looked at the documentation for the GetOtherPort method it said that it returns a port at the opposite end of a link. Instead of getting the port at the opposite end of the link, I would like to be able to specify EXACTLY where on the link line the GoPort should be. Ideally I wish there was a way to create a port directly in the middle of a link but I can't seem to figure out how to do it.
I am in a real jam and need to get this working ASAP.
Thanks in advance!

First, the critical point is that you can assign any GoObject to be the GoLabeledLink.MidLabel, including a GoPort. This will cause that MidLabel object to be positioned at the middle of the middle segment of the link.

Second, it turns out that FamilyTree is already doing this. If you look in FamilyTreeDoc.cs, you'll see that when it constructs a GoLabeledLink, it also creates a new GoPort and assigns it to the MidLabel property. This was desired so that you could tell which marriage produced which children, both logically when traversing the diagram as well as visually.
Third, the reason you don't actually see the links connecting marriage links with the children nodes is because the LayoutTree method purposely changes that port assignment, so that the results look better when there are multiple spouses.
But you don't need to do that. So just remove the following code from LayoutTree:
[code] // put the marriageportforchild near the spouse, to handle
// multiple spouses more reasonably
if (link.FromPort == spousep)
link.FromLabel = mp;
else if (link.ToPort == spousep)
link.ToLabel = mp;[/code]

Walter,

I am now on to my next task of trying to get multiple spouses to show up correctly. Also, things start to get screwy when I start adding nodes "updwards" instead of downwards.
For example:
  1. Every family tree that gets created starts with 1 node.
  2. You can then add parents, a spouse and child etc.
I have few problems when creating additional generations of children and/or grandchildren. I do have problems when I attempt to add grandparents to one of the original parents to the first node and I think I know why.
In the family tree sample code there are some comments about how the original root node gets set.
They look something like this:
// Place all the people where they belong. Start with the parent-less
// person with the lowest ID, call layoutTree() for that person, and
// then call layoutTree() repeatedly while unplaced people remain.
There is a problem with this logic. If I add older generations at a later point in time then they will have higher NodeIDs even though they are the ones that are parentless!!!
So there is a logic conflict. An assumption is made that the higher the number, the later the generation. Even if that logic were reversed it would screw up everything else.
What needs to happen is that additional logic needs to be put in to the effect of "all of the parent-less nodes WHO ALSO HAVE A SPOUSE THAT IS PARENT-LESS ...".
This should (in theory) take care of everything. No?

If you are showing both ancestors and descendants for multiple people, you no longer have a tree structure. I suppose if you were showing them for just a single person, you could do the layout as if there were two trees, one going up and the other going down, starting with that one person. Hmmm, if you have second cousins marrying each other, you don’t have a tree in any case. It gets even more fun when you have a man marrying his own mother, for example.

Anyway, the general solution for these non-tree diagrams is to use GoLayoutLayeredDigraph. Even then, trying to treat spouses specially (i.e. close to each other) will require specialized customizaton of the layout algorithm. I thought we had done that work, but looking at the FamilyTree sample, I think that work is just in the JGo version of the sample.