陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: CustomDrawComponentRoutingConfigurator/CustomDrawDataLayerRoutingConfiguratorBackground
Response OnDrawObject (
  Routing object
) id:Response_CustomDrawComponentRoutingConfigurator_CustomDrawDataLayerRoutingConfiguratorBackground_OnDrawObject
{
  #keys: '[113694.1.1940375548]'
  Body:
  [*
    // Draw background image
    
    surface.Pen().Color( ColorScheme.Grid() );
    
    width := DataHolderRCView.Data().GridWidth();
    height := DataHolderRCView.Data().GridHeight();
    grid := DataHolderRCView.Data().GridPointDistance();
    
    for ( x := 0; x < width; x := x + grid )
    {
      surface.Line( x, 0, x, height );
    }
    
    for ( y := 0; y < height; y := y + grid )
    {
      surface.Line( 0, y, width, y );
    }
    
    
    //draw operation drop here!
    if( not object.HasStep() )
    {
      rcv := DataHolderRCView.Data();
      surface.Font().Size( rcv.FontSize() );
      surface.Font().Name(  DataHolderRCView.Data().FontName() );
      surface.TextColor( ColorScheme.RoutingConfigurator_DropHereHelp() );
    
      surface.Pen().Style( PenSpecification::StyleDashed() );
      surface.Pen().Color( ColorScheme.RoutingConfigurator_DropHereHelp() );
      surface.Pen().Width( rcv.EdgeThickness() )
    
      // xy positions of the step
      stepX := rcv.OffsetX()
             + rcv.PISPWidth() + rcv.GridPointDistance() * 2;
    
      stepY := rcv.OffsetY();
    
      stepW := maxvalue( rcv.OperationWidth(), rcv.RoutingStepMinimumWidth() );
    
      value := ( 2 * rcv.OperationInputOutputHeight() )
               + rcv.OperationHeight()
               + 2 * rcv.OperationOffsetY();
    
      stepH := maxvalue( value, rcv.RoutingStepMinimumHeight() );
    
      rect := Shape::Rect( stepX , stepY, stepW, stepH );
      surface.Draw( rect );
    
      textformat := TextFormat::Construct( TextFormat::AlignCenter(), TextFormat::AlignMiddle() );
      surface.Text( stepX , stepY, stepW, stepH, Translations::MP_Routing_DropHereUnit(), textformat );
    }
  *]
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    return guard( DataHolderRCView.Data().IsGridVisible(), false )
           and DataHolderRCView.Data().GridPointDistance() > 0; //prevent infinite loop
  *]
}