admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
47
48
49
50
51
52
53
54
55
56
Quintiq file version 2.0
#parent: #root
Method CreateSCVEdge (
  shadow[SCVNode] owner,
  shadow[SCVNode] inputnode,
  Boolean isupstream,
  Process_MP process
) as shadow[SCVEdge] id:Method_FormSupplyChainVisualization_CreateSCVEdge
{
  #keys: '[132894.0.863091930]'
  Body:
  [*
    // Create SCVEdge
    
    // Retrieve the quantity that should be displayed on the edge
    
    // The concept of edge building is:
    // The edges are owned by the node 
    // that has more edges, so that 
    // the node doesn't have to remember
    // that many keys, but only one key, which is the key
    // of the single edge that points to the node                      
    scvedge := owner.SCVEdge( relnew,
                              IsUpstream := isupstream,
                              DestinationKey := inputnode.Key().AsQUILL(),
                              OriginKey := owner.Key().AsQUILL() );  
    
    // Append destination nodes keys to scvedge
    // We need to store the node as key because all these are shadow
    // and in shadow objects, only the owner has acess to the children
    // The children DON'T have access to their owner, since edge doesn't 
    // own node, the only way for edge to find its nodes is to remember 
    // their keys 
    inputnode.OwnerNodeKey( owner.Key().AsQUILL() );
    inputnode.Depth( owner.Depth() + 1 );
    owner.IsUpstream( isupstream );
    inputnode.IsUpstream( isupstream );
    
    // Update the depth of the tree, better to update the max depth here
    // rather than after we have created all the nodes
    depth := 0;
    scvConfig := DataHolderSCVConfiguration.Data();
    if( isupstream )
    { 
      depth := maxvalue( inputnode.Depth(), scvConfig.UpstreamDepth() )
      scvConfig.UpstreamDepth( depth );
    }
    else
    { 
      depth := maxvalue( inputnode.Depth(), scvConfig.DownstreamDepth() )
      scvConfig.DownstreamDepth( depth );
    }
    
    return scvedge;
  *]
}