📄 element.h
字号:
// Element.h: interface for the CElement class.
//
//////////////////////////////////////////////////////////////////////
/*
对外发布
图元基类
*/
///////////////////////////////////////////////////////////////////////
#if !defined(AFX_ELEMENT_H__1F1E7283_3B79_4862_B1CB_81482C08F746__INCLUDED_)
#define AFX_ELEMENT_H__1F1E7283_3B79_4862_B1CB_81482C08F746__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Scn.h"
#include "as_transf.hxx"
#include "as_position.hxx"
#include "as_vector.hxx"
#include "as_unitvec.hxx"
#include "as_matrix.hxx"
#include "GraphFun.h"
#include "dcl_graph.h"
#define DOT 100
#define LINE 101
#define PLOYGON 102
#define RECTANGLE 103
#define ARC 104
#define CIR 105
#define TXT 106
#define LINK 107
#define NODE 108
#define ELLIPSE 109
#define ELEMENTS 110
#define LINES 111
typedef struct
{
char * m_font_name; //字体名称
double m_high; //字体高度
double m_width; //字体宽度
double m_angle; //字体角度
long m_color; //字体颜色
BOOL m_bold; //粗体标志
BOOL m_italic; //斜体标志
BOOL m_underline; //下划线标志
} FontStyle;
class CViewWnd;
class CRelation;
class Snap;
class CDot;
typedef CList<CDot *,CDot *> DotList;
class DECL_GRAPH CElement : public CObject
{
public:
CElement();
virtual ~CElement();
protected:
DotList *m_pDotList;//点集
// CPts m_Points;//点集
BOOL m_bVisible;//是否可见
int m_nLayerId;
int m_nParentId;//所属父图元ID
int m_LineType;//线型
int m_LineWidth;//线宽
long m_LineColor;//线的颜色
long m_FillColor;//填充颜色
int m_FillStyle;//填充模式
int m_LineStyle;
FontStyle *m_pFontStyle;//字体风格
public:
int m_nId;//图元ID
int m_nType;
//得到图元ID
int GetId(){return m_nId;};
void SetId(int nId){m_nId=nId;};
int ParentId(){return m_nParentId;};
void ParentId(int nParentId){m_nParentId=nParentId;};
void LineWidth(int nLineWidth);
int LineWidth();
void LineColor(long nLineColor){m_LineColor=nLineColor;};
long LineColor(){return m_LineColor;};
void FillStyle(int nFillStyle){m_FillStyle=nFillStyle;};
int FillStyle(){return m_FillStyle;};
void FillColor(long nFillColor){m_FillColor=nFillColor;};
long FillColor(){return m_FillColor;};
int LineStyle(){return m_LineStyle;};
void LineStyle(int nLineStyle){m_LineStyle=nLineStyle;};
FontStyle *GetFontStyle(){return m_pFontStyle;};
void SetFontStyle(FontStyle *pFontStyle){m_pFontStyle=pFontStyle;};
public:
//得到点集
DotList *GetPoints(){return m_pDotList;}
//得到矩形框
virtual void GetRect(CDot &lefttop,CDot &rightbottom);
//图元拷贝
CElement *Copy();
//绘制图元
virtual void Draw(CDC *pDC,CScn *pScn);
virtual void Draw(CDC *pDC,CScn *pScn,transf tran);
//移动修改图元
virtual void MoveModify(transf tran);
//高亮
virtual void HightLight(CDC *pDC,BOOL bHightLight,CScn *pScn,long nColor);
//选中
virtual void ShowSelect(CDC *pDC,BOOL bSelect,CScn *pScn,long nColor);
//是否可见
BOOL Visible(){return m_bVisible;};
void Visible(BOOL bVisible){m_bVisible=bVisible;};
//添加到视图窗口中
BOOL AddToView(CViewWnd *pViewWnd);
void LayerId(int nLayerId){m_nLayerId=nLayerId;};
int LayerId(){return m_nLayerId;};
protected:
virtual transf ViewToDraw();
virtual transf DrawToView();
virtual BOOL Pick(position& pe,position& ret_pos,double& dist,double pick_tol,int &type,int &ext_type);
friend class CRelation;
friend class CSnap;
friend class CLineSnap;
friend class CSelectEvent;
};
#endif // !defined(AFX_ELEMENT_H__1F1E7283_3B79_4862_B1CB_81482C08F746__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -