User Tools

Site Tools


api:dk11:java:tatukgis.jdk.tgis_layervector.locate_tgis_point_double

Table of Contents

TGIS_LayerVector.Locate(TGIS_Point, double) method

DK for Java | tatukgis.jdk.TGIS_LayerVector.Locate | Overloads | Constructors | Fields | Methods | Properties | Events

Locates the nearest shape to a reference point within the specified tolerance distance.

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

Syntax

// Java
public TGIS_Shape Locate(
  TGIS_Point _ptg,
  double _prec
);
// Oxygene
public
  function Locate(
    _ptg : TGIS_Point;
    _prec : Double
  ) : TGIS_Shape; virtual;

Parameters

Name Type Description
_ptg TGIS_Point Reference point used for the search.
_prec double
Double
Maximum search distance. Shapes farther than this tolerance are not returned.

Result

Type Description
TGIS_Shape The nearest matching shape, or nil if no shape is found within the specified tolerance.

Remarks

PURPOSE: Supports interactive hit testing for vector features such as points, arcs/lines, and polygons.

BEHAVIOR: Calls the visible-only overload with _visible set to True.

USAGE: Find the nearest visible shape near a map click.

precision = 5 / viewer.Zoom
shape = layer.Locate(map_point, precision)
if shape is None
  return

CONSTRAINTS: Results are limited to shapes considered visible by the visible-only overload.

If locate is called upon active paint operations then result could be null. But Locate and paint process are using the same vector enumerator context.

It is recommended to check InPaint property before calling this Locate.

2026/09/20 23:58

Page Tools