MyManageGraphObj.h
上传用户:netltd
上传日期:2013-02-12
资源大小:7234k
文件大小:4k
- #include "MyGraphObject.h"
- #include "MyDraw.h"
- #include "MyCommand.h"
- //被选择对象信息类
- class CSelectedObjectInfo: public CObject
- {
- public:
- int m_type;
- int m_index;
- public:
- CSelectedObjectInfo(int type, int index);
- };
- ///////////////////////////////////////////////////////////////////////////////////////////////
- class CManageGraphObject:public CObject
- {
- public:
- DECLARE_DYNCREATE(CManageGraphObject)
- CManageGraphObject();
- void Serialize(CArchive& ar);
- ~CManageGraphObject();
- public:
- CDrawGrapObject m_DrawGrapObject;
- public:
- SIZE PageSize; //图纸大小
- float Proportion; //图形缩放比例
- private:
- CPoint StartPoint; //画直线、矩形、圆、圆弧时的起始点(画圆时,是圆的圆心)
- CPoint MidPoint; //画圆弧时的中间点
- CPoint EndPoint; //画直线、矩形、圆、圆弧时的结束点
- CPoint oldMidPoint; //上一次画圆弧时的中间点
- CPoint oldEndPoint; //上一次画直线、矩形、圆、圆弧时的结束点
- private:
- COLORREF PenColor;
- int LineStyle;
- public:
- void SetLineStyle(int style);
- void SetPenColor(COLORREF color);
- public:
- //对象类指针数组
- CObArray m_LineArray;
- CObArray m_RectArray;
- CObArray m_CircleArray;
- CObArray m_ArcArray;
-
- //对象信息类指针数组
- CObArray m_LineInfoArray;
- CObArray m_RectInfoArray;
- CObArray m_CircleInfoArray;
- CObArray m_ArcInfoArray;
- //选中对象信息类指针数组
- CObArray m_SelObjInfoArray;
- public:
- void Initialize(int style, COLORREF color);
- private:
- CCommandStack * pCommandStack;
- public:
- void GetCommandStack(CCommandStack* pStack);
- private:
- CClientDC* pDC;
- public:
- void GetDC(CClientDC* pClientDC);
- private:
- int LRepeatTimes; //在当前绘图命令下鼠标左键点击次数
- int RRepeatTimes; //在当前绘图命令下鼠标右键点击次数
- public:
- void OnLButtonDown(UINT ID, CPoint point);
- UINT OnRButtonDown(UINT ID, CPoint point);
- void OnMouseMove(UINT ID, CPoint point);
- void OnScroll(UINT ID);
- void OnRedo();
- void OnUndo();
- public:
- POINT DrawingToLogic(FPOINT fpoint); //将点的图纸坐标转换为逻辑坐标
- long DrawingToLogic(float fdistance); //将图纸距离转换为逻辑距离
- FPOINT LogicToDrawing(POINT point); //将点的逻辑坐标转换为图纸坐标
- float LogicToDrawing(long distance); //将转换逻辑距离为图纸距离
- public:
- void RedrawAllObject(CDC* pDC);
- void SelectObject(CDC* pDC, CPoint point); //选取图形对象
- BOOL UnselectObject(); //取消选取图形对象
- public:
- void RedrawLine(CDC* pDC); //重画所有的Line对象
- void SelectLine(CDC* pDC, CPoint point);
- BOOL UnselectLine();
- void AddLine(POINT SPoint, POINT EPoint, int Style, COLORREF Color); //增加直线对象
- CMyLine* GetLine(int index); //获取指定序号的直线对象
- void DelAllLine(); //删除所有的直线对象
- public:
- void RedrawRect(CDC* pDC);
- void SelectRect(CDC* pDC, CPoint point);
- BOOL UnselectRect();
- void AddRect(POINT SPoint, POINT EPoint, int Style, COLORREF Color);
- CMyRect* GetRect(int index);
- void DelAllRect();
- public:
- void RedrawCircle(CDC* pDC);
- void SelectCircle(CDC* pDC, CPoint point);
- BOOL UnselectCircle();
- void AddCircle(POINT SPoint, POINT EPoint, int Style, COLORREF Color);
- CMyCircle* GetCircle(int index);
- void DelAllCircle();
- public:
- void RedrawArc(CDC* pDC);
- void SelectArc(CDC* pDC, CPoint point);
- BOOL UnselectArc();
- void AddArc(POINT SPoint, POINT MPoint, POINT EPoint, int Style, COLORREF Color);
- CMyArc* GetArc(int index);
- void DelAllArc();
- };