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;
Example
l := ImageEnVect1.GetObjDiagLen( hobj );
Transition Information
If you are transitioning your code to
TImageEnView Layers, instead of GetObjDiagLen, use:
TIELayer.RulerValue
d := ImageEnView1.CurrentLayer.RulerValue;