haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
Method GetLinePolygon (
  NumberVector vect
) as internal[Polygon] id:Method_LibOpt_FormComponentGraph_GetLinePolygon
{
  #keys: '[139164.3.1008855746]'
  Body:
  [*
    poly := construct( Polygon );
    
    scale_x := ValueHolderScaleX.Data();
    scale_y := ValueHolderScaleY.Data();
    
    scale := minvalue( scale_x, scale_y );
    
    for( i := 0; i < vect.Size() - 3; i := i + 2 )
    {
      poly.AddPoint( vect.Get( i ), vect.Get( i + 1 ) );
    }                     
    x := vect.Get( vect.Size() - 2 );
    y := vect.Get( vect.Size() - 1 );
    
    arrow_size := maxvalue( 3, 12 - maxvalue( 2, 2 / scale ) );
    arrow_size_x := [Number] ( arrow_size * scale / 2 );
    arrow_size_y := [Number] ( arrow_size * scale );
    
    poly.AddPoint( x, y - arrow_size_y );     
    poly.AddPoint( x - arrow_size_x, y - arrow_size_y );
    poly.AddPoint( x, y );
    poly.AddPoint( x + arrow_size_x, y - arrow_size_y );
    poly.AddPoint( x, y - arrow_size_y );
    for( i := vect.Size() - 4; i > 1; i := i - 2 )
    {
      poly.AddPoint( vect.Get( i ), vect.Get( i + 1 ) );
    }
    
    
    return & poly;
  *]
  Declarative: true
  ReturnsOwning: true
}