hongji.li
2023-11-07 192c736b8ac4b2d84cb823ac71f17e507948a5e8
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
Quintiq file version 2.0
#parent: CustomDrawComponent/CustomDrawDataLayerGridBackground
Response OnDrawObject (
  MacroPlan object
) id:Response_CustomDrawComponent_CustomDrawDataLayerGridBackground_OnDrawObject
{
  #keys: '[11660.0.348772634]'
  Body:
  [*
    // Draw background image
    if( not isnull( DataHolderView.Data() ) )
    {
      // Draw the background image defined in global parameter unless it's in a drilled down unit
      view := select( MacroPlan, ViewBase.astype( SupplyChainView ), v, v.User() = ApplicationScope.Session().CurrentUser().ShortName() );
      bgimage := guard( view.SupplyChainBackground(), '' );
      focusedunitnode := select( DataHolderView.Data(), Node.astype( UnitNode ), n, n.Unit() = DataHolderFocusedUnit.Data() );
    
      if ( not isnull( focusedunitnode ) )
      {
        bgimage := focusedunitnode.BackgroundImageName();
      }
    
      if ( bgimage <> '' )
      {
        surface.Image( region.Left() , region.Top(), bgimage );
      }
    
      if( DataHolderView.Data().IsGridVisible() )
      {
        surface.Pen().Color( ColorScheme.Grid() ); 
        surface.Pen().Style( PenSpecification::StyleSolid() );
        surface.Pen().Width( 1 );
        
        width := DataHolderView.Data().GridWidth();
        height := DataHolderView.Data().GridHeight();
        grid := DataHolderView.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 );
        }
      }
    }
  *]
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
}