Rotating Nodes and Ports

I implemented the rotating sample for a gonode.
everything work very well except for thwe ports. the ports shape is moving but the connecting point stay on the same place. how can i get the ports aligned?

Do the links snap to the ports as soon as you move the node?

No, it snap to the same place before i rotated the node - it look like an invisible port where the link line is.

The ports are the green squares, right? Can you start a new link from them, or are they a green square that doesn’t act like a port after rotating?

The green squares is the selection handles, the ports is the two arrows. if you look at the node on the right top that is the original node with two arrows (ports). if you look at the left bottem port that is the rotated node with the arrows (Ports). the line that stops on the left of the rotated node is the real port, in other words the arrows rotated to indicate where the ports must be after the rotation but the lines still link on the same place as the original node.

sigh. Sometimes I think I should finish my first coffee before answering questions here. I looked at that all wrong the first time.

OK, the ports have to be wired to answer the questions that links need for connecting to them.
GetFromLinkPoint / GetToLinkPoint
GetFromLinkDir / GetToLinkDir
I think that will help.

i am not sure if we miss each other, i got a little test app for you where ccan i mail it to?


OK… your rotation is a RotateTransform in the middle of Paint. That visually rotates things, but Go still thinks all the objects are at the X,Y you started at with a zero-degree rotation. So, the port triangle is drawn in the rotated position, but the GoPort itself is where it always was. (You can start a new link if you mouse-down where the link ends.)

You've already figured this out with selection handles... you create them, then move them to where they really need to be.
You need to do the same thing with Ports... move them in the LayoutChildren to be where the rotation implies they should be. Once you get that working, then you need to look to my earlier note about FromLinkDir, etc, because that will be your next issue.
What you may want to do is get rid of the RotateTransform and use GoDrawing with StartAt, LineTo, etc (with the x,y's calculated to be the rotated locations) to define your icons. That way, Go will really be drawing what is there, not some transform of reality.

Thanks Jake - i never dived so deep into the graphics engine, can you please help out with a example?

There’s a section on “GoDrawing and Predefined Figures” in the 3.0 User Guide. GoDrawing supports Rotation…

For example, to create a “Rounded I-Beam” shape that looks somewhat like a capital “I” with concave curves:

GoDrawing s = new GoDrawing();
s.StartAt(0, 0);
s.LineTo(100, 0);
s.CurveTo(50, 25, 50, 75, 100, 100);
s.LineTo(0, 100);
s.CurveTo(50, 75, 50, 25, 0, 0);

This will work if i want to create my own shapes, not to rotate existing shapes.