ImageEn, unit ievect

TImageEnVect.GetObjDiagLen

TImageEnVect.GetObjDiagLen


Declaration

function GetObjDiagLen(hobj: integer): double;


Description

GetObjDiagLen returns the diagonal length of the specified object.

For a box (image or rectangle) it is the diagonal length. For a line it is the line or ruler length.

Ruler calculates distance differently, so you should use this routine instead:


function FixedGetObjDiagLen(ie: TImageEnVect; hobj: integer): double;
var
  lx, ly: double;
  r: TRect;
begin
  ie.GetObjRect(hobj, r);
  lx := abs(r.Right-r.Left) * ie.MeasureCoefX;
  ly := abs(r.Bottom-r.Top) * ie.MeasureCoefY;
  result := sqrt(lx * lx + ly * ly);
end;