Moving Link heads on port boundaries

Hello there,
Just a simple inquiry, as a requirement for our project …we need to freely select and move link heads on the boundary of a port to any selected point on this boundary
NB: Link Head (is the point of intersection between link and and port boundary)
Our Port is type of GOBOXPORT , which takes the size of shape of node containing it (Circle,Diamond … etc)… and Our Link is type of GaLabeled Link Class
So I really appreciate if I can get help in this issue , how could I implement this
Thanks in Advance !!!

Did you want to allow the user to do this separately (individually) for each link? This will require adding some information onto each link, so that GoLink and GoPort can cooperate in determining the right link point and direction.
From your description, the software should figure out the position of the end point of the link by computing the intersection of the link with the outline of the shape. That’s fine, and in fact that’s the standard behavior in GoDiagram when the FromSpot/ToSpot is NoSpot. GoPort.GetLinkPointFromPoint calls GoObject.GetNearestIntersectionPoint.
But how should the user control what direction/angle the link should go from that link point? Must it always be perpendicular to the outline of the shape? Or must it always go towards the center of the link’s other port? Or some other criteria?

let me try to clarify my question ... if you got a node with rectangle shape and this node has one GoBoxPort with the same boundaries of the rectangle node shape .

When you link it the link enters by default in the middle of the rectangle side (horizontal/vertical) so my question is what to Do if I want to freely move this point(link head) among the rectangle boundaries (as shown in Fig. Below)

Occasionally people ask for this kind of functionality, so I’ll see if I can produce an example implementation. It may take a while…

Hi There, I just want to inquire if there is any progress concerning this issue,as my post was almost 3 month ago, as it is an important requirement for our project I really appreciate if I can get help.Thanks in advance.

OK, I took some free time and wrote something that might meet your needs. There’s an AdjustableConnectionBoxPort class and an AdjustableConnectionLink class that work together.
AdjustableConnection.cs [now in Demo1 sample; removed from web site]
For simplicity, I assume that the user-adjusting functionality is only available when the link is not Relinkable, since otherwise you would need to deal with the same handle being used for two purposes. That is quite possible to implement, but I’m going to leave that as an exercise for the reader, at least until I get some more free time.

Hi Walter,
Thank you very much , really appreciating your support it works fine …
But I face another simple problem… I am using GoLabeledLink … when I override CreateRealLink in MyGoLabeledLink Class to return an Instance on AdjustableConnectionLink class … Personally I was expecting the same behavior … But this is not the case … nothing happens.
now do you advice me to change myLink classes to inherit GoLink instead of GoLabeledLink and add label to link as in Processor Sample or there is a way to do the same behavior with GoLabeledLink directly
Another inquiry , in your Code in the funtion
public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj) in AdjustableConnectionLink class …
the line GoHandle h = sel.FindHandleByID(this, GoLink.NoHandle) as GoHandle;
gives compilation error " Northwoods.Go.GoSelection’ does not contain a definition for ‘FindHandleByID’ " … I had commented it to test the code…but I am wondering if there is new version of GoDiagram and how I can get it ? … I am currently using version 2.2.1.0

Thanks in advance

Hi, I tried to add a label to the link like processor sample .. but I failed cause I must use GolabeledLink .. that inherits GoGroup ..which returns me to the same case.. How I can use your code with GolabeledLink .. if there is any missing step that I should add to make GoLabeledlink behaves as required I will appreciate your fast response Thanks

Ah, the DoResize method was passing the GoLink for the AdjustableConnectionBoxPort to remember, rather than the GoLabeledLink. It needed to pass the GoLink.AbstractLink, which would be the labeled link. I have updated the file on our web site.

Thanks a lot … It works great… appreciating your effort

Sorry to use this post, but I need the AdjustableConnectionLink code that worked with GoLabeledLink.

The code gave by walter is no longer availlable, and the Demo1 sample only use a Golink. (and so, no DoResize method to override)



(I hope it is really the code I need: I want to change the direction of a GoLabeledLink’s start or end, because actually, the link goes everytimes to the left.)



Thank for your help.

There is an AdjustableConnectionLabeledLink class at the end of AdjustableConnectionLink. (Demo1 is called NodeLinkDemo in 4.0)