AnnGetAngle example for Delphi

Procedure TForm1.AnnGetAngle();
var
   hProtractor: HANNOBJECT;
   hPolygon: HANNOBJECT;
   points: Array[0..3] of ANNPOINT;
   uArea: L_UINT;
   dAngle: L_DOUBLE;
begin
   hProtractor:= 0;
   hPolygon:= 0;

 

   LEADAnn1.AnnCreateItem(LEADAnn1.AnnContainer, ANNOBJECT_PROTRACTOR, True, hProtractor);
   LEADAnn1.AnnCreateItem(LEADAnn1.AnnContainer, ANNOBJECT_POLYGON, True, hPolygon);
   

   // Assign values for x and y from 1 through 3
   points[1].X:= 10;
   points[1].Y:= 20;
   points[2].X:= 100;
   points[2].Y:= 200;
   points[3].X:= 200;
   points[3].Y:= 100;
 

   LEADAnn1.AnnSetPoints(hProtractor, @points[1], 3);
 

   points[0].X:= 50;
   points[0].Y:= 220; // SetPoints starts at 0 because No. of points set to 4
 

   LEADAnn1.AnnSetPoints(hPolygon, @points[0], 4);
   LEADAnn1.AnnSetFillMode(hPolygon, ANNFILLMODE_OPAQUE, False);
   Caption:= 'Protractor Bounding Rectangle' +
         ', Left:' + IntToStr(LEADAnn1.AnnBoundingRectLeft[hProtractor]) +
         ', Top:' + IntToStr(LEADAnn1.AnnBoundingRectTop[hProtractor]) +
         ', Width:' + IntToStr(LEADAnn1.AnnBoundingRectWidth[hProtractor]) +
         ', Height:' + IntToStr(LEADAnn1.AnnBoundingRectHeight[hProtractor]);

   LEADAnn1.AnnBringToFront(hPolygon);
   ShowMessage('Brought Polygon to front');
   LEADAnn1.AnnGetArea(hPolygon, uArea);
   Caption:= 'Polygon Area:' + IntToStr(uArea);
   LEADAnn1.AnnSendToBack(hPolygon);
   ShowMessage('Sent Polygon to back');
   LEADAnn1.AnnCut(hPolygon, ANNFMT_WMF, False, True);
   dAngle:= 0;
   LEADAnn1.AnnGetAngle(hProtractor, dAngle);
   Caption:= 'Angle:' + FloatToStr(dAngle);
end;