MyGraphObject.cpp
上传用户:netltd
上传日期:2013-02-12
资源大小:7234k
文件大小:3k
- #include "stdafx.h"
- #include "MyGraphObject.h"
- #include "MyDefine.h"
- ///////////////////////////////////////////////////////////////////////////////////////////////
- //图形对象信息
- CGraphObjectInfo::CGraphObjectInfo()
- {
- }
- CGraphObjectInfo::CGraphObjectInfo(CRect rect, BOOL del, BOOL selected)
- {
- m_rect = rect;
- m_del = del;
- m_selected = selected;
- }
- void CGraphObjectInfo::Initialize(CRect rect, BOOL del, BOOL selected)
- {
- m_rect = rect;
- m_del = del;
- m_selected = selected;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyLine, CObject, 1)
- //直线对象
- CMyLine::CMyLine(CString layer, FPOINT startpoint, FPOINT endpoint, int style, COLORREF color)
- {
- m_layer = layer;
- 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_layer << m_color << m_style;
- }
- else
- {
- ar >> m_start.x >> m_start.y >> m_end.x >> m_end.y >> m_layer >> m_color >> m_style;
- }
- }
- int CMyLine::GetObjectType()
- {
- return OBJECT_LINE;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyRect, CObject, 1)
- //矩形对象
- CMyRect::CMyRect(CString layer, FPOINT startpoint, FPOINT endpoint, int style, COLORREF color)
- {
- m_layer = layer;
- 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_layer << m_style << m_color;
- }
- else
- {
- ar >> m_start.x >> m_start.y >> m_end.x >> m_end.y >> m_layer>> m_style >> m_color;
- }
- }
- int CMyRect::GetObjectType()
- {
- return OBJECT_RECT;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyCircle, CObject, 1)
- //圆对象
- CMyCircle::CMyCircle(CString layer, FPOINT originpoint, float radius, int style, COLORREF color)
- {
- m_layer = layer;
- 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_layer << m_style << m_color;
- }
- else
- {
- ar >> m_origin.x >> m_origin.y >> m_radius >> m_layer >> m_style >> m_color;
- }
- }
- int CMyCircle::GetObjectType()
- {
- return OBJECT_CIRCLE;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////
- IMPLEMENT_SERIAL(CMyArc, CObject, 1)
- CMyArc::CMyArc(CString layer, FPOINT originpoint, FPOINT startpoint, FPOINT endpoint, float radius,
- int style, COLORREF color)
- {
- m_layer = layer;
- 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_layer << 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_layer >> m_style >> m_color;
- }
- }
- int CMyArc::GetObjectType()
- {
- return OBJECT_ARC;
- }