haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Quintiq file version 2.0
#parent: #root
Method CreateNodes
{
  Description:
  [*
    Create a node for each component and create the arcs between the nodes. Use dummy nodes so each arc starts at row i and ends at row i + 1.
    
    We expect that the LibOpt_Component.Depth is propagated.
  *]
  TextBody:
  [*
    // Create a node for each component
    traverse( this, Run.Component, component )
    {
      this.UIGraphNode( relnew,
                        Component := component,
                        Row := component.Depth(),
                        Height := 50,
                        Width := 200,
                        Name := component.Name(),
                        ID := this.UIGraphNode( relsize ) );
    }
    
    
    // Create arcs for each link
    // Create dummy nodes so each arc is between 2 adjacent rows.
    traverse( this, Run.Component.Parents, link,
              not link.istype( LibOpt_LinkStart ) )
    {
      origin := link.GetOrigin();
      origin_node := origin.UIGraphNode();
      for( i := origin_node.Row() + 1; i < link.Destination().UIGraphNode().Row(); i++ )
      {
        dummy := this.UIGraphNode( relnew,
                                   Row := i,
                                   Name := origin.Name() + ' -> ' + link.Destination().Name() + ' #' + [String] i,
                                   ID := this.UIGraphNode( relsize ) );
        origin_node.LinkTo( link, dummy );
        origin_node := dummy;
      }
      origin_node.LinkTo( link, link.Destination().UIGraphNode() );
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}