LabeledLink Question

I see on the GoLabeledLink class there is the ability to center the middle label. Is there a way to determine/specify if a centered label goes on top or bottom?

If not how could this be implemented with modifications to GoLabeledLink?

You can implement whatever policy you want by overriding GoLabeledLink.PositionMidLabel.

got that…

quick question in determining coordinate calcs… are all from top left… so x is increasing as i move right from top left and y is increasing as i move down from top left?

That’s right.

All GoObjects use document coordinates, floating-point numbers. Control/GoView coordinates are integers referring to pixels.
There's more discussion start at the bottom of page 39 in the User Guide, "Document Coordinates and Size".

On the method PositionMidLabel(obj, start, end)…

What does “start” and “end” mean? Is it relative to the coordinate system, or to the To/From points on the link?

If it is the later, then are there any convenience methods to to figure out which point to use as the starting (closer to origin) to generate a Point that can be used for the midpoint, or do you have to figure out which “point” is the closer to the coordinate system origin to use as the “starting point”?

Nevermind, stupid question once I drew out the coordinates! Sorry.

If my Link is a GoLabeledLink, and I decide to write my own PositionMidLabel() method, is it valid to:

label.SetSpotLocation(GoObject.MiddleBottom, this.RealLink, GoObject.MiddleTop);

where this is the LabeledLink instance? Will this work on links that are at various angles?

Valid? That depends on what you want. I suspect it wouldn’t produce nice results: what would happen if the link were straight up and down?

So I take it, to compensate for the angles… This is a case where I have to physically calculate the labels “bounds” and set them? If so, any helper methods that make this easy?

Again, it depends on what policies you would want to implement. The math isn’t the hard part if you remember your trigonometry. The hard part is figuring out how to handle all of the cases in a nice manner given the expected label sizes and link lengths and angles.

Ok… So it is gonna take a lot of cases.

Why doesn’t the framework supply a below, as well as the above link for the mid position, so that all of the cases don’t have to be redone?

That’s a good idea.