xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Quintiq file version 2.0
#parent: CustomDrawComponentRoutingConfigurator/CustomDrawDataLayerOperationInputGroupEdge
Response OnDrawObject (
  OperationInputGroupEdge object
) id:Response_CustomDrawComponentRoutingConfigurator_CustomDrawDataLayerOperationInputGroupEdge_OnDrawObject
{
  #keys: '[136682.0.487067637]'
  Body:
  [*
    // Draw PISP Operation Input Edge
    rcv := DataHolderRCView.Data();
    
    // Adjust line based on its orientations
    topdown := object.FromY() < object.ToY();
    leftright := object.FromX() < object.ToX();
    padding := 6;
    
    fromy := region.Top() + padding;
    toy := region.Height() - padding;
    
    inputs := selectset( object, OperationInputGroup.OperationInput, input, true );
    if( topdown )
    {
      if( not leftright )
      {
        fromy := region.Top() + padding;
        toy := region.Height() - padding;
      }
    }
    else
    {
      if( leftright )
      {
        fromy := region.Height() - padding;
        toy := region.Top() + padding;
      }
    }
    
    
    surface.Brush().Reset(); // strange. without this line, the arrow head will not be filled.
    surface.Pen().Color( ColorScheme.Outline() );
    surface.Brush().Color( ColorScheme.Outline() ); // to paint the solid arrowhead
    
    
    // Highlight operation input outputs related to this edge
    operationinputs := selectset( DataHolderHighlightOperationInputOutputNode.Data(),
                                  Elements.astype( OperationInput ),
                                  e,
                                  true,
                                  true );
    ois := inputs.Intersect( operationinputs ); 
    pispnodes := selectset( inputs, Elements.PISPNodeInRouting, pispr, true );
    inpisnodeshighlight := pispnodes.Intersect( DataHolderHighlightPISPNodeInRouting.Data() );  
    
    highlight := ois.Size() >0 or inpisnodeshighlight.Size() >0; 
    if( highlight )
    {
      surface.Brush().Reset(); // strange. without this line, the arrow head will not be filled.
      surface.Pen().Color( Color::DarkGreen() );
      surface.Brush().Color( Color::DarkGreen() ); // to paint the solid arrowhead
    }
    
    surface.Pen().Style( PenSpecification::StyleSolid() );
    surface.Pen().Width( rcv.EdgeThickness() );
    
    // Draw the directional line
    line := GraphicalLine::LineTo( region.Left(), fromy, region.Width(), toy );
    line.ArrowToEnd( true ).ArrowPos( GraphicalLine::ArrowPosMiddle() );
    surface.Draw( line );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    return object.IsVisible();
  *]
}