Declaration
TIEPolylineLayer = class(TIELayer);
Description
TImageEnView supports multiple layers, allowing the creation of a single image from multiple source images (which can be resized, rotated, moved, etc).
TIEPolylineLayer is a descendent of
TIELayer that displays a line formed from multiple points. It can also be closed to display a polygon.

You can easily add curved lines to polyline layers:

You can create polyline layers with code using
LayersAdd or by user action by setting
MouseInteractLayers:
Item | Description |
mlClickCreatePolylineLayers | Click multiple points to create a polyline layer |
mlDrawCreatePolylineLayers | Click and drag to freehand draw a polyline layer |
mlEditLayerPoints | Click and drag points to move them. Click on the polyline to add a point, Alt key to convert a point to a curve, Ctrl+click or delete key to remove a point |
mlCreatePolylineLayers | Drag the area of a polyline layer (must use code to add points) |
* Auto-closing of the polyline layer is controlled by
LayersAutoClosePolylines.
Review the
Layer Documentation for a full description of layer support.
Demos
Demo | Description | Demo Project Folder | Compiled Demo |
Line Layer Editing | Creating and point editing line, poly-line and angle layers | LayerEditing\Layers_Lines\Layers.dpr | |
All Layer Editing | Usage of image, shape, text and line layers | LayerEditing\Layers_AllTypes\Layers.dpr | |
Magic Fill to Polygon | Creates a polygon (closed TIEPolylineLayer) by performing a magic selection on an image (matching color range) | LayerEditing\MagicFillToPolygon\Magic2Polygon.dpr | |
Examples
// 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();

// Allow users to create and edit a polygon
ImageEnView1.LayersAutoClosePolylines := iecmAlways;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers, mlEditLayerPoints ];
// Allow users to freehand draw a polyline
ImageEnView1.MouseInteractLayers := [ mlDrawCreatePolylineLayers, mlEditLayerPoints ];
// Allow users to create and edit a polyline
ImageEnView1.LayersAutoClosePolylines := iecmManual;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers, mlEditLayerPoints ];

Hold Alt to convert a line to a curve...

Methods and Properties
GeneralPolygon PointsStyleSize and Position
Unique to TIEPolylineLayer
See Also
-
Layer Editing Overview-
LayersAdd-
LayersInsert-
MouseInteractLayers-
AdvancedDrawPolyline