378 lines
14 KiB
C++
378 lines
14 KiB
C++
#ifndef AFX_TDBCABLEDIM_H__
|
||
#define AFX_TDBCABLEDIM_H__
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif
|
||
|
||
#ifdef _TCHPIPEBASE_
|
||
#define DLLIMPEXP __declspec(dllexport)
|
||
#else
|
||
#ifdef _TCHPIPEBASE_COM_
|
||
#define DLLIMPEXP
|
||
#else
|
||
#define DLLIMPEXP __declspec(dllimport)
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef TCHPIPEBASE_DBXSERVICE
|
||
#define TCHPIPEBASE_DBXSERVICE _T("TCHPIPEBASE_DBXSERVICE")
|
||
#endif
|
||
|
||
#include <vector>
|
||
|
||
//add liaoy 2016-1-27
|
||
//保存文字插入点 查找替换命令使用
|
||
struct SCableDimTextInfo
|
||
{
|
||
AcGePoint3d pt;
|
||
CString sText;
|
||
};
|
||
//add end
|
||
|
||
class DLLIMPEXP TDbCableDim : public TDbEntity
|
||
{
|
||
DECLARE_TENTBASE();
|
||
ACRX_DECLARE_MEMBERS(TDbCableDim);
|
||
public:
|
||
|
||
TDbCableDim();
|
||
~TDbCableDim();
|
||
|
||
// Properties
|
||
virtual double GetTextHeight() const;
|
||
virtual AcDbObjectId GetTextStyleId() const;
|
||
AcDbObjectId GetTextLayerId() const;
|
||
virtual void SetTextHeight(double nHeight);
|
||
virtual void SetTextStyleId(AcDbObjectId id);
|
||
void SetTextLayerId(AcDbObjectId id);
|
||
void SetTextRotation(double nRot);
|
||
double GetTextRotation() const;
|
||
BOOL SplitValue(LPCTSTR pszSrc, LPCTSTR pszSplitCh, CStringArray& arValue) const;
|
||
BOOL SplitString(CString& sSrc, LPCTSTR pszSplitCh, CString& sValue) const;
|
||
|
||
BOOL IsTextRotated() const
|
||
{
|
||
return (fabs(m_nTextRotation)>_angSnap);
|
||
}
|
||
|
||
//设置起点
|
||
void SetStartPt(const AcGePoint3d &pt);
|
||
//设置拐点
|
||
void SetTurnPt(const AcGePoint3d &pt);
|
||
//设置标注方向
|
||
void SetVtDir(const AcGeVector3d &vt);
|
||
//设置标注样式
|
||
void SetLableStyle(int nStyle);
|
||
//设置标注起点样式
|
||
void SetLableStartStyle(int nStyle);
|
||
//设置标注实体的类型
|
||
void SetLableEntsType(int nType);
|
||
//设置要标注的实体的ID
|
||
void SetLableEntsIds(const AcDbObjectIdArray &arIds);
|
||
//设置行间距系数
|
||
void SetTextRowDisFact(double dDisFact);
|
||
//设置标注间隔符
|
||
void SetLableFds(CString& sLableFds);;
|
||
//设置标注颜色
|
||
void SetLableLineColor(Adesk::UInt16 nColor); //不要使用这个 请使用setcolorindex
|
||
//设置文字颜色
|
||
void SetLableTextColor(Adesk::UInt16 nColor);
|
||
//设置出图比例
|
||
virtual void SetPrintScale(double dScale);
|
||
//设置布局转角
|
||
virtual void SetLayoutRotationAngle(double dAngle);
|
||
//设置电缆标注类型
|
||
virtual void SetCableLabelType(LPCTSTR pszType);
|
||
//设置引线扩展数据点
|
||
void SetDownLeadXData(const AcGePoint3dArray &arPts);
|
||
//设置是否标注穿管
|
||
void SetIsDimPipeFlow(BOOL bPipeFlow);
|
||
//设置是否是否多电缆敷设标注
|
||
void SetIsMulitCableLayDim(BOOL bIsMulitCableLayDim);
|
||
//设置小数点位数
|
||
void SetDataValidPrecision(Adesk::UInt16 nBit);
|
||
|
||
//设置系统分类关键字
|
||
void SetSysKeyForce(CString& sSysKeyForce);//lsd 2013-8-26 强电
|
||
void SetSysKeyWeak(CString& sSysKeyWeak);//lsd 2013-8-26 弱电
|
||
void SetSysKeyFire(CString& sSysKeyFire);//lsd 2013-8-26 消防
|
||
void SetSysKeyOther(CString& sSysKeyOther);//lsd 2013-8-26 其他
|
||
//
|
||
CString GetSysKeyForce() const;
|
||
CString GetSysKeyWeak() const;
|
||
CString GetSysKeyFire() const;
|
||
CString GetSysKeyOther() const;
|
||
//
|
||
//得到起点
|
||
virtual AcGePoint3d GetStartPt();
|
||
//得到拐点
|
||
virtual AcGePoint3d GetTurnPt();
|
||
//得到标注方向
|
||
virtual AcGeVector3d GetVtDir();
|
||
//得到标注样式
|
||
virtual Adesk::UInt16 GetLableStyle();
|
||
//得到标注起点样式
|
||
virtual Adesk::UInt16 GetLableStartStyle();
|
||
//得到标注实体类型
|
||
virtual Adesk::UInt16 GetLableEntsType();
|
||
//得到小数点位数
|
||
virtual Adesk::UInt16 GetDataValidPrecision();
|
||
//得到标注的实体的ID
|
||
virtual void GetLableEntsIds(AcDbObjectIdArray &arIds);
|
||
//得到文字行间距系数
|
||
virtual double GetTextRowDisFact();
|
||
//得到标注分隔符
|
||
virtual CString GetLableFds(CString& sLableFds);
|
||
//得到标注颜色
|
||
virtual Adesk::UInt16 GetLableLineColor();
|
||
//得到文字颜色
|
||
virtual Adesk::UInt16 GetLableTextColor();
|
||
//获取出图比例
|
||
virtual double GetPrintScale();
|
||
//获取布局转角
|
||
virtual double GetLayoutRotationAngle();
|
||
//得到电缆标注类型
|
||
virtual CString GetCableLabelType();
|
||
//得到引线点扩展数据
|
||
void GetDownLeadXData(AcGePoint3dArray &arPts);
|
||
|
||
//子类对象格式刷支持 属性从
|
||
virtual void CopyPropertiesFrom(AcDbEntity *pSrc,unsigned gMatchFlag);
|
||
//axc add 2014-07-31 T20电缆标注 设置起始线的长度
|
||
void SetStartLineLen(double dLen);
|
||
double GetStartLineLen() const;
|
||
|
||
// id
|
||
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
|
||
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
|
||
virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* pFiler);
|
||
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
|
||
virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
|
||
|
||
//add liaoy 2016-1-25
|
||
//返回发现的位置,同时posStart往前移动(以便继续找下一个使用)
|
||
virtual TTextPosition FindSubText(const TCHAR *sSubText, TTextPosition &posStart, TTextRange *pRange=NULL) const;
|
||
// 返回下一次查找的开始位置
|
||
virtual TTextPosition ReplaceSubText(const TTextPosition &posRep, const TCHAR *sRepText, TTextRange *pRange=NULL);
|
||
virtual long GetSubTextNum()const;
|
||
virtual void SetSubText(long i,CString sText);
|
||
/*设置电缆标注,暂弃用
|
||
//void SetTextForLay(const AcArray<SCableDimTextInfo>& arTextInfo);
|
||
//设置电缆标注字符串,执行GetCableLayString()的逆过程
|
||
//void SetCableLayString(const AcDbObjectId &id,const CString &sText,const int& nIndex) ;
|
||
//更新当前电缆的其他拓展数据
|
||
//void UpdateOtherXData(AcDbEntity* pEnt,const CString& sNum,const CString& sSpe,const int& nIndex);
|
||
//读取拓展数据
|
||
//BOOL ReadXData(const AcDbEntity*pEnt, const TCHAR*szName,CString& sValue) const;
|
||
//BOOL ReadXData(const AcDbEntity*pEnt, const TCHAR*szName,AcGePoint3dArray& arPts) const;
|
||
//写拓展数据
|
||
//BOOL WriteXData(AcDbEntity *pEnt, const TCHAR*szName, const TCHAR*szValue) const;
|
||
//写拓展数据,nIndex:0表示修改程序名,n(n>0):表示修改程序名拓展数据链表的第n个
|
||
//BOOL WriteXData(AcDbEntity *pEnt, const CString& sName, const CString& sValue,const int& nIndex) const;
|
||
//移除拓展数据
|
||
//BOOL RemoveXData(AcDbEntity* pEnt, LPCTSTR pszAppName) const;
|
||
//更新与此标注相关联的电缆的其他相关联电缆的拓展数据
|
||
//void UpdateRelatedEntXData(const AcDbEntity* pSrcEnt,const CString& sNum,const int& nIndex);
|
||
//更新与此标注相关联的电缆的其他相关联电缆的拓展数据,适用于电缆为经桥架转PL线后且经电缆敷设过的PL
|
||
//void UpdateRelatedEntXDataForPL(const AcDbEntity* pSrcEnt,const CString& sNum,const int& nIndex);
|
||
*/
|
||
//add end
|
||
|
||
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
||
virtual Acad::ErrorStatus ExplodeOrDraw3d(XExplodeDraw &dc) const;
|
||
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
AcDbIntArray& osnapModes,
|
||
AcDbIntArray& geomIds) const;
|
||
virtual Acad::ErrorStatus subDeepClone(AcDbObject* pOwnerObject,
|
||
AcDbObject*& pClonedObject,
|
||
AcDbIdMapping& idMap,
|
||
Adesk::Boolean isPrimary) const;
|
||
virtual Acad::ErrorStatus subWblockClone( AcRxObject* pOwnerObject,
|
||
AcDbObject*& pClonedObject,
|
||
AcDbIdMapping& idMap,
|
||
Adesk::Boolean isPrimary) const;
|
||
virtual Acad::ErrorStatus subGetStretchPoints(AcGePoint3dArray & stretchPoints) const;
|
||
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
virtual Acad::ErrorStatus subMoveStretchPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
||
virtual int GetFirstVersion()const{return 8;}
|
||
virtual TSubText* HitTestText(XPoint pt)const {return NULL;};
|
||
//更新桥架长度
|
||
virtual void RenewCableLen();
|
||
//更新桥架实体ID
|
||
void RenewCableEnts(const AcDbObjectIdArray &arIds);
|
||
//更新数据
|
||
//
|
||
void UpdateDimData();
|
||
|
||
//更新行列夹点
|
||
void InitGripPntsForLay();
|
||
//设置电缆高度
|
||
void SetCabSign(const TCHAR* pszSign);
|
||
private:
|
||
//创建标注线
|
||
void ExplodeOrDraw2dLine(XExplodeDraw &dc) const;
|
||
//创建标注文字
|
||
void ExplodeOrDraw2dText(XExplodeDraw &dc) const;
|
||
//创建起点
|
||
void ExplodeOrDraw2dStart(XExplodeDraw &dc) const;
|
||
|
||
//电缆标注线
|
||
void ExplodeOrDraw2dLineForLay(XExplodeDraw &dc) const;
|
||
//电缆标注文字
|
||
void ExplodeOrDraw2dTextForLay(XExplodeDraw &dc) const;
|
||
//设置标注的文字内容
|
||
void InitLableContent(int nRunTime);
|
||
//得到文字长度
|
||
double GetTextLen(LPCTSTR lpText) const;
|
||
//得到文字内容
|
||
void GetTextString(const AcDbObjectId &id,CString &sText,int nIndex = 0) const;
|
||
//得到需要标注的字符串
|
||
void GetLableStrArray(LPCTSTR lpStr,CStringArray &arValues) const;
|
||
//得到桥架文字内容
|
||
void GetCableTrayString(const AcDbObjectId &id,CString &sText) const;
|
||
//得到电缆文字内容
|
||
void GetCableLayString(const AcDbObjectId &id,CString &sText,int nIndex) const;
|
||
//得到最长的文字长度
|
||
double GetMaxTextLen();
|
||
double GetMaxTextLen(const AcDbObjectIdArray& arIds);
|
||
//写入引线扩展数据
|
||
void WriteDownLeadData();
|
||
//读取引线扩展数据
|
||
void ReadDownLeadData();
|
||
//读取是否标注穿管的扩展数据
|
||
void ReadIsDimPipeFlow();
|
||
//读取是否多电缆敷设标注的扩展数据
|
||
void ReadIsMulitCableLayDim();
|
||
//读取绑定的桥架ID
|
||
void ReadReactorID(AcDbObjectIdArray& arIds) const;
|
||
//读取扩展数据
|
||
BOOL ReadXData(const AcDbObjectId& id,LPCTSTR pszAppName,CStringArray& arXData) const;
|
||
BOOL ReadXData(AcDbEntity* pEnt,LPCTSTR pszAppName,CStringArray& arXData) const;
|
||
//根据高度计算重新计算列
|
||
void CalcGripPntForLay(double dH);
|
||
//获取控制行列夹点
|
||
AcGePoint3d GetSizePt() const;
|
||
//获取电缆标注的总高度
|
||
double GetDimHeight();
|
||
|
||
//add liaoy 2016-1-25只为查找替换使用
|
||
//得到查找的text
|
||
BOOL GetText( Adesk::UInt32 cookies,TDbText &text) const;
|
||
//得到桥架标注所有字符串的字符串的位置,参照ExplodeOrDraw2dText
|
||
void GetTextAndPt(AcArray<SCableDimTextInfo>& arTextInfo) const;
|
||
//得到电缆标注所有字符串的字符串的位置,参照ExplodeOrDraw2dTextForLay
|
||
void GetTextAndPtForLay(AcArray<SCableDimTextInfo>& arTextInfo) const;
|
||
//设置桥架标注
|
||
BOOL SetText(const AcArray<SCableDimTextInfo>& arTextInfo);
|
||
//设置桥架标注字符串,执行GetCableTrayString()的逆过程
|
||
BOOL SetCableTrayString(const AcDbObjectId &id,const CString &sText,const int& nIndex);
|
||
//只被SetCableTrayString,由sClapDataOld和格式化后的sClapDataNew得到实际的sClapDataGet和dHGet
|
||
void GetClapDataStr(const CString& sClapDataOld,const CString& sClapDataNew,CString& sClapDataGet,double& dHGet,double& dBGet);
|
||
//得到s中double值,该double值的小数点位数以nValidBit为准
|
||
double HoldValidBit(const Adesk::UInt16& nValidBit,const CString& s);
|
||
//得到sSrc基于0的位于nStartPos和nEndPos之间的字符串(包括nStartPos和nEndPos)
|
||
//若nEndPos >= sSrc.GetLength(),则返回nStartPos到sSrc末尾的字符串
|
||
CString GetMidStr(const CString& sSrc,const int& nStartPos,const int& nEndPos);
|
||
//调用ads_prompt,提示修改
|
||
BOOL MakeSureModify();
|
||
//得到桥架标注的规格
|
||
//CString GetCableTrayStringSpecs(AcArray<double> arB,AcArray<double> arH,int nClap,int nRunTime,CString sClapData,CString sClapData2,TDbFittingBase* pFit) const;
|
||
//得到桥架标注的系统分类关键字
|
||
CString GetCableTrayStringSysType(CString sSys) const;
|
||
//add end
|
||
|
||
private:
|
||
|
||
enum CableLableStyle
|
||
{
|
||
eLableStyle1 = 0,
|
||
eLableStyle2 = 1,
|
||
eLableStyle3 = 2,
|
||
};
|
||
|
||
enum CableType
|
||
{
|
||
eCableTray = 0,
|
||
eCableLay = 1,
|
||
};
|
||
|
||
AcGePoint3d m_ptS; //起点坐标
|
||
AcGePoint3d m_ptTurn; //拐点位置
|
||
AcGeVector3d m_vtDir; //标注的方向
|
||
double m_dLineBaseLen; //线最初长度
|
||
double m_dTextRowDis; //文字间行间距系数
|
||
CString m_sLableContent; //标注的文字
|
||
CString m_sLableFds; //桥架标注间隔符
|
||
CString m_sLableType; //电缆标注类型
|
||
//mod liaoy 170621 这几个并没有保存到实体或者文档中,不采用成员变量的方法
|
||
//CString m_sSysKeyForce; //系统分类关键字 强电 lsd 2013-8-26
|
||
//CString m_sSysKeyFire; //消防 lsd
|
||
//CString m_sSysKeyWeak; //弱电 lsd
|
||
//CString m_sSysKeyOther; //其他 lsd
|
||
//mod End
|
||
|
||
Adesk::UInt16 m_nColorLine; //标注线颜色
|
||
Adesk::UInt16 m_nColorText; //文字颜色
|
||
|
||
Adesk::UInt16 m_nLableStyle; //标注样式
|
||
Adesk::UInt16 m_nStartStyle; //标注的起点样式
|
||
Adesk::UInt16 m_nDimEntType; //标注的实体类型
|
||
|
||
AcArray<AcDbSoftPointerId> m_arIds; //
|
||
//AcArray<AcDbObjectId> m_arIds;
|
||
|
||
AcGePoint3dArray m_arPtLead; //引线点 通过扩展数据存储
|
||
BOOL m_bPipeFlow; //是否标注穿管 通过扩展数据存储
|
||
BOOL m_bIsMulitCableLayDim;
|
||
|
||
// 文字参数
|
||
AcDbHardPointerId m_idTextStyle; //文字样式
|
||
double m_nTextHeight;
|
||
|
||
// TArch6 member
|
||
double m_nTextRotation; //旋转角度,目前只有标高用到
|
||
AcDbHardPointerId m_idTextLayer;
|
||
|
||
// VERSION_TDBEEQUIPMENT == 3新增
|
||
Adesk::UInt16 m_nValidBit;
|
||
Adesk::UInt16 m_nSpare;
|
||
double m_dSpare;
|
||
CString m_sSpare;
|
||
|
||
// VERSION_TDBEEQUIPMENT == 5新增
|
||
AcGeDoubleArray m_arRowWidth; //行宽 用于多列显示电缆标注
|
||
// CString m_sCabHeight; //电缆高度
|
||
CString m_sSign; //电缆分类标示(表头)
|
||
|
||
int m_nCurDwgVer; // 当前图纸版本 (此变量解决8.5桥架标注在9.0打开崩溃问题)2013/2/8 add by wzh
|
||
};
|
||
|
||
//主要统一 设备统计、桥架统计、桥架标注时根据桥架实体或者构件实体来获取或设置一些参数的方法
|
||
class DLLIMPEXP TCableTrayFittingTool
|
||
{
|
||
public:
|
||
TCableTrayFittingTool(AcDbEntity* pEnt);
|
||
CString GetRunTimeName();//运行时名称,如桥架,弯通,三通,四通,变径,乙字弯等
|
||
CString GetName();//名称,如槽式直通桥架,槽式水平等径弯通,槽式水平异径四通等
|
||
CString GetType();//类型,如C-01-10-4,C-03A,C-04A,C-20M等
|
||
//获取规格,400X150,500X100 - 200X100,(100+200)X200 - 300*200等
|
||
CString GetSpec(const CString& sSpecChar = _T("X"),const CString& sLink = _T("+"));
|
||
//根据新规格重新设置宽高或隔板数据,与sSpecNew与GetSpec()相比只能是一个或者多个数字大小有差异
|
||
BOOL SetSpec(const CString& sSpecNew,const CString& sSpecChar = _T("X"),const CString& sLink = _T("+"));
|
||
CString GetUnit();//单位,如件,米等
|
||
//sKeyClap取KEY_CLAPBOARD_DATA或KEY_CLAPBOARD_DATA2,获取或设置宽度通道
|
||
void GetClapWidtdAisle(std::vector<std::pair<CString,CString>>& vecWidtdAisle,const CString& sKeyClap);
|
||
BOOL SetClapWidtdAisle(const CStringArray& arWidth,const CString& sKeyClap);
|
||
BOOL SetClapWidtdAisle(const std::vector<std::pair<CString,CString>>& vecWidtdAisle,const CString& sKeyClap);
|
||
//
|
||
static void StringSplit(const CString& sVal,const CString& sGap,CStringArray& arSplit,BOOL bIncludeEmptyString = TRUE);
|
||
static CString StringJoin(const CStringArray& arValue,const CString& strGap,BOOL bLastAddGap = TRUE);
|
||
private:
|
||
TDbInterfacesObj* m_pEnt;//实体或者构件实体
|
||
};
|
||
#endif // !defined(AFX_TDBCABLEDIM_H__6F154165_E1B5_474C_A0BD_1C9BD02874B8__INCLUDED_)
|