Quintiq file version 2.0
#parent: CustomDrawComponentRoutingConfigurator/CustomDrawDataLayerOutputPISPNodeInRouting
Response OnDrawObject (
  OperationOutputPISPNode object
) id:Response_CustomDrawComponentRoutingConfigurator_CustomDrawDataLayerOutputPISPNodeInRouting_OnDrawObject
{
  #keys: '[136682.0.370000900]'
  Body:
  [*
    // Draw PISP node in routing
    productimage := guard( select( object.OperationOutput().ProductInStockingPoint_MP().Product_MP(), ProductNode, pn, pn.IconName() <> '', true ).IconName(), '' );
    imagesize := minvalue ( region.Height(), region.Width() );
    
    //Initialize borders
    surface.Pen().Style( PenSpecification::StyleSolid() );
    surface.Pen().Width( 1 )
    surface.Pen().Color( ColorScheme.Outline() );
    
    colorstart := ColorScheme.RoutingConfigurator_PISPNodeInRouting1();
    colorend := ColorScheme.RoutingConfigurator_PISPNodeInRouting2();
    
    if( object.OperationOutput().IsFloating() )
    {
      colorstart := ColorScheme.RoutingConfigurator_FloatingProduct();
      colorend := ColorScheme.RoutingConfigurator_FloatingProduct();
    }
    
    if( not objectinfo.Highlighted()
        and guard( DataHolderHighlightPISPNodeInRouting.Data().Find( object.PISPNodeInRouting() ) >= 0, false ) )
    {
      colorstart := Color::Interpolate( colorstart, Color::Black() );
      colorend := Color::Interpolate( colorend, Color::Black() );
    } 
    
    surface.Brush().LinearGradient( region, colorstart, colorend, 0.0 )
    surface.Fill( region );
    
    
    //Initialize text
    rcv := DataHolderRCView.Data();
    surface.Font().Name( rcv.FontName() );
    surface.Font().Size( rcv.FontSize() );
    surface.TextColor( Color::Black() );
    textformat := TextFormat::Construct( TextFormat::AlignCenter(), TextFormat::AlignMiddle() );
    
    if ( text = '' )
    {
      text := object.OperationOutput().ProductInStockingPoint_MP().Name();
    }
    
    if( productimage <> '' )
    {
      surface.Image( region.Left(), region.Top(), imagesize, imagesize, productimage + '(32)' );
      surface.Text( region.Left() + imagesize , region.Top(), region.Width() - imagesize , region.Height(), text, textformat);
    }
    else
    {
      surface.Text( region, text, textformat );
    }
    
    surface.Rect( region.Left(), region.Top(), region.Width(), region.Height(), Color::Black() );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    return not isnull( object.OperationOutput().PISPOperationOutputEdge() )
  *]
}
