Links Overlapping Issue

I am trying to draw our workflow using GoDiagrams. I use the GoBasicNodes and GoLabeledLink.
The below Figure is what I had at first :
but after adding the swim lanes from the NodeLinkDemo sample provided, the following is what I get:

Have a few problems:

  1. The links overlap.
  2. The link labels overlap too.
  3. Is there a way to set the link labels orientation so that the align with the links
  4. Change the border style of the swim lanes (dashed and gray).
Is there a way we can solve these problems? Any help is greatly appreciated!

Thanks

1 & 2. How are you doing the layout of the top graph?

  1. for rotated text on link labels, see http://www.nwoods.com/forum/forum_posts.asp?TID=3261

  2. sure. that’s just Pen attributes in SwimmingPoolLanes and the Background Rectangle of the SwimLane.

I am using GoLayoutLayeredDigraph.

OK… within subgraphs, you need to do the layout explicitly for the children of the subgraph. You’ll see an example of that in the SubGraphApp sample, where it recursively does layout for each subgraph. Now… in SwimLanes, you know there isn’t a subgraph within a subgraph, so you don’t have to do the recursive part… but you do need to do the layout per SwimLane.

Now… here’s the problem… well, actually 2 problems that I can think so…

  1. SwimLane is fixed width unless you manually resize the borders, so layout probably isn’t going to expand the size of a lane when it needs to.

  2. since you have to layout each lane separately, the cross-lane positioning and links aren’t going to be great.

Hmmm. Let me think about this / play with it a bit.

Here’s code that does a GoLayeredDigraph layout on every SwimmingPool it finds in a GoDocument.

Note it doesn’t do anything to fix up links across lanes. You might be able to handle this (a little) by setting layout.ArrangementOrigin to align with the “from” node in a lane that starts with a “linked to” node.

Note the code works for either GoLayoutDirection.Down or GoLayoutDirection.Right.


    private void menuItemLayoutSwimlanes_Click(object sender, EventArgs e) {
      GoView view = goView1;
      view.Document.StartTransaction();
      foreach (GoObject o in view.Document) {
        if (o is SwimmingPool) {
          SwimmingPool pool = o as SwimmingPool;
          SwimmingPoolLanes lanes = pool.Lanes as SwimmingPoolLanes;
          float max = -1.0f;
          foreach (GoObject s in lanes) {
            SwimLane lane = s as SwimLane;
            if (lane != null) {
              GoLayoutLayeredDigraph layout = new GoLayoutLayeredDigraph();
              layout.Document = view.Document;
              GoLayoutLayeredDigraphNetwork network = layout.CreateNetwork();
              network.AddNodesAndLinksFromCollection(lane, true);
              layout.Network = network;
              float margin = lanes.SwimLaneMargin;
              PointF ao = lane.Position + new SizeF(margin, margin); 
              layout.ArrangementOrigin = ao;
              layout.DirectionOption = GoLayoutDirection.Down;
              layout.PerformLayout();

              // the lane is done, now check to see if the layout area is bigger than the 
              // size of lane.  remember the max across all lanes.
              // Note that LayoutChildren will fix the area in one direction, we're just doing the other here.
              RectangleF content = lane.ContentBounds;
              RectangleF r = lane.Background.Bounds;
              if (lanes.Orientation == Orientation.Vertical) {
                if (content.Right > r.Right - lane.Margin) {
                  float w = content.Right + lane.Margin - r.X;
                  if (w > max) max = w;
                }
              }
              else {
                if (content.Bottom > r.Bottom - lane.Margin) {
                  float h = content.Bottom + lane.Margin - r.Y;
                  if (h > max) max = h;
                }
              }
            }
          }


          // now, bump size of swimlanes if needed.
          if (max > -1.0) {
            foreach (GoObject s in lanes) {
              SwimLane lane = s as SwimLane;
              if (lane != null) {
                if (lanes.Orientation == Orientation.Vertical) {
                  lane.Background.Width = max;
                }
                else {
                  lane.Background.Height = max;
                }
              }
            }
          }
        }
      }
      view.Document.FinishTransaction("layout swimlanes");
    }

Hi Jake I tried out the code you provided but it didn’t really make much difference.
Steps:
1.Created one swimming pool with 3 lanes.
2.Created nodes and added them to swim-lanes.
3.Created links and added them to links-layer.
4.Called the method you provided as is.
The following was the resulting graph:

I then changed the DirectionOption from Down to Right and the following was the resulting graph.

Am I doing something wrong?
Do I need to add the links to the swim-lanes as well?? I tried doing that earlier but then I was not able to see the links on the Graph.

Thanks for you help!

Links should be added to the common parent… for 2 nodes within a lane, the link should be added to the lane. for links across lanes, the links should be in the common parent.

Try calling GoSubGraphBase.ReparentToCommonSubGraph, passing it the link and the two nodes that the link is connected to.

in your sample above, should there be more than a straight line of nodes from “Unsubmitted” to “Closed”?

Hi Jake,

I tried adding the links to the lanes if the nodes are in the same lane and if not tried adding it to a common parent as u suggested but the graph is still not what I expect it to be.

Now even the nodes are laid out correctly in the graph
In this example, there are only 2 nodes in lane 1 and the rest (9) nodes in lane 2. Lane 3 is empty.
I want the nodes to be in one straight line kind of like in a flow chart.
There are 37 or more links connecting those nodes.

I will try to create a sample project and email it to you, so that you have a better idea about what Im trying to do.

Thanks!

Sounds good.

Sent you a sample application via email