| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GenerateTree () id:Method_FormSupplyChainVisualization_GenerateTree | 
| { | 
|   #keys: '[132894.0.847789972]' | 
|   Body: | 
|   [* | 
|     // Create SCVNodes from selected PISPIP in Product Planning Matrix | 
|     // This is the entry point of nodes generation and drawing | 
|      | 
|     // First insert SCVConfiguration into the dataholder | 
|     // the MacroPlan will never be null because there is a precon | 
|     // to this method | 
|     if( DataHolderDisplayPISPIP.Data().Size() > 0 ) | 
|     { | 
|       DataHolderSCVConfiguration.Data( shadow( MacroPlan.SCVConfiguration() ) ); | 
|       scvConfig := DataHolderSCVConfiguration.Data(); | 
|      | 
|       scvConfig.Period_MP( relset, DataHolderDisplayPISPIP.Data().Element( 0 ).Period_MP() ) | 
|       pispip := DataHolderDisplayPISPIP.Data().Element( 0 ); | 
|        | 
|       // rootNode represents the current pispip we are selecting | 
|       rootNode := this.CreateSCVPISPIPNode( scvConfig, pispip, true /*isroot*/ ); | 
|        | 
|       // Start generating upstream and downstream nodes | 
|       rootNode.IsDepthLimitMet( false ); | 
|       this.GenerateNodes( scvConfig, pispip, rootNode, scvConfig.UpstreamDepthLimit(), true /*isupstream*/ ); | 
|       rootNode.IsDepthLimitMet( false ); | 
|       this.GenerateNodes( scvConfig, pispip, rootNode, scvConfig.DownstreamDepthLimit(), false /*isupstream*/ ); | 
|        | 
|       // Determine the X position of the root node | 
|       rootNode.X( scvConfig.BorderOffsetX() + scvConfig.UpstreamDepth() * scvConfig.OffsetX() ); | 
|       this.PopulateXPosition( rootNode ); | 
|       this.PopulateDisplaySequence( true /*isupstream*/, rootNode ); | 
|       scvConfig.DisplaySequence( 0 ); | 
|       this.PopulateDisplaySequence( false /*isupstream*/, rootNode ); | 
|       this.PopulateYPosition( true /*isupstream*/ ); | 
|       this.PopulateYPosition( false /*isupstream*/ ); | 
|       this.AdjustTrees(); | 
|        | 
|       scvConfig.Width( max( scvConfig, SCVNode, node, node.X() ) + scvConfig.BorderOffsetX() ); | 
|       scvConfig.Height( max( scvConfig, SCVNode, node, node.Y() ) + scvConfig.BorderOffsetY() ); | 
|        | 
|       CustomDrawComponentSupplyChainVisualization.EnsureVisible( rootNode.X(), rootNode.Y(), 'center', 'center' ); | 
|     } | 
|     else | 
|     { | 
|       DataHolderSCVConfiguration.ClearData(); | 
|     } | 
|   *] | 
| } |