MyGraphObject.cpp
上传用户:netltd
上传日期:2013-02-12
资源大小:7234k
文件大小:3k
- #include "stdafx.h"
- #include "MyGraphObject.h"
- ///////////////////////////////////////////////////////////////////////////////////////////////
- //图形对象信息
- CGraphObjectInfo::CGraphObjectInfo(int layer, BOOL del, BOOL selected)
- {
- m_layer = layer;
- m_del = del;
- m_selected = selected;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyLine, CObject, 1)
- //直线对象
- CMyLine::CMyLine(FPOINT startpoint, FPOINT endpoint, int style, COLORREF color)
- {
- m_start = startpoint;
- m_end = endpoint;
-
- m_color = color;
- m_style = style;
- }
- void CMyLine::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_start.x << m_start.y << m_end.x << m_end.y << m_color << m_style;
- }
- else
- {
- ar >> m_start.x >> m_start.y >> m_end.x >> m_end.y >> m_color >> m_style;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyRect, CObject, 1)
- //矩形对象
- CMyRect::CMyRect(FPOINT startpoint, FPOINT endpoint, int style, COLORREF color)
- {
- m_start = startpoint;
- m_end = endpoint;
- m_style = style;
- m_color = color;
-
- }
- void CMyRect::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_start.x << m_start.y << m_end.x << m_end.y << m_style << m_color;
- }
- else
- {
- ar >> m_start.x >> m_start.y >> m_end.x >> m_end.y >> m_style >> m_color;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyCircle, CObject, 1)
- //圆对象
- CMyCircle::CMyCircle(FPOINT originpoint, float radius, int style, COLORREF color)
- {
- m_origin = originpoint;
- m_radius = radius;
- m_style = style;
- m_color = color;
- }
- void CMyCircle::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_origin.x << m_origin.y << m_radius << m_style << m_color;
- }
- else
- {
- ar >> m_origin.x >> m_origin.y >> m_radius >> m_style >> m_color;
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyArc, CObject, 1)
- CMyArc::CMyArc(FPOINT originpoint, FPOINT startpoint, FPOINT endpoint, float radius,
- int style, COLORREF color)
- {
- m_origin = originpoint;
- m_start = startpoint;
- m_end = endpoint;
- m_radius = radius;
-
- m_style = style;
- m_color = color;
-
- }
- void CMyArc::Serialize(CArchive& ar)
- {
- if(ar.IsStoring())
- {
- ar << m_origin.x << m_origin.y << m_start.x << m_start.y << m_end.x << m_end.y
- << m_radius << m_style << m_color;
- }
- else
- {
- ar >> m_origin.x >> m_origin.y >> m_start.x >> m_start.y >> m_end.x >> m_end.y
- >> m_radius >> m_style >> m_color;
- }
- }