📄 paintdoc.h
字号:
// paintdoc.h : interface of the CPaintobjDoc class
//
/////////////////////////////////////////////////////////////////////////////
#ifndef __CCPaintobjDocinterfaceyhh
#define __CCPaintobjDocinterfaceyhh
typedef struct
{
UINT Type;//图形元素的类别:0:直线 1:圆弧
UINT Index;//图形元素的序号
}GraphSelectStruct;
typedef struct
{
double x;//横坐标
double y;//纵坐标
}PointStruct;
class CPaintobjDoc : public CDocument
{
protected: // create from serialization only
CPaintobjDoc();
DECLARE_DYNCREATE(CPaintobjDoc)
CSize m_size;//屏幕区域大小
BOOL m_banglelength;//显示/隐藏定角定长画线对话条
BOOL m_banglelengthok;//定角定长画线
BOOL m_bBrushwork;//画法选择
BOOL m_bMove;//移动图形
BOOL m_bMove1;//移动图形
BOOL m_bZoomIn;//显示缩小鼠标
BOOL m_bZoomOut;//显示放大鼠标
// BOOL m_bSaveOutdata; //TRUE表示存盘输出数据
CPnt m_pStartMove;//移动图形的起点
// Attributes
public:
GraphSelectStruct* GraphSelect;//存储选中图形元素特征的结构数组
int m_nGraphSelect;//存储选中图形元素的数目
UINT DrawFormat;//注册剪裁板的数据格式
UINT m_uCurNodeIdMax;//表示当前的节点的最大Id号
UINT m_uCurPathIdMax;//表示当前的路径的最大Id号
UINT m_uCurStartnodeId;//表示当前的起点Id号
UINT m_uCurEndnodeId;//表示当前的终点Id号
UINT m_uSearchPathId;//表示查找的路径Id号
UINT m_uSearchNodeId;//表示查找的节点Id号
BOOL m_bStartnodeIndep;//表示起点是否独立TRUE==独立
BOOL m_bEndnodeIndep;//表示终点是否独立TRUE==独立
BOOL m_bDisNodeState;//显示节点自检结果
double m_fCurRadius;//当前默认的半径
double m_fangle;//定角画线
double m_flength;//定长画线
double m_dPaintRadius;//画弧时给定的半径
CPnt m_pPaintStartNode;//绘图时给定的起点
CPnt m_pPaintEndNode;//绘图时给定的终点
double m_dPaintAngle;//画lazy-s或scp时给定的倾斜角
double m_dPaintHeight;//画Roundrect时给定的Height
double m_dPaintWide;//画Roundrect时给定的Wide
PointStruct * PointXY;//记录Polygon顶点的数组指针
int m_nCount;//画Polygon时给定的顶点数
int m_nCountId;//画Polygon时给定的顶点索引
UINT m_PathPaintMode; //直线圆弧路径的绘制模式
UINT m_LazysPaintMode; //Lazys的绘制模式
UINT m_SidePaintMode; //Side的绘制模式
UINT m_ScpPaintMode; //Scp的绘制模式
UINT m_EllipsePaintMode; //Ellipse的绘制模式
UINT m_RectPaintMode; //Rect的绘制模式
UINT m_PolygonPaintMode; //Polygon的绘制模式
UINT m_RoundrectPaintMode;//Roundrect的绘制模式
UINT m_ChordPaintMode; //Chord的绘制模式
UINT m_PiePaintMode; //Pie的绘制模式
BOOL m_bGetangleMode;//FALSE表示自动取角
// Operations
public:
void GetBounds(CSize* siz);//得到屏幕区域大小
void ExpandBounds(CRect* pRect);//计算屏幕区域大小
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPaintobjDoc)
public:
virtual BOOL OnNewDocument();
virtual void DeleteContents();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual void OnCloseDocument();
virtual void Serialize(CArchive& ar); // overridden for document i/o
virtual void SetTitle(LPCTSTR lpszTitle);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CPaintobjDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
public:
void MyOpenDocument(CString pathname);
void DataConversion();
void NoPaint();
void GetNodeIdMax();
void GetPathIdMax();
void GetSelectedBounds(double &xmin,double &xmax,double &ymin,double &ymax);//得到选中图形的边界
BOOL AddSelectList(UINT Type,UINT Index);//存储选中的图形元素
BOOL ReadClipBoard();//从剪裁板读出数据成员形成图形元素对象
BOOL WriteClipBoard();//将选中的图形以字符串形式存放到剪裁板
void Create(CArchive& ar);
void SaveText(CString name,UINT ver);
void SaveBin(CArchive& ar,UINT ver);
UINT LoadBin(CArchive& ar,CString extname,USHORT ver);
void SaveBin1(CArchive& ar);
CNode* m_pNode;//指向CNode类指针
CPath* m_pPath;//指向CPath类指针
UINT m_nSelectedTool;//表示选中了某种绘图工具
CPainted* m_pSelectedTool;//基类指针用于操纵派生类
CTypedPtrArray<CObArray, CPainted*> m_Objects;//用于存放图形类
CTypedPtrArray<CObArray, CNode*> m_Objectsnode;
CTypedPtrArray<CObArray, CPath*> m_Objectspath;
BOOL m_bpaintarc; //TRUE表示正在画弧
BOOL m_bpaintLine; //TRUE表示正在画直线
BOOL m_bpaintChord; //TRUE表示正在画弦
BOOL m_bpaintEllipse;//TRUE表示正在画椭圆
BOOL m_bpaintLazys; //TRUE表示正在画懒-S
BOOL m_bpaintPie; //TRUE表示正在画扇形
BOOL m_bpaintPolygon;//TRUE表示正在画多边形
BOOL m_bpaintRect; //TRUE表示正在画矩形
BOOL m_bpaintRoundrect;//TRUE表示正在画圆角矩形
BOOL m_bpaintScp; //TRUE表示正在画软侧移
BOOL m_bpaintSide; //TRUE表示正在画硬侧移
void GenerateTool(); //把基类指针指向用于操纵的派生类
void RecalcBoundary(); //剪切图形后重新计算屏幕区域大小
CPainted * GetShape(int item);
int NumShapes();
void GetData();//按照要求的数据格式组织节点数组及路径数组
CNode* GetNode(USHORT uId);
// Generated message map functions
protected:
//{{AFX_MSG(CPaintobjDoc)
afx_msg void OnToolSelector(); //按下箭头工具
afx_msg void OnViewZoomin();
afx_msg void OnUpdateViewZoomin(CCmdUI* pCmdUI);
afx_msg void OnViewZoomout();
afx_msg void OnUpdateViewZoomout(CCmdUI* pCmdUI);
afx_msg void OnOutputSaveoutdata();
afx_msg void OnToolClockwisearc();
afx_msg void OnToolAnticlockwisearc();
afx_msg void OnUpdateViewMove(CCmdUI* pCmdUI);
afx_msg void OnViewMove();
afx_msg void OnSelectTangency();
afx_msg void OnUpdateSelectTangency(CCmdUI* pCmdUI);
afx_msg void OnSelectNottangency();
afx_msg void OnUpdateSelectNottangency(CCmdUI* pCmdUI);
afx_msg void OnToolLineNormal();
afx_msg void OnToolLineStartnode();
afx_msg void OnToolClockwiseNormal();
afx_msg void OnToolClockwiseRadius();
afx_msg void OnToolClockwiseStartendnode();
afx_msg void OnToolClockwiseStartnode();
afx_msg void OnToolAnticlockwiseNormal();
afx_msg void OnToolAnticlockwiseRadius();
afx_msg void OnToolAnticlockwiseStartendnode();
afx_msg void OnToolAnticlockwiseStartnode();
afx_msg void OnToolLineAnglelength();
afx_msg void OnToolLineStartendnode();
afx_msg void OnToolChordNormal();
afx_msg void OnToolChordRadius();
afx_msg void OnToolChordStartendnode();
afx_msg void OnToolChordStartnode();
afx_msg void OnToolEllipseNormal();
afx_msg void OnToolEllipseStartendnode();
afx_msg void OnToolLazysAngle();
afx_msg void OnToolLazysAnglestartendnode();
afx_msg void OnToolLazysAnglestartnode();
afx_msg void OnToolPieNormal();
afx_msg void OnToolPieRadius();
afx_msg void OnToolPieStartendnode();
afx_msg void OnToolPieStartnode();
afx_msg void OnToolPolygonAllnode();
afx_msg void OnToolPolygonNormal();
afx_msg void OnToolRectNormal();
afx_msg void OnToolRectStartendnode();
afx_msg void OnToolRoundrectEllipse();
afx_msg void OnToolRoundrectEllipsestartendnode();
afx_msg void OnToolScpAngle();
afx_msg void OnToolScpAnglestartendnode();
afx_msg void OnToolScpAnglestartnode();
afx_msg void OnToolSideNormal();
afx_msg void OnToolSideStartendnode();
afx_msg void OnToolSideStartnode();
afx_msg void OnUpdateToolCheck(CCmdUI* pCmdUI);
afx_msg void OnFileOpen();
afx_msg void OnToolBuildingAnticlockwiseNormal();
afx_msg void OnToolBuildingAnticlockwiseRadius();
afx_msg void OnToolBuildingAnticlockwiseStartendnode();
afx_msg void OnToolBuildingAnticlockwiseStartnode();
afx_msg void OnToolBuildingClockwiseNormal();
afx_msg void OnToolBuildingClockwiseRadius();
afx_msg void OnToolBuildingClockwiseStartendnode();
afx_msg void OnToolBuildingClockwiseStartnode();
afx_msg void OnToolBuildingLazysAngle();
afx_msg void OnToolBuildingLazysAnglestartendnode();
afx_msg void OnToolBuildingLazysAnglestartnode();
afx_msg void OnToolBuildingLineNormal();
afx_msg void OnToolBuildingLineStartendnode();
afx_msg void OnToolBuildingLineStartnode();
afx_msg void OnToolDeviceAnticlockwiseNormal();
afx_msg void OnToolDeviceAnticlockwiseRadius();
afx_msg void OnToolDeviceAnticlockwiseStartendnode();
afx_msg void OnToolDeviceAnticlockwiseStartnode();
afx_msg void OnToolDeviceChordNormal();
afx_msg void OnToolDeviceChordRadius();
afx_msg void OnToolDeviceChordStartendnode();
afx_msg void OnToolDeviceChordStartnode();
afx_msg void OnToolDeviceClockwiseNormal();
afx_msg void OnToolDeviceClockwiseRadius();
afx_msg void OnToolDeviceClockwiseStartendnode();
afx_msg void OnToolDeviceClockwiseStartnode();
afx_msg void OnToolDeviceEllipseNormal();
afx_msg void OnToolDeviceEllipseStartendnode();
afx_msg void OnToolDeviceLazysAngle();
afx_msg void OnToolDeviceLazysAnglestartendnode();
afx_msg void OnToolDeviceLazysAnglestartnode();
afx_msg void OnToolDeviceLineNormal();
afx_msg void OnToolDeviceLineStartendnode();
afx_msg void OnToolDeviceLineStartnode();
afx_msg void OnToolDevicePieNormal();
afx_msg void OnToolDevicePieRadius();
afx_msg void OnToolDevicePieStartendnode();
afx_msg void OnToolDevicePieStartnode();
afx_msg void OnToolDevicePolygonAllnode();
afx_msg void OnToolDevicePolygonNormal();
afx_msg void OnToolDeviceRectNormal();
afx_msg void OnToolDeviceRectStartendnode();
afx_msg void OnToolDeviceRoundrectEllipse();
afx_msg void OnToolDeviceRoundrectEllipsestartendnode();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
protected:
void ResetAll();
};
/////////////////////////////////////////////////////////////////////////////
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -