Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MyGraphObject.cpp
Package: MiniCAD_ALL.zip [view]
Upload User: netltd
Upload Date: 2013-02-12
Package Size: 7234k
Code Size: 3k
Category:
Graph Drawing
Development Platform:
Visual C++
- #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;
- }