yanweiyuan3
2023-08-09 fd693f0faf305ec98d7ea03e09fe6787817e71d7
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
Quintiq file version 2.0
#parent: CustomDrawComponentSupplyChainVisualization/CustomDrawDataLayerSCVEdge
Response OnDetermineRegion (
  shadow[SCVEdge] object
) id:Response_CustomDrawComponentSupplyChainVisualization_CustomDrawDataLayerSCVEdge_OnDetermineRegion
{
  #keys: '[132894.0.877947950]'
  Body:
  [*
    // Determine region for Edge
    scvconfig := DataHolderSCVConfiguration.Data();
    padding := 6;
    
    sourceNode := select( scvconfig, SCVNode, node,
                          object.DestinationKey() = node.Key().AsQUILL() );
    
    targetNode := select( scvconfig, SCVNode, node,
                          object.OriginKey() = node.Key().AsQUILL() );
    
    adjustmentX := scvconfig.NodeSize();
    adjustmentY := floor( scvconfig.NodeSize() / 2 );
    
    region := construct( Polygon );
    x0 := ifexpr( sourceNode.IsUpstream(), sourceNode.X(), targetNode.X() ) + adjustmentX;
    y0 := ifexpr( sourceNode.IsUpstream(), sourceNode.Y(), targetNode.Y() ) + adjustmentY;
    x1 := ifexpr( sourceNode.IsUpstream(), targetNode.X(), sourceNode.X() );
    y1 := ifexpr( sourceNode.IsUpstream(), targetNode.Y(), sourceNode.Y() ) + adjustmentY;
    
    // Adding points in a polygon must be in a clockwise manner
    region.AddPoint( x0, y0 + padding );
    region.AddPoint( x1, y1 + padding );
    region.AddPoint( x1, y1 - padding );
    region.AddPoint( x0, y0 - padding );
    
    this.AddRegion( region );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDetermineRegion'
}