After you develop a class to operate on the entity and the selection set in the previous step, you can select and delete it easily.
You only need to delete the image from the selection set.
(1) Select
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) Cancel Selection
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) Delete
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) // Delete and redraw an object
{
CDC * PDC = g_pview-> getdc ();
M_hand-> deletesolid (PDC );
G_pview-> releasedc (PDC );
}
Void cdelete: onmousemove (uint nflags, cposition POS) // mobile monitor the selected entity
{
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 ;//
}