CADView.cpp
上传用户:shangwu01
上传日期:2013-04-22
资源大小:707k
文件大小:19k
- // CADView.cpp : implementation of the CCADView class
- //
- #include "stdafx.h"
- #include "CAD.h"
- #include "CADDoc.h"
- #include "CADView.h"
- #include "MainFrm.h"
- #include "DLG_ARC1.h"
- #include "DLG_ARC2.h"
- #include "DLG_LINE.h"
- #include "DLG_RECTANGE.h"
- #include "DLG_ELLIPS.h"
- #include "DLG_CIRCLE.h"
- #include "math.h"
- #include "DLG_Remove.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CCADView
- IMPLEMENT_DYNCREATE(CCADView, CScrollView)
- BEGIN_MESSAGE_MAP(CCADView, CScrollView)
- //{{AFX_MSG_MAP(CCADView)
- ON_WM_PAINT()
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONUP()
- ON_WM_MOUSEMOVE()
- ON_WM_RBUTTONDOWN()
- ON_WM_LBUTTONDBLCLK()
- ON_COMMAND(ID_BACK, OnBack)
- ON_COMMAND(ID_FRONT, OnFront)
- ON_COMMAND(ID_REMOVE, OnRemove)
- ON_COMMAND(ID_CATCH_certre, OnCATCHcertre)
- ON_UPDATE_COMMAND_UI(ID_CATCH_certre, OnUpdateCATCHcertre)
- ON_COMMAND(ID_CATCH_cross, OnCATCHcross)
- ON_UPDATE_COMMAND_UI(ID_CATCH_cross, OnUpdateCATCHcross)
- ON_COMMAND(ID_CATCH_cut, OnCATCHcut)
- ON_UPDATE_COMMAND_UI(ID_CATCH_cut, OnUpdateCATCHcut)
- ON_COMMAND(ID_CATCH_end, OnCATCHend)
- ON_UPDATE_COMMAND_UI(ID_CATCH_end, OnUpdateCATCHend)
- ON_COMMAND(ID_CATCH_middle, OnCATCHmiddle)
- ON_UPDATE_COMMAND_UI(ID_CATCH_middle, OnUpdateCATCHmiddle)
- ON_COMMAND(ID_DEL, OnDel)
- ON_WM_KEYDOWN()
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CCADView construction/destruction
- CCADView::CCADView()
- {
- m_pBitmap=new CBitmap;
- m_pmdc=new CDC;
- m_click_times=1;
- ////////////////////
- catchend=false;
- catchcertre=false;
- catchmiddle=false;
- catchcross=false;
- catchcut=false;
- ///////////////////////
- m_selected=false;
- }
- CCADView::~CCADView()
- {
- }
- BOOL CCADView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CScrollView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCADView drawing
- void CCADView::OnDraw(CDC* pDC)
- {
- CCADDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDC->FillSolidRect(0,0,1200,2000,RGB(230,230,250));
- //////////////draw/////////////////////
- pDoc->m_line.Line_drawAttribution(pDC);
- pDoc->m_rectange.rectange_drawAttribution(pDC);
- pDoc->m_circle.circle_drawAttribution(pDC);
- pDoc->m_ellips.ellips_drawAttribution(pDC);
- pDoc->m_multline.multline_drawAttribution(pDC);
- pDoc->m_arc.arc_drawAttribution(pDC);
- if(m_click_times==1)
- catchpoint(m_pointorg,pDC);
- else if(m_click_times==2)
- catchpoint(m_pointfal,pDC);
- else if(m_click_times==3)
- catchpoint(m_pointend,pDC);
- if(m_click_times==2&&!pDoc->m_mode_flage)
- editdraw(m_click,pDC);//选中元素
- if(!pDoc->m_mode_flage)
- if(m_nStyle==1)
- {
- if(m_click_times==3)
- if(select==1||select==2)
- pDoc->m_line.Line_editdraw(m_pointorg,m_pointfal,pDC);//旋转
- else if(select==3)
- pDoc->m_line.Line_editmove(m_pointorg,m_pointfal,m_Num,pDC);//平移
- }
- else if(m_nStyle==3)
- {
- if(m_click_times==3)
- pDoc->m_circle.circle_editmove(m_pointorg,m_pointfal,m_Num,pDC);//平移
- }
- else if(m_nStyle==5)
- {
- if(m_click_times==3)
- pDoc->m_ellips.ellips_editmove(m_pointorg,m_pointfal,m_Num,pDC);//平移
- }
- else if(m_nStyle==7)
- {
- if(m_click_times==3)
- pDoc->m_arc.arc_editmove(m_pointorg,m_pointfal,m_Num,pDC);//平移
-
- }
-
- if(pDoc->m_mode_flage)
- if(pDoc->m_DrawType==1&&m_click_times==2)
- pDoc->m_line.Line_drawMove(m_pointorg,m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==2&&m_click_times==2)
- pDoc->m_rectange.rectange_drawMove(m_pointorg,m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==3&&m_click_times==2)
- pDoc->m_circle.circle_drawMove(m_pointorg,m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==4)
- pDoc->m_multline.multline_drawMove(m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==5&&m_click_times==2)
- pDoc->m_ellips.ellips_drawMove(m_pointorg,m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==7)
- {
- if(m_click_times==2)
- pDoc->m_arc.arc_drawMoveline(m_pointorg,m_pointfal,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- if(m_click_times==3)
- {
- pDoc->m_arc.arc_drawMovearc(m_pointorg,m_pointfal,m_pointend,pDC,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- }
- }
- }
- void CCADView::OnInitialUpdate()
- {
- CScrollView::OnInitialUpdate();
- if(m_pmdc->m_hDC==NULL)
- {
- CClientDC dc(this);
- m_pmdc->CreateCompatibleDC(&dc);
- m_pBitmap->CreateCompatibleBitmap(&dc,2000,1000);
-
- }//创建内存DC和缓存
- CSize sizeTotal;
- // TODO: calculate the total size of this view
- sizeTotal.cx = sizeTotal.cy = 100;
- SetScrollSizes(MM_TEXT, sizeTotal);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCADView printing
- BOOL CCADView::OnPreparePrinting(CPrintInfo* pInfo)
- {
-
- return DoPreparePrinting(pInfo);
- }
- void CCADView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
-
- }
- void CCADView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCADView diagnostics
- #ifdef _DEBUG
- void CCADView::AssertValid() const
- {
- CScrollView::AssertValid();
- }
- void CCADView::Dump(CDumpContext& dc) const
- {
- CScrollView::Dump(dc);
- }
- CCADDoc* CCADView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCADDoc)));
- return (CCADDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CCADView message handlers
- void CCADView::OnPaint()
- {
- CPaintDC dc(this);
- CBitmap *pOldBitmap=m_pmdc->SelectObject(m_pBitmap);
- OnDraw(m_pmdc);
- dc.BitBlt(0,0,2000,1000,m_pmdc,0,0,SRCCOPY);
- m_pmdc->SelectObject(pOldBitmap);
-
- }
- void CCADView::OnLButtonDown(UINT nFlags, CPoint point)
- {
- CCADDoc* pDoc = GetDocument();
- /////////////////////////////edit mode///////////////////////////////////////////////////
- if(!pDoc->m_mode_flage)
- {
-
- if(m_click_times==1)
- {
- m_click=point;
- m_click_times=2;
- this->Invalidate(false);
- return;
- }
- if(m_click_times==2)
- {
- if(m_selected)
- if(editselect(point))
- {
- m_click_times=3;
- return;
- }
- m_click=point;
- this->Invalidate(false);
- return;
-
- }
- if(m_click_times==3)
- {
- m_pointfal=point;
- if(m_nStyle==1)
- {
- if(select==1||select==2)
- pDoc->m_line.Line_editstore(m_pointorg,m_pointfal,m_Num);
- else if(select==3)
- pDoc->m_line.Line_editmovestore(m_pointorg,m_pointfal,m_Num);
- }
- else if(m_nStyle==3)
- pDoc->m_circle.circle_editmovestore(m_pointorg,m_pointfal,m_Num);
- else if(m_nStyle==5)
- pDoc->m_ellips.ellips_editmovestore(m_pointorg,m_pointfal,m_Num);
- else if(m_nStyle==7)
- pDoc->m_arc.arc_editmovestore(m_pointorg,m_pointfal,m_Num);
- m_selected=false;
- m_click_times=1;
- this->Invalidate(false);
- return;
- }
- }
- /////////////////////////draw mode///////////////////////////////////////////////////////
- if((m_click_times==1)&&(pDoc->m_DrawType!=0))
- {
- m_pointorg=point;
- if(search(point)!=CPoint(-1,-1))
- m_pointorg=search(point);//寻找最近点
- if(pDoc->m_DrawType==4)
- {
- CPoint *ppoint=new CPoint(point);
- pDoc->m_multline.m_pointtemp.Add(ppoint);
- return;
- }//绘制连续直线
- m_click_times=2;
- return;
- }
- if(m_click_times==2)
- {
- m_pointfal=point;
- if(search(point)!=CPoint(-1,-1))
- m_pointfal=search(point);//寻找最近点
-
- if(pDoc->m_DrawType==1)
- pDoc->m_line.Line_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==2)
- pDoc->m_rectange.rectange_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==3)
- pDoc->m_circle.circle_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==5)
- pDoc->m_ellips.ellips_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- else if(pDoc->m_DrawType==7)
- {
- m_click_times=3;
- return;
- }//绘制圆弧
- m_click_times=1;
- return;
- }
- if(m_click_times==3)
- {
- if(pDoc->m_DrawType==7)
- {
- m_pointend=point;
- if(search(point)!=CPoint(-1,-1))
- m_pointend=search(point);//寻找最近点
-
- pDoc->m_arc.arc_drawstore(m_pointorg,m_pointfal,m_pointend,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
-
- m_click_times=1;
- return;//绘制圆弧
-
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
- CScrollView::OnLButtonDown(nFlags, point);
- }
- void CCADView::OnLButtonUp(UINT nFlags, CPoint point)
- {
-
- CScrollView::OnLButtonUp(nFlags, point);
- }
- void CCADView::OnMouseMove(UINT nFlags, CPoint point)
- {
- ::SetCursor(::LoadCursor(NULL,IDC_CROSS));
- CCADDoc* pDoc = GetDocument();
- CMainFrame * pMainFrame=(CMainFrame*)AfxGetMainWnd();
- CStatusBar * pStatusBar=&pMainFrame->m_wndStatusBar;
- CString str;
- str.Format("x=%d,y=%d",m_selected,m_click_times);
- pStatusBar->SetPaneText(0,str,true);//鼠标移动时显示坐标point.x,point.y m_nStyle
- /////////////////////////////////////////////////////////////////////////////////////
- if(!pDoc->m_mode_flage)
- {
- if(m_click_times==3)
- {
- m_pointfal=point;
- this->Invalidate(false);
- return;
- }
- return;
- }
- /////////////////////////////////////////////////////////////////////////////////////
- if((pDoc->m_DrawType==1)||(pDoc->m_DrawType==2)||(pDoc->m_DrawType==3)||(pDoc->m_DrawType==5)||(pDoc->m_DrawType==7))
- {
-
- if(m_click_times==1)
- {
- m_pointorg=point;
- this->Invalidate(false);
- }
- if(m_click_times==2)
- {
- m_pointfal=point;
- this->Invalidate(false);
- return;
- }
- if(m_click_times==3)
- {
- m_pointend=point;
- this->Invalidate(false);
- return;
- }
- }
- if(pDoc->m_DrawType==4)
- {
- m_pointfal=point;
- this->Invalidate(false);
- }
-
- CScrollView::OnMouseMove(nFlags, point);
- }
- void CCADView::OnRButtonDown(UINT nFlags, CPoint point)
- {
- if(m_click_times!=1)
- {
- m_click_times=1;
- this->Invalidate(false);
- }
- /* else if(m_click_times==1)
- {
- ClientToScreen(&point);
- CMenu menuPopUp;
- menuPopUp.LoadMenu(IDR_POPMANU);
- menuPopUp.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x,point.y,this);
-
- }*/
- CScrollView::OnRButtonDown(nFlags, point);
- }
- void CCADView::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- CCADDoc* pDoc = GetDocument();
- if(pDoc->m_DrawType==4)
- {
- pDoc->m_multline.multline_store(pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- }
-
- CScrollView::OnLButtonDblClk(nFlags, point);
- }
- void CCADView::OnBack()
- {
-
-
- }
- void CCADView::OnFront()
- {
-
-
- }
- void CCADView::OnRemove()
- {
- CCADDoc* pDoc = GetDocument();
- CDLG_Remove dlg;
- if(dlg.DoModal()==IDOK)
- {
- pDoc->m_line.m_line_save.RemoveAll();;
- pDoc->m_rectange.m_rectange_save.RemoveAll();
- pDoc->m_circle.m_circle_save.RemoveAll();
- pDoc->m_ellips.m_ellips_save.RemoveAll();
- pDoc->m_multline.m_multline_save.RemoveAll();
- pDoc->m_arc.m_arc_save.RemoveAll();
- this->Invalidate(false);
- }
- else
- return;
-
- }
- //////////////////////////////////////////////////////////////////////////////////
- void CCADView::OnCATCHcertre()
- {
- if(!catchcertre)
- {
- catchcertre=true;
- return;
- }
- if(catchcertre)
- {
- catchcertre=false;
- return;
- }
-
- }
- void CCADView::OnUpdateCATCHcertre(CCmdUI* pCmdUI)
- {
- if(catchcertre)
- pCmdUI->SetCheck(1);
- else
- pCmdUI->SetCheck(0);
-
- }
- void CCADView::OnCATCHcross()
- {
- if(!catchcross)
- {
- catchcross=true;
- return;
- }
- if(catchcross)
- {
- catchcross=false;
- return;
- }
-
- }
- void CCADView::OnUpdateCATCHcross(CCmdUI* pCmdUI)
- {
- if(catchcross)
- pCmdUI->SetCheck(1);
- else
- pCmdUI->SetCheck(0);
-
- }
- void CCADView::OnCATCHcut()
- {
- if(!catchcut)
- {
- catchcut=true;
- return;
- }
- if(catchcut)
- {
- catchcut=false;
- return;
- }
-
- }
- void CCADView::OnUpdateCATCHcut(CCmdUI* pCmdUI)
- {
- if(catchcut)
- pCmdUI->SetCheck(1);
- else
- pCmdUI->SetCheck(0);
-
- }
- void CCADView::OnCATCHend()
- {
- if(!catchend)
- {
- catchend=true;
- return;
- }
- if(catchend)
- {
- catchend=false;
- return;
- }
-
- }
- void CCADView::OnUpdateCATCHend(CCmdUI* pCmdUI)
- {
- if(catchend)
- pCmdUI->SetCheck(1);
- else
- pCmdUI->SetCheck(0);
-
- }
- void CCADView::OnCATCHmiddle()
- {
- if(!catchmiddle)
- {
- catchmiddle=true;
- return;
- }
- if(catchmiddle)
- {
- catchmiddle=false;
- return;
- }
- }
- void CCADView::OnUpdateCATCHmiddle(CCmdUI* pCmdUI)
- {
- if(catchmiddle)
- pCmdUI->SetCheck(1);
- else
- pCmdUI->SetCheck(0);
-
- }
- ///////////////////////////catchpoint////////////////////////////////////////////////////////
- void CCADView::catchpoint(CPoint point,CDC*pDC)
- {
- CCADDoc* pDoc = GetDocument();
- CRgn rgn;
- rgn.CreateRectRgn(point.x-50,point.y-50,point.x+50,point.y+50);
- if(catchend)
- {
- pDoc->m_line.Line_catchend(point,&rgn,pDC);
- pDoc->m_arc.arc_catchend(point,&rgn,pDC);
- }
-
- if(catchmiddle)
- {
- pDoc->m_line.Line_catchmiddle(point,&rgn,pDC);
- }
- if(catchcross)
- {
- }
- if(catchcertre)
- {
- pDoc->m_arc.arc_catchcertre(point,&rgn,pDC);
- pDoc->m_circle.circle_catchcertre(point,&rgn,pDC);
- pDoc->m_ellips.ellips_catchcertre(point,&rgn,pDC);
- }
- if(catchcut)
- {
- }
- }
- CPoint CCADView::search(CPoint point)
- {
- CCADDoc* pDoc = GetDocument();
-
- CPoint nearpoint;
- nearpoint.x=-1;
- nearpoint.y=-1;
- CRgn rgn;
- rgn.CreateRectRgn(point.x-50,point.y-50,point.x+50,point.y+50);
-
- if(catchend)
- {
- pDoc->m_line.Line_searchend(point,&nearpoint,&rgn);
- pDoc->m_arc.arc_searchend(point,&nearpoint,&rgn);
- }
- if(catchmiddle)
- {
- pDoc->m_line.Line_searchmiddle(point,&nearpoint,&rgn);
-
- }
- if(catchcertre)
- {
- pDoc->m_arc.arc_searchcertre(point,&nearpoint,&rgn);
- pDoc->m_circle.circle_searchcertre(point,&nearpoint,&rgn);
- pDoc->m_ellips.ellips_searchcertre(point,&nearpoint,&rgn);
-
- }
-
- return(nearpoint);
-
- }
- void CCADView::editdraw(CPoint point,CDC* pDC)
- {
- CCADDoc* pDoc = GetDocument();
- int Num,nStyle;
- if( pDoc->m_line.Line_searchline(point,&Num,&nStyle,pDC)||
- pDoc->m_circle.circle_searchcircle(point,&Num,&nStyle,pDC)||
- pDoc->m_ellips.ellips_searchellips(point,&Num,&nStyle,pDC)||
- pDoc->m_arc.arc_searcharc(point,&Num,&nStyle,pDC))
- {
- m_selected=true;
- m_Num=Num;
- m_nStyle=nStyle;
- }
- else
- m_selected=false;
- }
- bool CCADView::editselect(CPoint point)
- {
- bool flag;
- CPoint selectpoint;
- CCADDoc* pDoc = GetDocument();
- if(m_nStyle==1)
- {
- flag=pDoc->m_line.Line_editselect(point,&selectpoint,m_Num,&select);
- if(flag)
- {
- m_pointorg=selectpoint;
- return(true);
- }
- }
- else if(m_nStyle==3)
- {
- flag=pDoc->m_circle.circle_editselect(point,&selectpoint,m_Num);
- if(flag)
- {
- m_pointorg=selectpoint;
- return(true);
- }
- }
- else if(m_nStyle==5)
- {
- flag=pDoc->m_ellips.ellips_editselect(point,&selectpoint,m_Num);
- if(flag)
- {
- m_pointorg=selectpoint;
- return(true);
- }
- }
- else if(m_nStyle==7)
- {
- flag=pDoc->m_arc.arc_editselect(point,&selectpoint,m_Num);
- if(flag)
- {
- m_pointorg=selectpoint;
- return(true);
- }
- }
-
- return(false);
- }
- void CCADView::OnDel()
- {
- CCADDoc* pDoc = GetDocument();
- if(m_selected)
- if(m_nStyle==1)
- {
- pDoc->m_line.Line_del(m_Num);
- this->Invalidate(false);
-
- }
- else if(m_nStyle==3)
- {
- pDoc->m_circle.circle_del(m_Num);
- this->Invalidate(false);
-
- }
- else if(m_nStyle==5)
- {
- pDoc->m_ellips.ellips_del(m_Num);
- this->Invalidate(false);
- }
- else if(m_nStyle==7)
- {
- pDoc->m_arc.arc_del(m_Num);
- this->Invalidate(false);
- }
-
-
- }
- void CCADView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
- {
- CCADDoc* pDoc = GetDocument();
- if(pDoc->m_mode_flage)
- {
- if(pDoc->m_DrawType==1)
- {
- if(m_click_times==2)
- {
- CDLG_LINE dlg;
- if(dlg.DoModal()==IDOK)
- {
- m_pointfal=CPoint(dlg.m_Xsecond,dlg.m_Ysecond);
- pDoc->m_line.Line_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- this->Invalidate(false);
- return;
- }
- else
- return;
- }
- }
- else if(pDoc->m_DrawType==2)
- {
- if(m_click_times==2)
- {
- CDLG_RECTANGE dlg;
- if(dlg.DoModal()==IDOK)
- {
- m_pointfal=CPoint(dlg.m_Xbottomright,dlg.m_Ybottomright);
- pDoc->m_rectange.rectange_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- this->Invalidate(false);
- return;
- }
- else
- return;
- }
- }
- else if(pDoc->m_DrawType==3)
- {
- if(m_click_times==2)
- {
- CDLG_CIRCLE dlg;
- if(dlg.DoModal()==IDOK)
- {
- if(dlg.m_select==1)
- m_pointfal=CPoint(dlg.m_Xsecond,dlg.m_Ysecond);
- else if(dlg.m_select==0)
- m_pointfal=CPoint(m_pointorg.x+dlg.m_R,m_pointorg.y);
- pDoc->m_circle.circle_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- this->Invalidate(false);
- return;
- }
- else
- return;
- }
- }
- else if(pDoc->m_DrawType==5)
- {
- if(m_click_times==2)
- {
- CDLG_ELLIPS dlg;
- if(dlg.DoModal()==IDOK)
- {
- m_pointfal=CPoint(m_pointorg.x+dlg.m_Xlength/2,m_pointorg.y+dlg.m_Ylength/2);
-
- pDoc->m_ellips.ellips_store(m_pointorg,m_pointfal,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- this->Invalidate(false);
- return;
-
- }
- else
- return;
- }
-
- }
- else if(pDoc->m_DrawType==7)
- {
- if(m_click_times==2)
- {
- CDLG_ARC1 dlg;
- if(dlg.DoModal()==IDOK)
- {
- m_pointfal=CPoint(m_pointorg.x+dlg.m_R*cos(dlg.m_ARC1*3.1415926/180),m_pointorg.y-dlg.m_R*sin(dlg.m_ARC1*3.1415926/180));
- m_click_times=3;
- this->Invalidate(false);
- return;
- }
- else
- return;
- }
- else if(m_click_times==3)
- {
- CDLG_ARC2 dlg;
- if(dlg.DoModal()==IDOK)
- {
- float R;
- R=sqrt(pow(m_pointorg.x-m_pointfal.x,2)+pow(m_pointorg.y-m_pointfal.y,2));
- m_pointend=CPoint(m_pointorg.x+R*cos(dlg.m_ARC2*3.1415926/180),m_pointorg.y-R*sin(dlg.m_ARC2*3.1415926/180));
- pDoc->m_arc.arc_drawstore(m_pointorg,m_pointfal,m_pointend,pDoc->m_line_style,pDoc->m_line_width,pDoc->m_line_color);
- m_click_times=1;
- this->Invalidate(false);
- return;
- }
- else
- return;
- }
- }
- else
- return;
-
- }
- CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
- }