(9) one-step development of a simple CAD yarn Image

Source: Internet
Author: User

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 );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.