MULTILINE.cpp
上传用户:shangwu01
上传日期:2013-04-22
资源大小:707k
文件大小:3k
- // MULTILINE.cpp: implementation of the CMULTILINE class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "CAD.h"
- #include "MULTILINE.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CMULTILINE::CMULTILINE()
- {
- }
- CMULTILINE::~CMULTILINE()
- {
- }
- void CMULTILINE::multline_drawMove(CPoint m_pointfal,CDC *pDC,int m_line_style,int m_line_width,COLORREF m_line_color)
- {
- CPen pen;
- pen.CreatePen(m_line_style,m_line_width,m_line_color);
- pDC->SelectObject(&pen);
- pDC->TextOut(5,5,"Double click to finish the multiline");
- if(m_pointtemp.GetSize()>=2)
- for(int i=0;i<m_pointtemp.GetSize()-1;i++)
- {
- pDC->MoveTo(((CPoint *)(m_pointtemp.GetAt(i)))->x,((CPoint *)(m_pointtemp.GetAt(i)))->y);
- pDC->LineTo(((CPoint *)(m_pointtemp.GetAt(i+1)))->x,((CPoint *)(m_pointtemp.GetAt(i+1)))->y);
- }
- if(m_pointtemp.GetSize())
- {
- pDC->MoveTo((((CPoint *)m_pointtemp.GetAt(m_pointtemp.GetSize()-1)))->x,
- (((CPoint *)m_pointtemp.GetAt(m_pointtemp.GetSize()-1)))->y);
- pDC->LineTo(m_pointfal);
- }
- pen.DeleteObject();
- }
- void CMULTILINE::multline_drawAttribution(CDC*pDC)
- {
- if(m_multline_save.GetSize())
- for(int i=0;i<m_multline_save.GetSize();i++)
- {
- CPen pen;
- pen.CreatePen(((multline_data *)m_multline_save.GetAt(i))->m_line_style,((multline_data *)m_multline_save.GetAt(i))->m_line_width,((multline_data *)m_multline_save.GetAt(i))->m_line_color);
- pDC->SelectObject(&pen);
- for(int j=0;j<((multline_data *)m_multline_save.GetAt(i))->m_pointsave.GetSize()-1;j++)
- {
- pDC->MoveTo(((CPoint *)(((multline_data *)m_multline_save.GetAt(i))->m_pointsave.GetAt(j)))->x,((CPoint *)(((multline_data *)m_multline_save.GetAt(i))->m_pointsave.GetAt(j)))->y);
- pDC->LineTo(((CPoint *)(((multline_data *)m_multline_save.GetAt(i))->m_pointsave.GetAt(j+1)))->x,((CPoint *)(((multline_data *)m_multline_save.GetAt(i))->m_pointsave.GetAt(j+1)))->y);
- }
- pen.DeleteObject();
- }
- }
- void CMULTILINE::multline_store(int m_line_style,int m_line_width,COLORREF m_line_color)
- {
- multline_data *pmultline_data=new multline_data(&m_pointtemp,m_line_style,m_line_width,m_line_color);
- m_multline_save.Add(pmultline_data);
- m_pointtemp.RemoveAll();
- }
- /////////////////////////////////////////////////////////////////////////////////
- CMULTILINE::multline_data::multline_data(CPtrArray *pm_pointtemp,int m_line_style,int m_line_width,COLORREF m_line_color)
- {
- this->m_line_style=m_line_style;
- this->m_line_width=m_line_width;
- this->m_line_color=m_line_color;
- this->m_pointsave.Copy(*pm_pointtemp);
- }
- CMULTILINE::multline_data::~multline_data()
- {
- }