Quintiq file version 2.0
#parent: #root
Method PopulateXPosition (
  output owning shadow[SCVConfiguration] scvConfig,
  shadow[SCVNode] root
) id:Method_FormSupplyChainVisualization_PopulateXPosition
{
  #keys: '[132894.0.868223396]'
  Body:
  [*
    // Go to all child nodes and populate their position
    // We know the depth of the node, so depending if they
    // are upstream or downstream, their X pos are just
    // OffsetX * depth, to the left or to the right of the root
    
    traverse( scvConfig, SCVNode, node )
    {
      offset := node.Depth() * scvConfig.OffsetX();
      if( node.IsUpstream() )
      {
        // Upstream to the left of root
        node.X( root.X() - offset );
      }
      else
      {
        // Downstream to the right of root
        node.X( root.X() + offset );
      } 
    }
  *]
}
