Image and Heping can only use functions related to the object set, and at the same time use the image and Heping class to implement
Class cmirror: Public ccomand
{
Public:
Cmirror ();
Virtual ~ Cmirror ();
Public:
Void onlbuttondown (uint nflags, cposition POS );
Void onmousemove (uint nflags, cposition POS );
Void onrbuttondown (uint nflags, cposition POS );
PRIVATE:
Chandlecg * m_hand;
Ceraseline m_erase_line; // tracing class
Cposition m_begin;
Cposition m_end;
};
Class cmove: Public ccomand // global instant translation command
{
Public:
Cmove ();
Virtual ~ Cmove ();
Public:
Void onlbuttondown (uint nflags, cposition POS );
Void onmousemove (uint nflags, cposition POS );
Void onrbuttondown (uint nflags, cposition POS );
Void onlbuttonup (uint nflags, cposition POS );
Void onmbuttondown (uint nflags, cposition POS );
Void onmbuttonup (uint nflags, cposition POS );
Public:
Cposition m_begin;
Cposition m_end;
};
Cmove: cmove ()
{
M_nstep = 1;
}
Cmove ::~ Cmove ()
{
}
Void cmove: onlbuttondown (uint nflags, cposition POS)
{
}
Void cmove: onmousemove (uint nflags, cposition POS)
{
Switch (m_nstep)
{
Case 2:
{
CDC * PDC = g_pview-> getdc ();
For (INT I = 0; I <(g_pdoc-> m_solid). getsize (); I ++)
{
(G_pdoc-> m_solid [I])-> move (m_begin, POS)-> drawsolid (PDC, normal );
}
For (I = 0; I <g_pdoc-> m_select.getsize (); I ++)
{
(G_pdoc-> m_select [I])-> move (m_begin, POS)-> drawsolid (PDC, normal );
}
M_begin = Pos;
G_pview-> invalidate ();
G_pview-> releasedc (PDC );
}
Break;
Default:
Break;
}
}
Void cmove: onrbuttondown (uint nflags, cposition POS)
{
}
Void cmove: onlbuttonup (uint nflags, cposition POS)
{
M_nstep = 1;
}
Void cmove: onmbuttondown (uint nflags, cposition POS)
{
Switch (m_nstep)
{
Case 1:
{
M_begin = m_end = Pos;
M_nstep ++;
Break;
}
Case 2:
{
M_nstep = 1;
Break;
}
Default:
Break;
}
}
Void cmove: onmbuttonup (uint nflags, cposition POS)
{
M_nstep = 1;
}
Cbasemove: cbasemove () // translation class with base point
{
M_nstep = 1;
}
Cbasemove ::~ Cbasemove ()
{
}
Cmirror: cmirror () // Image
{
M_nstep = 1;
M_hand = new chandlecg (& g_pdoc-> m_solid, & g_pdoc-> m_select );
}
Cmirror ::~ Cmirror ()
{
}
Void cmirror: onlbuttondown (uint nflags, cposition POS)
{
Switch (m_nstep)
{
Case 1: // output prompt information
{
M_begin = Pos;
M_nstep ++;
M_erase_line.setbegin (POS); // eight directions. If the orientation is within the specified range, obtain the coordinates of the clicked point.
Break;
}
Case 2:
{
M_erase_line.setbegin (POS );
CDC * PDC = g_pview-> getdc ();
// M_hand-> mirror (m_begin, POs, normal );
M_nstep = 1;
G_pview-> releasedc (PDC );
}
Default:
Break;
}
}
Void cmirror: onmousemove (uint nflags, cposition POS)
{
M_erase_line.setend (POS );
Switch (m_nstep)
{
Case 2:
CDC * PDC = g_pview-> getdc ();
M_hand-> mirror (m_begin, m_end, drag );
// G_pdoc-> drawsolid (PDC, normal); // redraw
M_hand-> mirror (m_begin, POs, normal );
M_end = Pos;
G_pview-> releasedc (PDC );
Break;
}
}
Void cmirror: onrbuttondown (uint nflags, cposition POS)
{
M_erase_line.setcancle (POS );
}