Now the quastion is - Can I do this using the GoDiagram?
If it’s posible then how can I make such components and links?
There’s no problem with steps, but i don’t know how make transitions, jumps and (Selection or simultaneous) Branches.
Can I make my own component using for example bmp file?
Single horizontal line means OR.
Double horizontal line menas AND.
Short single horizontal line is tranzition with some label (condition)
Arrows menas jumps to step
Step s1 = new Step(); s1.Text = "Step 1"; s1.Location = new PointF(200, 50); doc.Add(s1);
Transition tr1 = new Transition(); tr1.Text = "Trans1"; tr1.Location = new PointF(200, 100); doc.Add(tr1);
LinkSFC(doc, s1, tr1);
Step s2 = new Step(); s2.Text = "Step 2"; s2.Location = new PointF(200, 150); doc.Add(s2);
LinkSFC(doc, tr1, s2);
Transition tr2 = new Transition(); tr2.Text = "Trans2"; tr2.Location = new PointF(200, 200); doc.Add(tr2);
LinkSFC(doc, s2, tr2);
BarNode bar1 = new BarNode(); bar1.Brush = null; bar1.Pen = Pens.Black; bar1.Bounds = new RectangleF(125, 225, 150, 5); doc.Add(bar1);
LinkSFC(doc, tr2, bar1);
Step s3 = new Step(); s3.Text = "Step 3"; s3.Location = new PointF(125, 275); doc.Add(s3);
LinkSFC(doc, bar1, s3);
Step s4 = new Step(); s4.Text = "Step 4"; s4.Location = new PointF(275, 275); doc.Add(s4);
LinkSFC(doc, bar1, s4);
BarNode bar2 = new BarNode(); bar2.Brush = null; bar2.Pen = Pens.Black; bar2.Bounds = new RectangleF(125, 325, 150, 5); doc.Add(bar2);
LinkSFC(doc, s3, bar2); LinkSFC(doc, s4, bar2);
view.FinishTransaction("created Sequential Function Chart"); }
public GoLink LinkSFC(GoDocument doc, GoNode a, GoNode b) { GoLink l = new GoLink(); l.Orthogonal = true; if (a is GoBasicNode) l.FromPort = ((GoBasicNode)a).Port; else if (a is GoTextNode) l.FromPort = ((GoTextNode)a).BottomPort; if (b is GoBasicNode) l.ToPort = ((GoBasicNode)b).Port; else if (b is GoTextNode) l.ToPort = ((GoTextNode)b).TopPort; doc.Add(l); return l; }
If you don’t want to have them implemented by the arrowhead of the link, you can implement them in the same manner as the Transition node, except that the Shape would be a GoPolygon instead of a GoStroke.
If you want to have links always go into a GoBasicNode from the “top”, you can set GoBasicNode.Port.ToSpot = GoObject.MiddleTop.
I’m very grateful for your help.
There’s one more problem to
resolve.
BarNodes elements connect with another elements by means of
orthogonal (right angle) links but when I want to connect two BarNodes, then links are often connected on strange angle. Example:
Do you mean strange because they are not straight lines?
That's because each BarPort is choosing a point closest to the link's other node's center point. Basically, the problem is that there are an "infinite" number of places where a link could reasonably be connected between two parallel BarPorts.
You could help by specifying exactly where you want the link to be by splicing a Trans node into such a link. The Trans node need not have a Label, and its Shape could have zero size.
Maybe this picture are better to present my problem.
Bad connections:
Good connections:
Trans Nodes aren’t BarNodes, they are GoBasicNode with rectangle shape.
Only Nodes without label are BarNodes.
I think, that the problem is becouse link doesn’t known where are ports in Bar nodes.
Trans Nodes has port on the middle top of them.
How can I make that links like good this one in good connection?
That’s why I suggested you not have a direct link between BarNodes, but use a Trans node with no Label and a zero-sized shape as the intermediate node, so that you can position the vertical link where you want to.
Your override of CreateLink can check whether both ports are BarPorts, and if so, it can create a dummy Trans node where you want, connected by two Orthogonal GoLinks, one from the From port to the dummy node, and another from the dummy node to the To port.