www.mxdraw.com
内容索引主面
前一个向上下一个
_DMxDrawX::ImpExplodeFun 数据 成员

打碎自定义实体事件回调函数指针

IDL
[id(242) , helpstring("property ImpExplodeFun"), hidden, nonbrowsable]
IDispatch* ImpExplodeFun;

例如:JS

    function ExplodeFun(pCustomEntity, pWorldDraw) {


        var sGuid = pCustomEntity.Guid;
        if (sGuid == "TestMxCustomEntity") {
            if (!pCustomEntity.IsHave("ept"))
                return;

            var stp = pCustomEntity.GetPoint("spt");
            if (stp == null)
                return;

            var ept = pCustomEntity.GetPoint("ept");
            if (ept == null)
                return;

            var mxUtility = mxOcx.NewUtility();
            var vec = ept.SumVector(stp);

            vec.Mult(0.5);

            var midPt = mxOcx.NewPoint();

            midPt.x = stp.x;
            midPt.y = stp.y;
            midPt.Add(vec);

            var dAng = vec.Angle();
            dAng = mxUtility.GetDimAngle(dAng);

            var dDis = 0.0;
            dDis = stp.DistanceTo(ept);

            var sTxt = "L=" + formatNumber(dDis, '#.##');

            dAng = dAng * 180.0 / 3.14159265;

            vec.RotateByXyPlan(3.14159265 / 2.0);
            vec.Normalize();
            vec.Mult(10);

            stp.Add(vec);
            ept.Add(vec);

            pWorldDraw.DrawLine(stp.x, stp.y, ept.x, ept.y);

            vec.Mult(2);

            stp.Sum(vec);
            ept.Sum(vec);

            pWorldDraw.DrawLine(stp.x, stp.y, ept.x, ept.y);

            pWorldDraw.SetColorIndex(1);

            pWorldDraw.DrawText(midPt.x, midPt.y, sTxt, 5, dAng,
                1, 2);

            mxOcx.SetEventRet(1);

        }
    }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!