protected:
int m_nIndex;//编号
CDrawNode* m_pDrawObj;
friend class CCircleTool;
};
绘制节点的工具CCircleTool在鼠标左键按下OnLButtonDown的消息处理函数中,实际分配内存,产生一个节点对象。
2.1.2箭线类CDrawArrow的设计
class CDrawArrow: public CDrawObj
{
public:
CDrawRect(const CRect& position);
void SetProjectName(CString name){ m_ProjectName=name;};
void SetProjectTime(int time) { m_ProjectTime=time;};
CString GetProjectName() { return m_ProjectName;}
void SetProjectTime(int time){ return m_ProjectTime;}
bool m_bForeConnect;//箭线始节点标志
bool m_bBackConnect;//箭线终节点标志
int m_ForeConnect; //箭线连接的始节点序号
int m_BackConnect; //箭线连接的终节点序号
virtual int GetObjIndex() {return o};
//绘制时,计算平行于箭线的说明文字的角度,位置,项目名称总在线的上方
virtual void Draw(CDC* pDC,CDrawView* pView);
enum ArrowType{ none, pureArrow, openArrow,stealthArrow, diamondArrow, ovalArrow};
enum Shape { rectangle, roundRectangle, ellipse, line,arrow };
protected:
CString m_ProjectName; //项目名称
int m_ProjectTime; //时间
Shape m_nShape;
ArrowType m_lArrow, m_rArrow; //for arrow only
int m_lArrowSize, m_rArrowSize; //for arrow only
private:
void DrawArrow(ArrowType arrowType, POINT p1, POINT p2, int arrowSize, CDC *,int, int , int, CBrush *);
friend class CArrowTool;
};
|