ImageEn, unit iexLayers

TIEPolylineLayer.PointInPolygon

TIEPolylineLayer.PointInPolygon


Declaration

function PointInPolygon(X, Y: integer; PointBase: TIEPointBase = iepbClientArea): Boolean;


Description

Returns true if the specified point is within the area of the polygon (as specified by the current points).
PointBase specifies what the type of points X and Y are. The default is iepbClientArea, which means a point within the client area (e.g. as returned by OnMouseMove).

Note:
This method ignores whether the polygon is closed or not (i.e. a polyline is treated as a polygon)
This method will not work with complex polygons (that are made up of multiple polygons)


Example

procedure Tfmain.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if ImageEnView1.CurrentLayer.Kind = ielkPolyline then
  begin
    if TIEPolylineLayer( ImageEnView1.CurrentLayer ).PointInPolygon( X, Y ) then
      Caption := 'Inside Polygon'
    else
      Caption := 'Outside Polygon';
  end
  else
    Caption := 'Not a Polygon';
end;


See Also

PointInShape