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; 
 | 
  *] 
 | 
} 
 |