MyGraphObject.cpp
上传用户:netltd
上传日期:2013-02-12
资源大小:7234k
文件大小:3k
- #include "stdafx.h"
- #include "MyGraphObject.h"
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyLine, CObject, 1)
- //直线对象
- CMyLine::CMyLine(float startX, float startY, float endX, float endY, int style, COLORREF color)
- {
- m_startX = startX;
- m_startY = startY;
- m_endX = endX;
- m_endY = endY;
-
- m_color = color;
- m_style = style;
- }
- void CMyLine::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_startX << m_startY << m_endX << m_endY << m_color << m_style;
- }
- else
- {
- ar >> m_startX >> m_startY >> m_endX >> m_endY >> m_color >> m_style;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyRect, CObject, 1)
- //矩形对象
- CMyRect::CMyRect(float startX, float startY, float endX, float endY, int style, COLORREF color)
- {
- m_startX = startX;
- m_startY = startY;
- m_endX = endX;
- m_endY = endY;
- m_style = style;
- m_color = color;
-
- }
- void CMyRect::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_startX << m_startY << m_endX << m_endY << m_style << m_color;
- }
- else
- {
- ar >> m_startX >> m_startY >> m_endX >> m_endY >> m_style >> m_color;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyCircle, CObject, 1)
- //圆对象
- CMyCircle::CMyCircle(float originX, float originY, float radius, int style, COLORREF color)
- {
- m_originX = originX;
- m_originY = originY;
- m_radius = radius;
- m_style = style;
- m_color = color;
- }
- void CMyCircle::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_originX << m_originY << m_radius << m_style << m_color;
- }
- else
- {
- ar >> m_originX >> m_originY >> m_radius >> m_style >> m_color;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyArc, CObject, 1)
- CMyArc::CMyArc(float originX, float originY, float startX, float startY, float endX, float endY,
- float radius, int style, COLORREF color)
- {
- m_originX = originX;
- m_originY = originY;
- m_startX = startX;
- m_startY = startY;
- m_endX = endX;
- m_endY = endY;
- m_radius = radius;
-
- m_style = style;
- m_color = color;
-
- }
- void CMyArc::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_originX << m_originY << m_startX << m_startY << m_endX << m_endY
- << m_radius << m_style << m_color;
- }
- else
- {
- ar >> m_originX >> m_originY >> m_startX >> m_startY >> m_endX >> m_endY
- >> m_radius >> m_style >> m_color;
- }
- }