ImageEn, unit iexLayers

TIEPolylineLayer.SetPoints

TIEPolylineLayer.SetPoints


Declaration

// Point array overloads
procedure SetPoints(Points: array of TPoint; PointBase: TIEPointBase = iepbRange); overload;
procedure SetPoints(Points: array of TPoint; ClosePolyline: Boolean; PointBase: TIEPointBase = iepbRange); overload;
procedure SetPoints(Points: array of integer; ClosePolyline: Boolean; PointBase: TIEPointBase = iepbRange); overload;
procedure SetPointsD(Points: array of TDPoint; Count: Integer; PointBase: TIEPointBase); overload;

// Shape fill overload
procedure SetPoints(Shape: TIEShape; ClosePolyline: Boolean = True); overload;

// Arc overload
procedure SetPoints(StartAngle, SweepAngle: Double; PtCount: Integer = 0); overload;

// String overload
procedure SetPoints(const Points: string; ClosePolyline: Boolean; ScalePoints: Boolean = true); overload;


Description

Set the points of the polyline.
Each point of the polyline is represented by an x and y value in the range 0 to 1000. Where (0, 0) is the top-left pixel of the layer and (1000, 1000) is the bottom-right.
If you use the Shape overload, the point array will be filled with a TIEShape.
You can use the string overload to import point lists from other sources. It should be formatted as follows x1,y1,x2,y2,x3,y3, etc. Spaces, tabs and hard returns can be used instead of commas. If ScalePoints is true the layer will maintain its existing size (any range of input values can be used and will fill the existing layer).

PolylineClosed will be set to ClosePolyline.


Example

// Draw a triangle polygon
With TIEPolylineLayer( ImageEnView1.CurrentLayer ) do
begin
  ClearAllPoints();
  AddPoint( 500, 0 );
  AddPoint( 1000, 1000 );
  AddPoint( 0, 1000 );
  PolylineClosed := True;
end;
ImageEnView1.Update();

// Which is the same as..
var
  shapePoints: array of TPoint;
begin
  SetLength( shapePoints, 3 );
  shapePoints[0] := Point( 500, 0 );
  shapePoints[1] := Point( 1000, 1000 );
  shapePoints[2] := Point( 0, 1000 );
  TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( shapePoints, True );
  ImageEnView1.Update();
end;

// Which is the same as...
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( [ Point(500, 0), Point(1000, 1000), Point(0, 1000) ], True );
ImageEnView1.Update();

// Which is the same as...
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesTriangle, True );
ImageEnView1.Update();



// If PolylineClosed is not enabled, we get a polyline, instead of a polygon
TIEPolylineLayer( ImageEnView1.CurrentLayer ).PolylineClosed := False;
ImageEnView1.Update();



// Fill points with Star shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesStar5, True );



// Fill points with Explosion shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesExplosion, True );



// Fill points with Arrow shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesShootingArrowSW, True );



// Fill points with Lightning shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesLightningLeft, True );



// Fill layer with arc from 270 (6 o'clock) anti-clockwise to 180 (9 o'clock)
StartAngle := 270;
EndAngle   := 90;
SweepAngle := EndAngle - StartAngle + 360;
if SweepAngle >= 360 then
  SweepAngle := SweepAngle - 360;
TIEPolylineLayer( ImageEnView1.CurrentLayer).SetPoints( StartAngle, SweepAngle );


// Add a polygon based on a string
triangleStr := '250, 0, 0, 500, 500, 500';
ImageEnView1.LayersAdd( ielkPolyline, 100, 100, 400, 400 );
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( triangleStr, True );
ImageEnView1.Update();

// Insert a polygon (closed polyline) of a star
ImageEnView1.LayersAdd( ielkPolyline, 100, 100, 400, 400 );
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( [ 125,0, 155,95, 250,95, 175,155, 202,250, 125,193, 48,250, 78,155, 0,95, 98,95 ], True, iepbBitmap );
ImageEnView1.Update();


See Also

 Points
 GetPoints
 AddPoint
 SetPoint
 RemovePoint