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

McEdJig是一个基类,使用派生的自定义类实现拖放功能。这些功能提供了图形表示和用户交互。 实际上jig创建了一个消息循环: 调用实体的worldDraw方法将其绘至屏幕上

C++
class McEdJig;

McEdJig.h

例如:与用户交到,动态插入图块的代码

    class CInsertBlockJig :public McEdJig
    {
    public:
        CInsertBlockJig(AcDbBlockReference* pBlkRef);
        virtual ~CInsertBlockJig(void);

        virtual DragStatus sampler();
        virtual Adesk::Boolean update();
        virtual AcDbEntity* entity() const;

        bool    DoIt(AcGePoint3d& retPt);

    private:
        AcDbBlockReference* m_pBlkRef;
    };

    CInsertBlockJig::CInsertBlockJig(AcDbBlockReference* pBlkRef)
    : m_pBlkRef(pBlkRef)
    {
        ASSERT(m_pBlkRef != NULL);
    }

    CInsertBlockJig::~CInsertBlockJig(void)
    {
    }
    AcEdJig::DragStatus CInsertBlockJig::sampler()
    {
        AcGePoint3d point;

        setUserInputControls((UserInputControls)
            (   McEdJig::kNullResponseAccepted)
            );

        AcEdJig::DragStatus ret = acquirePoint(point);
        if(ret == AcEdJig::kNormal)
        {
            m_pBlkRef->setPosition(point);
        }
        return ret;
    }
    Adesk::Boolean CInsertBlockJig::update()
    {
        return Adesk::kTrue;
    }
    AcDbEntity* CInsertBlockJig::entity() const
    {
        return m_pBlkRef;
    }
    bool    CInsertBlockJig::DoIt(AcGePoint3d& retPt)
    {

        CFilterWinMsg tmpFilterMsg(m_pBlkRef,this);

        MxDraw::RegisterFilterWinMsg(MxDraw::GetCurOcxHandle(),&tmpFilterMsg);

        DragStatus retStatus = drag();

        if(retStatus == AcEdJig::kNormal)
        {
            retPt = m_pBlkRef->position();

            MxDraw::UnRegisterFilterWinMsg(MxDraw::GetCurOcxHandle(),&tmpFilterMsg);
            return true;
        }
        MxDraw::UnRegisterFilterWinMsg(MxDraw::GetCurOcxHandle(),&tmpFilterMsg);
        return false;
    }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!