User Tools

Site Tools


api:dk11:delphi:gisfunctions.gisispointinsideextent_tgis_point_tgis_extent

Table of Contents

GisIsPointInsideExtent method

DK11 for Delphi | GisFunctions.GisIsPointInsideExtent | Fields | Methods

Test if a given point is inside a given extent.

Syntax

// Delphi
function GisIsPointInsideExtent(
  const _ptg : TGIS_Point;
  const _extent : TGIS_Extent
) : Boolean; inline;
// C++ Builder
extern DELPHI_PACKAGE bool GisIsPointInsideExtent(
  TGIS_Point* const _ptg,
  TGIS_Extent* const _extent
);

Parameters

Name Type Description
_ptg TGIS_Point point to test
_extent TGIS_Extent polygon to test

Result

Type Description
Boolean True point is inside an extent

Remarks

This is an example of using GisIsPointInsideExtent function.

Suppose we have a GIS object of TGIS_ViewerWnd class.

Here is a simple procedure to make some tests.

procedure MyClass.GISMouseMove(X,Y,test: Integer);
var
  shp : TGIS_Shape ;
  ptgA : TGIS_Point ;
  shp_ : TGIS_ShapePolygon ;
  l,k : TGIS_Line;
begin
  // get a layer
  ll  := TGIS_LayerVector( GIS.Get('realpoints') );
  shp := ll.GetShape(1) ;
 
  // calculate position on the map
  ptgA := GIS.ScreenToMap( Point(x,y) ) ;
 
  // make tests
  case test of
    1 : if GisIsPointInsideExtent( ptgA, GIS.Extent ) then
             shp.SetPosition( ptgA, nil, 0 );
    2 : if GisIsPointInsidePolygon( ptgA, shp_ ) then
             shp.SetPosition( ptgA, nil, 0 );
    3 : if GisIsLinesCommonPoint( l, k) then
             shp.SetPosition( ptgA, nil, 0 );
    4 : if GisGetLinesCrossing( l,k,ptgA) then
             shp.SetPosition( ptgA, nil, 0 );
  end;
end;
2022/10/06 10:42

Page Tools