242 lines
11 KiB
C++
242 lines
11 KiB
C++
/********************************************************************
|
|
created: 2006/05/10
|
|
created: 10:5:2006 10:18
|
|
filename: f:\tg_dev\telecdev\tapi\teldef.h
|
|
file path: f:\tg_dev\telecdev\tapi
|
|
file base: teldef
|
|
file ext: h
|
|
author: 沈睿
|
|
|
|
purpose: 电气公共函数,全局变量
|
|
*********************************************************************/
|
|
|
|
#ifndef __TELDEF_H__
|
|
#define __TELDEF_H__
|
|
|
|
class CBreakPtList
|
|
{
|
|
public:
|
|
CBreakPtList(XPoint ptFirst, XPoint ptEnd){m_ptFirst = ptFirst; m_ptEnd = ptEnd;};
|
|
XPoint m_ptFirst, m_ptEnd;
|
|
};
|
|
|
|
//**********************************************************************
|
|
// 电气全局变量
|
|
//**********************************************************************
|
|
extern TELAPI BOOL g_bJoin2Wire;
|
|
extern TELAPI CString g_csTextAttr; //块属性字
|
|
extern TELAPI CString g_csBlkAttrTypeChnShx;//块属性字中文字体
|
|
extern TELAPI CString g_csBlkAttrTypeEngShx;//块属性字英文字体
|
|
extern TELAPI CString g_csDwbPath, g_csSysPath, g_csLineTypeStyle;
|
|
extern TELAPI double g_dChamAngle; //倒角半径
|
|
extern TELAPI double g_nEqBlkLength, g_nEq2WallDist, g_nPointDia,
|
|
g_nTerminalDia, g_nWireDimScale,
|
|
g_nDimHeight, g_nScaleDim, g_nWireNumHeight,g_nInsBlkRotate;
|
|
|
|
extern TELAPI int g_iLastBlkMaxNum, g_iWireBreak,
|
|
g_iWireTextType, g_iWireNumType,g_iPlanWireIndex;//g_iPlanWireIndex 图层数组索引 参加ArxMain()
|
|
|
|
extern TELAPI BOOL g_bJoin2Wire, g_bAskInsBlk, g_bThickEquip,
|
|
g_bWireAskInfo, g_bDimWireSimple,
|
|
g_bCloseLnGrid, g_bDrawWireDiv, g_bRotateAttrib;
|
|
extern TELAPI BOOL g_bIsChamAngle; //是否倒角
|
|
extern TELAPI CString g_csDimChnShx,g_csDimEngShx,g_csDimStyle;
|
|
extern TELAPI CString g_csTelFontStyle; //电气标注样式 引出标注使用
|
|
extern TELAPI CString g_csBlkAttrTypeChnShx;//块属性字中文字体
|
|
extern TELAPI CString g_csBlkAttrTypeEngShx;//块属性字英文字体
|
|
extern TELAPI CString g_csInsBlkName;
|
|
//*********************************************************************
|
|
// 电气导线变量
|
|
//**********************************************************************
|
|
#define MAX_WIRE_LEN 37
|
|
#define g_nCurWireWidth g_nWireWidth[g_iPlanWireIndex]*DocGetPScale() > 0.01 ? g_nWireWidth[g_iPlanWireIndex]*DocGetPScale() : 0.5*DocGetPScale()
|
|
extern TELAPI BOOL g_bLineTypeByLayer;
|
|
extern TELAPI double g_nWireWidth[MAX_WIRE_LEN]; //导线线宽
|
|
extern TELAPI double g_dBlkThickWidth; //图块加粗线宽 2011-9-1 sr add
|
|
extern TELAPI double g_dBusLineWidth, g_dSysLineWidth; //系统导线 线宽
|
|
extern TELAPI double g_dWireWidthGround, g_dWireWidthLighting; //避雷 接地 线宽
|
|
extern TELAPI int g_iGourdWireLineType, g_iLightingWireLineType; //避雷 接地 线型 1:普通线型+图块 0:线型
|
|
extern TELAPI BOOL g_bNeedUser[33]; //是否激活
|
|
extern TELAPI CString g_csUserName[15];
|
|
extern TELAPI int g_iWireDimNorm[MAX_WIRE_LEN]; //0:普通,1:阻燃,2:耐火
|
|
extern TELAPI CString g_csWireDimMode[MAX_WIRE_LEN], g_csWireDimPlace[MAX_WIRE_LEN], g_csWireDimRadius[MAX_WIRE_LEN],
|
|
g_csWireDimType[MAX_WIRE_LEN], g_csWireLoop[MAX_WIRE_LEN], g_csWireDimArea[MAX_WIRE_LEN], g_csWireLineNum[MAX_WIRE_LEN];
|
|
extern TELAPI CString g_csLineType[MAX_WIRE_LEN]; //导线线型
|
|
//************************************************************************
|
|
// 电气公共函数
|
|
//************************************************************************
|
|
TELAPI resbuf *GetWireMask();
|
|
TELAPI resbuf *GetThickWireMask();
|
|
|
|
TELAPI void AdjustWndToViewport(CWnd* pWnd,int nXOff = 0.0,int nYOff = 0.0);
|
|
TELAPI BOOL IsBlkSocket(Entity ent);
|
|
TELAPI BOOL IsBlkSwitchBoard(Entity ent);
|
|
TELAPI BOOL IsBlkLight(Entity ent);
|
|
TELAPI BOOL IsBlkSwitch(Entity ent);
|
|
TELAPI BOOL IsWireCable(Entity ent);
|
|
TELAPI BOOL IsBlkPowerEquip(Entity ent);
|
|
TELAPI BOOL IsBlkWeakEquip(Entity ent);
|
|
TELAPI BOOL IsBlkFireEquip(Entity ent);
|
|
|
|
TELAPI Entity DrawLineWire(XPoint pt1, XPoint pt2, const TCHAR* szLayer = _T("导线"));
|
|
|
|
TELAPI void GetWire2Point(Entity ent, XPoint &ptStart, XPoint &ptEnd);
|
|
TELAPI BOOL GetAllWireInEq(PickSet &ssSel, Entity entEq, BOOL bIsTouch = TRUE, const RBList &rbMask = RBList(GetThickWireMask()));
|
|
TELAPI BOOL GetAllWireInEq(PickSet &ssSel, Entity entEq, XPointList &lstPt, RBList &rbMask);
|
|
TELAPI void GetAllEqByWire(Entity entwire, Entity &ent1, Entity &ent2);
|
|
|
|
TELAPI BOOL IsWireInEnt(Entity ent, Entity entEq, const XPoint &ptConnect = XPoint());
|
|
|
|
|
|
TELAPI BOOL GetEquipPoint(Entity entBlk, XPointList &lstPt, double &nRadius);//得到设备块上的接线点, 如果是圆设备,返回圆心和半径
|
|
TELAPI void GetEquipLinkPath(Entity &ent1, Entity &ent2, const XPoint &ptPick, DList<XPoint> &lstPts);
|
|
|
|
TELAPI BOOL IsSameBlk(CString csBlk1, CString csBlk2); //判断2个图块是否是同一图块
|
|
|
|
TELAPI Entity GetPtOnWall(XPoint pt);
|
|
TELAPI Entity GetPtOnWindow(XPoint pt);// 给定1点, 得到该点上的窗, 柱
|
|
TELAPI Entity GetWireByPoint(XPoint pt);
|
|
TELAPI Entity GetPWireByPoint(XPoint pt);
|
|
|
|
//得到图块和导线相连时, 导线的两打断点
|
|
TELAPI void GetBlkBreakPt(Entity entBlk, Entity entBreak, double nBreLen, XPoint &ptBr1, XPoint &ptBr2);
|
|
|
|
TELAPI BOOL IsBraLine(Entity ent); //是否是干线?
|
|
TELAPI BOOL IsBusLine(Entity ent); //是否是干线?
|
|
TELAPI BOOL LstDemoDisplayPoint(XPointList &lstPtIn, XPointList &lstPtOut, double dAngle = -1);
|
|
TELAPI void ThickBlkPLine(Entity entBlk, double dWidth = -1);
|
|
TELAPI void ThickBlkPLine(const TCHAR* szBlkName);
|
|
TELAPI CString GetAttrib(Entity entTemp, const TCHAR*szTag, BOOL bIsVisable = TRUE);
|
|
TELAPI BOOL DrawPLineWireBy2Equip(Entity oldent, Entity ent1, Entity ent2);
|
|
TELAPI CString GetWireRemarkByInfo(const TCHAR* szCaption, const TCHAR* szVal);
|
|
TELAPI Entity GetNearestEnt(PickSet &ssSel, XPoint pt);
|
|
TELAPI void GetBlkBreakPtByPoly(XCircle cir, Entity entBreak, XPoint &ptBr1, XPoint &ptBr2);
|
|
TELAPI void DoBreakPLine(Entity ent, DList<CBreakPtList> &lstPt);
|
|
TELAPI double GetWireWidth(Entity ent);
|
|
TELAPI Entity GetCulBreakPWire(PickSet &ssAllBreak, PickSet &ssff);
|
|
TELAPI void BreakMWire(Entity entSel, XPoint ptPick, XPoint ptPick2);
|
|
TELAPI XCurveSegment GetBlkSel(Entity entBlk, XPoint ptPick);
|
|
TELAPI bool SetLayerLockedTel(const CString& sLayerName, bool bLock);
|
|
TELAPI bool SetLayerLockedTel(XStringList& lstLayerName, bool bLock);
|
|
TELAPI void UpdateLayerLockFade(BOOL bRegen = FALSE);
|
|
//绘制导线
|
|
TELAPI void DrawPLineWire(XPoly2D &xpoly, int iLayerIndex, BOOL bJoin);
|
|
//
|
|
TELAPI void DrawPLineWire(XPoint ptStart, XPoint ptEnd, int iLayerIndex, BOOL bJoin = g_bJoin2Wire);
|
|
TELAPI void DrawPArcWire(XPoint ptStart, XPoint ptMid, XPoint ptEnd, int iLayerIndex, BOOL bJoin = g_bJoin2Wire);
|
|
TELAPI void DrawPArcWire(XArc arc, int iLayerIndex);
|
|
TELAPI void DrawDivWire(XPoint ptStart, XPoint ptEnd, BOOL bIsBusWire, BOOL bNeed = TRUE, BOOL bIsEmptyMWire = FALSE);
|
|
|
|
|
|
// 0: LAY_WIRE_ILLUME 照明
|
|
// 1: LAY_WIRE_POWER 动力
|
|
// 2: LAY_WIRE_FIRE 消防
|
|
// 3: LAY_WIRE_WEAK 弱电
|
|
// 4: LAY_WIRE_EMERG 照明-应急
|
|
// 5: LAY_WIRE_TEL 消防-电话
|
|
// 6: LAY_WIRE_BROAD 消防-广播
|
|
// 7: LAY_WIRE_CTRL 消防-控制
|
|
// 8: LAY_WIRE_SOURCE 消防-电源
|
|
// 9: LAY_WIRE_USER1 弱电-电视
|
|
// 10: LAY_WIRE_USER2 弱电-网络
|
|
// 11: LAY_WIRE_USER3 动力-控制
|
|
// 12: LAY_WIRE_USER4 动力-母线
|
|
// 13: LAY_WIRE_USER5 弱电-信号
|
|
// 14: LAY_WIRE_USER6 弱电-安防
|
|
// 15: LAY_WIRE_USER7 弱电-广播
|
|
// 16: LAY_WIRE_USER8 消防-启泵
|
|
// 17: LAY_WIRE_SOCKET 插座
|
|
// 18: LAY_WIRE_USER9 弱电-控制
|
|
// 19: LAY_WIRE_USER10 弱电-电话
|
|
// 20: LAY_WIRE_USER11 弱电-综合布线
|
|
// 21: LAY_WIRE_OPTICAL_CABLE 光缆
|
|
// 22: LAY_WIRE_THUNDER 避雷线
|
|
// 23: LAY_WIRE_GROUND 接地线
|
|
// 24: LAY_WIRE_USER15 弱电其他
|
|
// 25: LAY_WIRE_USER13 视频
|
|
// 26: LAY_WIRE_USER12 会议
|
|
// 27: LAY_WIRE_USER14 卫星电视
|
|
// 28: LAY_WIRE_USER16 消防报警
|
|
// 29: LAY_WIRE_USER17 消防联动
|
|
// 30: LAY_WIRE_USER18 消防信号3
|
|
// 31: LAY_WIRE_USER19 消防信号4
|
|
// 32: LAY_WIRE_USER20 消防信号5
|
|
// 33: LAY_WIRE_USER21 消防手控
|
|
// 34: LAY_WIRE_USER22 消防气体
|
|
// 35: LAY_WIRE_USER23 消防火灾
|
|
// 36: LAY_WIRE_USER24 备用
|
|
|
|
|
|
inline CString GetWireLayer(int Index=-1)
|
|
{
|
|
//axc mod 2014-12-11
|
|
CString csLayer[] = {LAY_WIRE_ILLUME,LAY_WIRE_POWER,LAY_WIRE_FIRE,LAY_WIRE_WEAK,
|
|
LAY_WIRE_EMERG,LAY_WIRE_TEL,LAY_WIRE_BROAD,LAY_WIRE_CTRL,
|
|
LAY_WIRE_SOURCE,LAY_WIRE_USER1,LAY_WIRE_USER2,LAY_WIRE_USER3, LAY_WIRE_USER4,
|
|
LAY_WIRE_USER5,LAY_WIRE_USER6,LAY_WIRE_USER7,LAY_WIRE_USER8,
|
|
LAY_WIRE_SOCKET,LAY_WIRE_USER9,LAY_WIRE_USER10,LAY_WIRE_USER11,LAY_WIRE_OPTICAL_CABLE,
|
|
LAY_WIRE_THUNDER,LAY_WIRE_GROUND,LAY_WIRE_USER15,LAY_WIRE_USER13,LAY_WIRE_USER12,
|
|
LAY_WIRE_USER14,LAY_WIRE_USER16,LAY_WIRE_USER17,LAY_WIRE_USER18,LAY_WIRE_USER19,
|
|
LAY_WIRE_USER20,LAY_WIRE_USER21,LAY_WIRE_USER22,LAY_WIRE_USER23,LAY_WIRE_USER24};
|
|
if(Index == -1)
|
|
return csLayer[0];
|
|
else
|
|
return csLayer[Index];
|
|
}
|
|
|
|
inline int GetWireLayerIndex(const TCHAR* szLayer)
|
|
{
|
|
CString Layer = szLayer;
|
|
//axc mod 2014-12-11
|
|
CString csLayer[] = {LAY_WIRE_ILLUME,LAY_WIRE_POWER,LAY_WIRE_FIRE,LAY_WIRE_WEAK,
|
|
LAY_WIRE_EMERG,LAY_WIRE_TEL,LAY_WIRE_BROAD,LAY_WIRE_CTRL,
|
|
LAY_WIRE_SOURCE,LAY_WIRE_USER1,LAY_WIRE_USER2,LAY_WIRE_USER3, LAY_WIRE_USER4,
|
|
LAY_WIRE_USER5,LAY_WIRE_USER6,LAY_WIRE_USER7,LAY_WIRE_USER8,
|
|
LAY_WIRE_SOCKET,LAY_WIRE_USER9,LAY_WIRE_USER10,LAY_WIRE_USER11,LAY_WIRE_OPTICAL_CABLE,
|
|
LAY_WIRE_THUNDER,LAY_WIRE_GROUND,LAY_WIRE_USER15,LAY_WIRE_USER13,LAY_WIRE_USER12,
|
|
LAY_WIRE_USER14,LAY_WIRE_USER16,LAY_WIRE_USER17,LAY_WIRE_USER18,LAY_WIRE_USER19,
|
|
LAY_WIRE_USER20,LAY_WIRE_USER21,LAY_WIRE_USER22,LAY_WIRE_USER23,LAY_WIRE_USER24};
|
|
|
|
for(int i=0;i<36;i++){
|
|
if(Layer == csLayer[i])
|
|
return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
inline CString GetWireDimLayer(LPCTSTR strLayer)
|
|
{
|
|
if (strLayer == NULL)
|
|
{
|
|
return LAY_DIM_SYSTEM;
|
|
}
|
|
//bsl 2011.10.20 增加导线标注图层(与导线图层一一对应)
|
|
CString strRet = _T("");
|
|
int nIndex = GetWireLayerIndex(strLayer);
|
|
//axc mod 2014-12-11
|
|
CString sDimLayer[] = {LAY_DIM_ILLUME,LAY_DIM_POWER,LAY_DIM_FIRE,LAY_DIM_WEAK,
|
|
LAY_DIM_EMERG,LAY_DIM_TEL,LAY_DIM_BROAD,LAY_DIM_CTRL,
|
|
LAY_DIM_SOURCE,LAY_WIRE_DIM_USER1,LAY_WIRE_DIM_USER2,LAY_WIRE_DIM_USER3, LAY_WIRE_DIM_USER4,
|
|
LAY_WIRE_DIM_USER5,LAY_WIRE_DIM_USER6,LAY_WIRE_DIM_USER7,LAY_WIRE_DIM_USER8,
|
|
LAY_DIM_SOCKET,LAY_WIRE_DIM_USER9,LAY_WIRE_DIM_USER10,LAY_WIRE_DIM_USER11,LAY_DIM_OPTICAL_CABLE,
|
|
LAY_DIM_THUNDER,LAY_DIM_GROUND,LAY_WIRE_DIM_USER15,LAY_WIRE_DIM_USER13,LAY_WIRE_DIM_USER12,
|
|
LAY_WIRE_DIM_USER14,LAY_WIRE_DIM_USER16,LAY_WIRE_DIM_USER17,LAY_WIRE_DIM_USER18,LAY_WIRE_DIM_USER19,
|
|
LAY_WIRE_DIM_USER20,LAY_WIRE_DIM_USER21,LAY_WIRE_DIM_USER22,LAY_WIRE_DIM_USER23,LAY_WIRE_DIM_USER24};
|
|
if (nIndex != -1)
|
|
{
|
|
strRet = sDimLayer[nIndex];
|
|
}
|
|
else
|
|
strRet = LAY_DIM_SYSTEM;
|
|
|
|
return strRet;
|
|
}
|
|
|
|
#define XD_BRADATA _T("bradata") // sr add app reg
|
|
#define XD_BUSDATA _T("busdata") // sr add app reg
|
|
#define XD_LINENUM _T("linenum") // sr add app reg
|
|
#define XD_ELEMENT _T("Element") // sr add app reg
|
|
#define g_nBlkLength 1500
|
|
#define DIV_DIST g_nBlkLength/2
|
|
|
|
#endif // __TELDEF_H__
|