User Tools

Site Tools


api:dk11:activex:tatukgis_xdk11.itgis_shape.distance2part_itgis_point_double_integer_itgis_point

Table of Contents

ITGIS_Shape.Distance2Part method

DK for ActiveX | TatukGIS_XDK11.ITGIS_Shape.Distance2Part | Methods | Properties

Calculates distance from a point to the nearest element of a specific shape part and optionally returns the projection point.

Available also on: Delphi | .NET | Java | Python.

Syntax

// C#
public double Distance2Part(
  ITGIS_Point _ptg,
  double _prec,
  int _part,
  ref ITGIS_Point _proj
);
' VisualBasic
Public Function Distance2Part(
  ByVal _ptg As ITGIS_Point,
  ByVal _prec As Double,
  ByVal _part As Integer,
  ByRef _proj As ITGIS_Point
) As Double
// Oxygene
public
  function Distance2Part(
    _ptg : ITGIS_Point;
    _prec : Double;
    _part : Integer;
    var _proj : ITGIS_Point
  ) : Double;

Parameters

Name Type Description
_ptg ITGIS_Point Query point for which distance to the shape part is computed.
_prec double
Double
Precision threshold in map units. For polygons, a point inside the shape always returns a distance <= _prec. Negative _prec ignores inside/outside distinction.
_part int
Integer
Zero-based part index. Must be less than GetNumParts.
_proj ITGIS_Point Output point receiving the perpendicular projection of _ptg onto the nearest element of the specified shape part.

Result

Type Description
double
Double
Distance in map units, or -1 if the part index is invalid.

Remarks

PURPOSE: Measure distance to a single part of a multipart geometry, such as one line in a MultiLineString or one ring in a polygon, and obtain the nearest projected point.

BEHAVIOR: Computes the shortest planar distance from _ptg to the specified part using the nearest vertex or segment and stores the closest point in _proj.

CONSTRAINTS: Returns -1 when _part is outside the valid range. This is a planar calculation and does not apply coordinate system transformation.

2026/07/05 01:25

Page Tools