zoukankan      html  css  js  c++  java
  • (7)一步一步开发一个CAD之对实体集及选择集进行删除,捡选

    上一步开发了对实体和选择集进行操作的类后,再实现捡选,删除就很简单了

    删除图形只要把图形从选择集中删掉就可以了

    (1)选择

    class CSelect : public CComand
    {
    public:
     CSelect();
     virtual ~CSelect();
    public:
     void OnLButtonDown(UINT nFlags,  CPosition pos);
        void OnMouseMove(UINT nFlags,  CPosition pos);
    private:
     CHandleCG* m_hand;
     
    };

    CSelect::CSelect()
    {
     m_hand = new CHandleCG(&g_pDoc->m_solid, &g_pDoc->m_select);
    }

    void CSelect::OnLButtonDown(UINT nFlags,  CPosition pos)
    {
        m_hand->AddSelect();
    }

    void CSelect::OnMouseMove(UINT nFlags,  CPosition pos)
    {
        CDC *pDC = g_pView->GetDC();
        float dis = PICK_RADIU * ( g_pView->m_scale );
     m_hand->DrawSelect(pDC, pos, dis, Normal, Select);
    }

    CSelect::~CSelect()
    {

     delete m_hand;//
    }

    (2)取消选择

    class CUnSelect : public CComand
    {
    public:
     CUnSelect();
     virtual ~CUnSelect();
    public:
     void OnLButtonDown(UINT nFlags,  CPosition pos);
        void OnMouseMove(UINT nFlags,  CPosition pos);
    private:
     CHandleCG* m_hand;
     
    };

    CUnSelect::CUnSelect()
    {
     m_hand = new CHandleCG(&g_pDoc->m_select, &g_pDoc->m_solid);
    }

    void CUnSelect::OnLButtonDown(UINT nFlags,  CPosition pos)
    {
        m_hand->AddSelect();
    }

    void CUnSelect::OnMouseMove(UINT nFlags,  CPosition pos)
    {
        CDC *pDC = g_pView->GetDC();
        float dis = PICK_RADIU * ( g_pView->m_scale );
     m_hand->DrawSelect(pDC, pos, dis, Select, Normal);
     g_pView->ReleaseDC(pDC);
    }

    CUnSelect::~CUnSelect()
    {

     delete m_hand;//
    }

    (3)删除

    class CDelete : public CComand
    {
    public:
     CDelete();
     virtual ~CDelete();
    public:
     void OnLButtonDown(UINT nFlags,  CPosition pos);
        void OnMouseMove(UINT nFlags,  CPosition pos);
    private:
     CHandleCG* m_hand;
     
    };

    CDelete::CDelete()
    {
     m_hand = new CHandleCG(&g_pDoc->m_select, &g_pDoc->m_solid);
    }
    void CDelete::OnLButtonDown(UINT nFlags,  CPosition pos)//删除实体并重画
    {  
     CDC *pDC = g_pView->GetDC();
        m_hand->DeleteSolid(pDC);
     g_pView->ReleaseDC(pDC);
    }

    void CDelete::OnMouseMove(UINT nFlags,  CPosition pos)//移动监测选中的实体
    {
        CDC *pDC = g_pView->GetDC();
        float dis = PICK_RADIU * ( g_pView->m_scale );
     m_hand->DrawSelect(pDC, pos, dis, Select, Normal);
     g_pView->ReleaseDC(pDC);
    }

    CDelete::~CDelete()
    {

     delete m_hand;//
    }

  • 相关阅读:
    ToDesk 远程连接软件 连接远程电脑后黑屏
    Kentico updateall
    Stylesheet not loaded because of MIME-type
    Linux tail 命令作用及其常用用法
    浅析Linux中stty命令的作用、常用用法及案例使用
    【MySQL】修改表的存储引擎
    【MySQL】查看MySQL的默认存储引擎(Win环境)
    【Swing/STS】在Spring Tool Suite中制作可执行jar
    [Swing]我的作品 图片幻灯式浏览软件PicturesShow 献给广大美图爱好者的福音
    【Java Swing】如何给Jframe添加键盘和鼠标事件处理
  • 原文地址:https://www.cnblogs.com/lizhengjin/p/1289266.html
Copyright © 2011-2022 走看看