ImageEn, unit iexLayers

TIEPolylineLayer.GetPointEx

TIEPolylineLayer.GetPointEx


Declaration

function GetPointEx(index: integer; PointBase: TIEPointBase = iepbRange): TDPoint; overload;
procedure GetPointEx(var pts: TIEDPointArray; Base: TIEPointBase = iepbRange); overload;
procedure GetPointEx(var pts: TIEArrayOfTPoint; Base: TIEPointBase = iepbRange); overload;


Description

Get a point of the polyline.


Examples

with TIEAngleLayer( ImageEnView1.CurrentLayer ) do
  s := Format('(%d, %d) (%d, %d) (%d, %d)', [ GetPointEx( 0, iepbBitmap ).X, GetPointEx( 0, iepbBitmap ).Y,
                                              GetPointEx( 1, iepbBitmap ).X, GetPointEx( 1, iepbBitmap ).Y,
                                              GetPointEx( 2, iepbBitmap ).X, GetPointEx( 2, iepbBitmap ).Y ]);
ShowMessage(s);

// Convert the current polyline layer to a polygon selection
ImageEnView1.BeginSelect();
ImageEnView1.Deselect();
ImageEnView1.SelectionBase := iesbClientArea;
plyr := TIEPolylineLayer( ImageEnView1.CurrentLayer );
ImageEnView1.LayersCurrent := 0;  // Selecting layer 0
for i := 0 to plyr.PointCount - 1 do
begin
  xx := Round( plyr.GetPointEx( i, iepbClientArea).x );
  yy := Round( plyr.GetPointEx( i, iepbClientArea).y );
  ImageEnView1.AddSelPoint(xx, yy);
end;
ImageEnView1.EndSelect();
ImageEnView1.LayersRemove( plyr.LayerIndex );

// Add all the points of one polyline to another
var
  plyr1, plyr2: TIEPolylineLayer;
  i: Integer;
  pt: TDPoint;
begin
  plyr1 := TIEPolylineLayer( ImageEnView1.Layers[1] );
  plyr2 := TIEPolylineLayer( ImageEnView1.Layers[2] );
  for i := 0 to plyr2.PointCount - 1 do
  begin
    pt := plyr2.GetPointEx( i, iepbBitmap );
    plyr1.AddPoint( Round( pt.X ), Round( pt.Y ), iepbBitmap );
  end;

  ImageEnView1.LayersRemove( 2 );
  ImageEnView1.Update();
end;