How to create a parabola link between two ports?

In our application, we need to create a parabola link between two ports.

We also need draw the arrowhead in the middle of a curve link(not straight line) and the arrowhead can be dragged as a selection handle of link.
How to do ?

Look at what the StateCharter sample does…

at startup, it sets the default link class for a GoView to create:

  InitializeComponent();
  this.goView1.NewLinkClass = typeof(Transition);

The Transition class (GoLabeledLink) is set up as Bezier:

public Transition() {
  this.Style = GoStrokeStyle.Bezier;

and when a link is created, it sets curviness based on the number of links between the 2 nodes:

// when a link is drawn, make sure it has a text label at the middle
// and appears as a curved arrow
private void goView1_LinkCreated(object sender, Northwoods.Go.GoSelectionEventArgs e) {
  GoLabeledLink l = e.GoObject as GoLabeledLink;
  if (l != null) {
    l.Curviness = 20*this.Doc.NumLinksBetween(l.FromPort, l.ToPort);
    l.CalculateRoute();
  }
}

and the final bit is the setting of AdjustingStyle if the Transition is “Resized”

this.AdjustingStyle = GoLinkAdjustingStyle.Scale;

so that the link keeps the curviness when a node is moved.

ok, so you also want an arrowhead on the midpoint, and also to drag the curviness by dragging the arrowhead?

Jake, Thanks.

Yes, we also need to draw an arrowhead on the midpoint and to drag the curviness by dragging the arrowhead.

ok… this is a big part of what you need then (finding the midpoint)

http://www.nwoods.com/forum/forum_posts.asp?TID=1579

and TwoColorLink in NodeLinkDemo shows how to draw an arrowhead…

which just leaves the problem of what angle to draw the arrowhead to match the link, and I think that problem is solved by looking at the angle of two vectors… you’ve got 4 points in the link (from port, 2 control points and to port). If you draw a line from from port to first control point and a line from the second control point to the to port… then average the slope of those two lines… I’m pretty sure you get the right answer.

But I don’t think I have an example of that.

stackoverflow to the rescue (maybe… haven’t checked the math here)

http://stackoverflow.com/questions/12357200/angle-of-a-given-point-on-a-bezier-curve