The main use of Function:
IMxDrawCurve::GetClosestPointTo2
Returns the length of the curve, as explained below:
parameter | Explanation |
---|---|
[in] IMxDrawPoint* givenPnt |
Any point |
[in] VARIANT_BOOL isExtend |
Not supported |
[out,retval] IMxDrawPoint** pPointOnCurve |
Return the nearest point on the curve |
js code point curve around to find the nearest point on the curve to achieve the following:
var
ent = mxOcx.GetEntity(
"选择曲线:"
);
if
(ent ==
null
)
return
;
var
curve;
if
(ent.ObjectName ==
"McDbSpline"
)
{
curve =ent;
}
else
{
alert(
"实体类型不对"
);
return
;
}
var
getPt1 = mxOcx.GetPoint(
false
,0,0,
"\n 点取一个点:"
);
if
(getPt1 ==
null
)
{
alert(
"用户取消.."
);
return
;
}
var
ClosestPoint = curve.GetClosestPointTo2(getPt1,
false
);
var
grtClosestPointx = ClosestPoint.x;
var
grtClosestPointy = ClosestPoint.y;
alert(grtClosestPointx);
alert(grtClosestPointy);
|