📄 graphics.cpp
字号:
// Graphics.cpp: implementation of the CGraphics class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "cad.h"
#include "Graphics.h"
#include<afxtempl.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CGraphics,CObject,1)
CGraphics::CGraphics()
{
}
CGraphics::~CGraphics()
{
}
void CGraphics::AddLine(CPoint pt1, CPoint pt2)
{
}
void CGraphics::AddRectangle(CPoint pt1, CPoint pt2)
{
}
void CGraphics::AddCircle(CPoint pt1, CPoint pt2)
{
}
void CGraphics::Serialize(CArchive &ar)
{ m_lineindex=m_linearray.GetUpperBound();
m_rectangleindex=m_rectanglearray.GetUpperBound();
m_circleindex=m_circlearray.GetUpperBound();
if(ar.IsStoring())
{
while(m_lineindex>=0)
{
m_linearray.GetAt(m_lineindex)->Serialize(ar);
m_lineindex--;
}
while(m_circleindex>=0)
{
m_circlearray.GetAt(m_circleindex)->Serialize(ar);
m_circleindex--;
}
while(m_rectangleindex>=0)
{
m_rectanglearray.GetAt(m_rectangleindex)->Serialize(ar);
m_rectangleindex--;
}
}
else
{
CLine * pline;
CRectangle * prectangle;
CCircle * pcircle;
pline=new(CLine);
pline->Serialize(ar);
while(pline->GetStatus()==1)
{
pline=new(CLine);
pline->Empty();
pline->Serialize(ar);
m_linearray.Add(pline);
}
pcircle=new(CCircle);
pcircle->Serialize(ar);
while(pcircle->GetStatus()==2)
{
pcircle=new(CCircle);
pcircle->Empty();
pcircle->Serialize(ar);
m_circlearray.Add(pcircle);
}
prectangle=new(CRectangle);
prectangle->Serialize(ar);
while(prectangle->GetStatus()==3)
{
prectangle=new(CRectangle);
prectangle->Empty();
prectangle->Serialize(ar);
m_rectanglearray.Add(prectangle);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -