Field-Map Scripting

4.4.6.1 GetPolygonIntersectArea_m2

GetPolygonIntersectArea_m2 function


Prototype:

function GetPolygonIntersectArea_m2(const LayerName1: string; const ID1: integer; const LayerName2: string; const ID2: integer): variant;

Description:

The GetPolygonIntersectArea_m2 function calculates the area of the intersection of two polygons.

Syntax:

variable := Project.GetPolygonIntersectArea_m2(Layer1Name, ID1, Layer2Name, ID2);


Part

Description


variable

A variable declared as a variant


Project

A reference to the Field-Map project as defined in Field-Map Project Manager


Layer1Name

Layer2Name

A references to Field-Map layers as defined in Field-Map Project Manager, which contain polygons to intersect


ID1

ID2

IDs of polygons to intersect




Return value:

the area of the intersection as variant


Example:


var

v : variant;

       area,TotArea : double;

       i,n,idCuttingArea,idSubCompartment,nCompartment,nSubCompartment  : integer;

s,f,vdm : string;

c : char;


begin

 ...

 idCuttingArea:= CuttingAreas['ID'];                // ID of the active cutting area

 ...

 Mensuration.First;

while not Mensuration.EOF do begin

   s:=Mensuration['SubCompartmentName'];

   n:=GetFieldCountFromString(s,',');

   if n>1 then c:=','

else begin

     n:=GetFieldCountFromString(s,'.');

     c:='.';

end;

   area:=0;

for i:=0 to n-1 do begin                                // goes through the list of the captured intersections

// finds out the number of the captured intersection - its ID is needed

     f:=GetFieldFromString(s,i,c);

     nSubCompartment:=StrToInt(f);                // the number of the captured intersections

     idSubCompartment:=SubCompartments.GetAttributeValue('ID',format('CompartmentName = %d AND SubCompartmentName = %d',[nCompartment,nSubCompartment]));

     v:=Project.GetPolygonIntersectArea_m2('CuttingAreas',idCuttingArea,'SubCompartments',idSubCompartment);

     if v<>null then area:=area+double(v);        // a list of intersections included in Mensuration

     vdm:=vdm+IntToStr(idSubCompartment)+'|';

end;

   ...

   Mensuration.Next;

end;

end.




See also:

GetPolygonIntersectArea_m2; OverlayPolygonLayers; TransferAttributeValuesFromPolygonsToPointsOrCentroids; GetPoint; GetCentroids; DrawText; DrawPoint; DrawLine; DrawPolygon; DrawCircle; DrawRectangle; FlashPolygon; FlashLine; FlashPoint; SelectedPointCount; SelectedPointID; SelectedLineCount; SelectedLineID; GetCurrentPosition; SetCurrentPosition; SetBasicExtent; GetMapExtent; GetMapFullExtent; GetBasicExtent; ZoomToPolygon; ZoomToLine; MapExtentAsVariant; AddReferencePoint; InvertColors; FindTargetHeight; SetCircularPlotBoundary; TrimLineByPlotBoundary; RefreshMap; RefreshMapRectangle; RefreshTrackingLayer; RefreshTrackingLayerRectangle; ScreenMilimeters2MapDistance_m; MapToScreen; SaveShapesToBlobs; SaveShapesOfCurrentPlotToBlobs; SaveShapesOfAllPlotsToBlobs; ProjectionToWGS84; WGS84ToProjection