GoLabeledLink Endpoints

Hi Guys,

I’d like to draw the following image:

To draw this object I was thinking of using a GoLabeledLink set with a pen of my width (whatever width) and my color (in this case green) and a RotatedText object (which I converted to VB from your C# example) as the label. The RotatedText’s background color is set to my color (in this case green). Notice that the label draws over top of the link line. For this example imagine the pen width of the link line is 20 points, the text width is 10 points. Link line height will always be greater than text height.

I’m running into trouble drawing this object because the golabeledlink does not connect two objects. Instead, I am setting the reallink’s endpoints explicitly (gll.reallink.setpoint(…)). Is this allowed?. Nothing renders on-screen - I don’t see a link line or text. I think my math is correct for calculating the endpoints. I compute the link’s endpoints in the layoutchildren method within the object that contains the golabeledlink.

From reading the forums it would seem that golabeledlink can handle null to/from nodes/ports. Am I missing something here?

Thanks a lot for your help.

R. Houston

I don’t understand why you’re using GoLabeledLink… it doesn’t seem like you are using the “link” part.

Hi Guys,

Good news - I found my problem, but I’m not sure what to do about it.

As it turns out the golabeled link is being drawn on-screen, just not where I was expecting it to be drawn (it was being obscured).

Even though I set the link begin/end points, the RotatedText’s width, if it were displayed horizontally, is overriding, or rather, influencing the final layout position for the link line. So, if I have a long text string as my link label, “This is a really long text label”, it’s width (if viewed horizontally) will impact how closely I can place the link line to another object. It’s as if the label is establishing a margin of whitespace around the link line itself. I wasn’t expecting this behavior. Even if I turn off editing of the text label, the width of the string still influences this margin of white space around the link line and limits how closely I can place the link line to another object. First off, does my description of the issue make sense? If so, is there a way around it?

Thanks a lot.

R. Houston

Hi Jake,

Well, yes, I am. The ‘link’ portion of the image is a color bar (of sorts), where the height, width, and color of the link line make up the attributes of the color bar. I also want rotated text to accompany the color bar and my undertanding is that rotated text is only supported in the class, RotatedText, and RotatedText’s parent must be a GoLabeledLink (for computing the angle).

Thoughts, suggestions?

Thanks.

R. Houston

GoLabeledLink is a GoGroup. It consists of a link (accessable through RealLink) and the 3 Label parts.

it's declared as:
public class GoLabeledLink : GoGroup, IGoLink, IGoIdentifiablePart, IGoRoutable
so it can "behave" like a GoLink.
So... the GoLabeledLink is a GoGroup that has a bounding rectangle that is the union of the RealLink and Label(s).
But I still don't really understand your problem.... but I'm hoping that info helps anyway.

Hi Jake,

Here’s an image of what I DO want:

Notice how the color bars all stack closely together. This is the image I want to recreate.

Now, here’s a picture of what I am creating, and what I don’t want.

Notice how far apart the color bars are from each other. The third image, below show’s why…

This example illustrates your reply for one GoLabeledLink… that the bounding rectangle of each GoLabeledLink is the union of the reallink and the label. Thus, the width of each GoLabeled Link is the width of the text box (in my example). Actually, the real spacing between the two end bars is much greater, because of their label widths too.

Can you think of any way to create the image at top where the bounding rectangle is only the bounds of the color bar and not the bounds of the color bar AND text bounds? I want to be able to stack these objects close together. Asked another way, is there a way to rotate text without having to tie the rotated text to a GoLabeledLink? Currently, the class, RotatedText, depends on the parent object being a golabeledlink.

Does my example help?

Thanks.

R. Houston

RotatedText does not require a GoLabeledLink. Just set the Angle property.

As you can see by the definition of the Angle getter, if the RotatedText object happens to be a label of a GoLabeledLink, then it automatically computes the Angle, as people sometimes expect. But if it isn’t a child of a GoLabeledLink, Angle is just a simple property.

Regarding the “bounds”, you can call the GetRealBounds() method to get the RectangleF describing the apparent Bounds of the rotated text. The RotatedText.Bounds, as you have seen, remain as if the text were “unrotated”.

Hi Walter,

Thank you . Your explanation helps.

In VB, the Angle property (Getter) throws an exception when casting the parent to a golabeledlink if the parent is not a golabeledlink. Based on your comment, the solution is to test the parent’s type before performing the cast, as in:

if (typeof me.parent is golabeledlink) then
dim ll as GoLabeledLink = directcast(me.parent, GoLabeledLink)

else
return myAngle
end if

Thanks again.

R. Houston