Layer layout option

If you have two nodes with multiple links between them the default “Force layout” shows two nodes with one line (link) between them. If I apply the Layered layout to the view it then shows all of the links between the nodes.

I would like to be able to add my own links and nodes (which I can do) but have the links be displayed using the Layered layout. I can't do this without it moving all of my nodes around. Is there a way to move or redraw just the links?
Thanks
Tim

You can specify a different value of GoLink.Curviness for each link. For example, look at the StateCharter sample, or http://www.nwoods.com/forum/forum_posts.asp?TID=2966.

That seems to work but only after I have moved the node? When the page first comes up, it shows my two nodes and one line. IF I move one of the nodes, the links show up with the curved lines. Can I force the curved lines to show up on the load? is the objectmoved event doing something to the view to update?

I would still like to understand how the GoLayeredDigram changes the links so that they are not over lapping. It seems that they are adding an extra point or two to the link. I have searched and have not found an easy way to alter the link with new points.
I believe link.MakePath().PathPoints has the array of points but how can you add your own points to the array? Or can you?

The result of MakePath is too late in the process.

The main “line” of a link is implemented by a GoLink, which inherits from GoStroke. So the points of the link are accessible and modifiable with GoStroke methods. (Note that if you are using a GoLabeledLink, the link is available via the GoLabeledLink.RealLink property.)

But the computation of the stroke’s points is determined by GoLink.CalculateStroke. That’s what uses the Curviness property to decide what points to use as the route when the stroke has a Bezier style.

Regarding having to move a node to get the routing you want – I’m guessing that your initialization of the link is happening too late. In other words, after GoLink.CalculateStroke has been already been called. You might find that the easiest thing to do is to just call GoLink.CalculateRoute() on each link.

Thank you for the response. I have tried clearing the link pathpoints and using CalculateRoute() , which does give me a different path when using the Beizer style with the curviness property.

What does GoLayeredDigram use to create straight lines but doesn't allow them to overlap? Do I need to add a certain number of points to force the layout I want?
The solution of Biezer with Curviness and CalculateRoute() works but I was hoping to use straight lines between all nodes and have them branch out so that if two or more links are going between the same two nodes they would not overlap like in the GoLayeredDigram layout.
Thanks again
Tim

[code] [Serializable]
public class BentLink : GoLink {
public override void CalculateStroke() {
GoPort from = this.FromPort as GoPort;
GoPort to = this.ToPort as GoPort;
if (from != null && to != null && from.FromSpot == NoSpot && to.ToSpot == NoSpot
&& !this.Orthogonal && !this.IsSelfLoop) {
CalculateLineNoSpot(from, to);
} else {
base.CalculateStroke();
}
}

private void CalculateLineNoSpot(GoPort from, GoPort to) {
  ClearPoints();  // clear this before calling Get[From/To]LinkPoint

  PointF pA = from.GetFromLinkPoint(this.AbstractLink);
  PointF pB = to.GetToLinkPoint(this.AbstractLink);

  AddPoint(pA);
  float rad = this.Curviness;
  float off = Math.Abs(rad);
  if (off > 0.5f) {
    float Dx = pB.X-pA.X;
    float Dy = pB.Y-pA.Y;
    if (rad < 0) off = -off;

    float Mx = pA.X + Dx/2;
    float My = pA.Y + Dy/2;
    float C1x = Mx;
    float C1y = My;
    if (Math.Abs(Dy) < 0.5f) {
      if (Dx > 0)
        C1y -= off;
      else
        C1y += off;
    } else {
      float slope = -Dx/Dy;
      float E = (float)Math.Sqrt(off*off / (slope*slope + 1));
      if (rad < 0) E = -E;
      C1x = (Dy < 0 ? -1 : 1) * E + Mx;
      C1y = slope*(C1x-Mx) + My;
    }
    AddPoint(new PointF(C1x, C1y));
  }
  AddPoint(pB);
}

}[/code]
Of course, you still need to set the GoLink.Curviness values appropriately for each link.

Note that you won’t need this code if GoLink.Orthogonal is true.