www.mxdraw.com
内容索引主面
前一个向上下一个
McDbEllipse 类

此类表示AutoCAD中的椭圆椭圆弧实体。它包含了创建、修改了获取椭圆椭圆弧属性的方法

C++
class McDbEllipse : public McDbCurve;

McDbEllipse.h

例如:绘制椭圆,和椭圆弧代码

    LONG MxDrawXDrawFun::AddToCurrentSpace(McDbEntity* newEnt)
    {
        MrxDbgUtils::addToCurrentSpace(newEnt,m_pDatabase);
        MakeProp(newEnt);

        McDbObjectId id = newEnt->objectId();
        newEnt->close();

        return (LONG)(id.asOldId() );
    }

    LONG MxDrawXDrawFun::DrawEllipse(DOUBLE dCenterX, DOUBLE dCenterY, 
                                     DOUBLE dMajorAxisX, DOUBLE dMajorAxisY,
                                     DOUBLE dRadiusRatio)
    {
        if(MxT::IsZero(m_dLineWidth))
        {
            McGePoint3d  center(dCenterX,dCenterY,0.0);
            McGeVector3d majorAxis(dMajorAxisX,dMajorAxisY,0.0);
            McDbEllipse* pEllipse = new McDbEllipse(center,McGeVector3d::kZAxis,majorAxis,dRadiusRatio);
            return AddToCurrentSpace(pEllipse);
        }
        else
        {
            // 有宽的椭圆暂不能支持,将来只有能通过一个带有宽度的圆的块引用来实现。 
            // ...

            // 这里暂当着没有宽度来处理。

            McGePoint3d  center(dCenterX,dCenterY,0.0);
            McGeVector3d majorAxis(dMajorAxisX,dMajorAxisY,0.0);
            McDbEllipse* pEllipse = new McDbEllipse(center,McGeVector3d::kZAxis,majorAxis,dRadiusRatio);
            return AddToCurrentSpace(pEllipse);

        }
    }

    LONG MxDrawXDrawFun::DrawEllipseArc(DOUBLE dCenterX, DOUBLE dCenterY, DOUBLE dMajorAxisX, 
                                        DOUBLE dMajorAxisY, DOUBLE dRadiusRatio, DOUBLE dStartAng, DOUBLE dEndAng)
    {
        // 有宽的椭圆暂不能支持,将来只有能通过一个带有宽度的圆的块引用来实现。 
        // ...

        // 这里暂当着没有宽度来处理。

        McGePoint3d  center(dCenterX,dCenterY,0.0);
        McGeVector3d majorAxis(dMajorAxisX,dMajorAxisY,0.0);

        McDbEllipse* pEllipse = new McDbEllipse(center,McGeVector3d::kZAxis,majorAxis,
            dRadiusRatio,dStartAng,dEndAng);
        return AddToCurrentSpace(pEllipse);
    }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!