DK for Delphi | GisLayerVector.GisIsPointInsidePolygon | Overloads | Methods | Classes | Prototypes
Determines if point lies inside (or on boundary of) polygon shape. Uses ray-casting (winding number) algorithm. Handles multi-part and polygons-with-holes correctly.
// Delphi function GisIsPointInsidePolygon( const _ptg : TGIS_Point; const _shape : TGIS_ShapePolygon ) : Boolean; overload;
// C++ Builder extern DELPHI_PACKAGE bool GisIsPointInsidePolygon( TGIS_Point* const _ptg, TGIS_ShapePolygon* const _shape ) /* overload */;
| Name | Type | Description |
|---|---|---|
| _ptg | TGIS_Point | Point to test (2D coordinate in layer units). Boundary points return true. |
| _shape | TGIS_ShapePolygon | Polygon shape to test against. Can be simple polygon or multi-part with holes (rings). Must be valid closed polygon. |
| Type | Description |
|---|---|
| Boolean | True if _ptg inside or on boundary of _shape polygon. False if outside all rings. |
PURPOSE:Point-in-polygon query (PIP). Essential for spatial filtering, feature selection, containment tests. Correctly handles polygon holes (exterior + interior rings).
BEHAVIOR:Uses ray-casting/winding number algorithm. Casts ray from point to infinity, counts ring crossings. Even=outside, odd=inside. Handles holes: exterior ring contains, interior rings cut out (donut shapes). Boundary points (on edge) return true.
USAGE:Selection test:if GisIsPointInsidePolygon( mousePos, polygon) then SelectFeature;Filter:foreach shape in layer do if GisIsPointInsidePolygon(queryPt, shape) then Include;
CONSTRAINTS:Tests entire polygon (all parts). For per-part testing, use overload with _part parameter. Polygon must be properly closed. Very large polygons may have precision issues (near boundaries).