#pragma once #include "PipePrototype.h" // 管线类的最小实现 class CDbPipe : public CDbPipePrototype { public: ACRX_DECLARE_MEMBERS(CDbPipe); private: static const Adesk::UInt8 g_nVersion; bool m_bUpdateLinkedDim; // cet 2015.3.11 add 增加临时变量,用于在管径、前缀、外径、壁厚发生变化时更新关联的标注信息(不需保存在文件中) public: CDbPipe(); protected: Adesk::UInt16 m_nMaterial; // 材料类型 XString m_sLabel; // 管线标注左边内容、或者立管编号 double m_dRadius; // 管半径,外圆 double m_dDnDiameter; // 标注尺寸 double m_dPipeWeight; // 管线的显示宽度,非立管时 double m_dRadiusIn; // 小圆半径(1、大于零时同时绘制小圆 2、-1时实心 3、0时立管开口90度 -2, 是国标扣弯,-3, 绘制粗圆圈 4、其他时候仅绘制外圆 5、横管用此数据存坡度) double m_dSpare; // 备用 XString m_sSpare; // 备用 i=0.003 L=12.3m int m_iShortDimType;// 当默认标注长度大于管长时,采用此值设置的标注样式即短管标注 protected: double m_dSpeedSubMid, m_dSpeedLength;//写入数据库用于显示加速的参数 public: double m_dOldRadius; // 老的半径(Not Database Resident) public: CString GetLayer() const { TCHAR *pLayer = layer(); CString csLay; csLay = pLayer; delete[]pLayer; return csLay; } const TCHAR* GetLabel() const { return (const TCHAR*)m_sLabel; } void SetLabel(const TCHAR* sText) { assertWriteEnabled(); m_sLabel = sText; m_bUpdateLinkedDim = true; // cet 2015.3.11 add 更新关联标注 } const TCHAR* GetSpareStr() const { return (const TCHAR*)m_sSpare; } void SetSpareStr(const TCHAR* sText) { assertWriteEnabled(); m_sSpare = sText; } int GetMaterial() const { return (int)m_nMaterial; } void SetMaterial(int nMaterial) { assertWriteEnabled(); m_nMaterial = (Adesk::UInt16)nMaterial; } double GetRadius() const { return m_dRadius; } void SetRadius(double dRadius) { assertWriteEnabled(); m_dRadius = dRadius; } double GetRadiusIn() const { return m_dRadiusIn; } void SetRadiusIn(double dRadius) { assertWriteEnabled(); m_dRadiusIn = dRadius; } double GetPipeGradient() const {// 坡度 return m_dRadiusIn; } void SetPipeGradient(double dRadius) { assertWriteEnabled(); m_dRadiusIn = dRadius; } double GetSpare() const { //zxl 2012.12.27 modify //return m_dSpare; return GetOldDimType(); } void SetSpare(double dSpare) { assertWriteEnabled(); m_dSpare = dSpare; //GetNewDimType();//zxl 2012.12.27 add } double GetPipeWeight() const { return m_dPipeWeight; } // zxl 2012.12.13 add 增加坡度标注样式 void SetPipeGradientDimType(Adesk::UInt16 nType) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("TYPE_LABGRADIENT"), nType); } Adesk::UInt16 GetPipeGradientDimType() const { const EntityFields &fd = GetFields(); Adesk::UInt16 nGradientType = -1; fd.GFD(_T("TYPE_LABGRADIENT"), nGradientType); return nGradientType; } // zxl 2012.12.13 add 增加管长标注样式 void SetPipeLenDimType(Adesk::UInt16 nType) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("TYPE_LABLEN"), nType); } Adesk::UInt16 GetPipeLenDimType() const { const EntityFields &fd = GetFields(); Adesk::UInt16 nLenType = -1; fd.GFD(_T("TYPE_LABLEN"), nLenType); return nLenType; } // zxl 2012.12.13 add 增加管径标注样式 void SetPipeDnDimType(Adesk::UInt16 nType) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("TYPE_LABDN"), nType); } Adesk::UInt16 GetPipeDnDimType() const { const EntityFields &fd = GetFields(); Adesk::UInt16 nDnType = -1; bool bRet = fd.GFD(_T("TYPE_LABDN"), nDnType); return nDnType; } // zxl 2012.12.13 add 增加分隔符号标注样式 void SetPipeDimLableType(Adesk::UInt16 nType) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("TYPE_LAB"), nType); } Adesk::UInt16 GetPipeDimLableType() const { const EntityFields &fd = GetFields(); Adesk::UInt16 nLabType = -1; bool bRet = fd.GFD(_T("TYPE_LAB"), nLabType); return nLabType; } // zxl 2012.12.13 add 增加横排竖排标注样式 void SetPipeLableDrawType(Adesk::UInt16 nType) { assertWriteEnabled(); EntityFields &fd = Fields(); bool bRet = fd.SFD(_T("TYPE_LABDRAW"), nType); } Adesk::UInt16 GetPipeLableDrawType() const { const EntityFields &fd = GetFields(); Adesk::UInt16 nDrawType = 0; bool bRet = fd.GFD(_T("TYPE_LABDRAW"), nDrawType); return nDrawType; } CString GetPipeLenDimStr() const; // 获取管线长度标注字符 zxl 2012.12.17 add CString GetPipeDnDimStr() const; // 获取管线管径标注字符 zxl 2012.12.17 add CString GetPipeGradienDimtStr() const; // 获取管线坡度标注字符 zxl 2012.12.17 add bool IsNewDimType() const; // 是否为新标注类型 zxl 2012.12.17 add void SetPipeWeight(double dWeight) { assertWriteEnabled(); m_dPipeWeight = dWeight; } BOOL IsVerOpened() const { return fabs(m_dRadiusIn) <= 1.0E-3; } double GetDnDiameter() const { return m_dDnDiameter; } void SetDnDiameter(double dDia) { assertWriteEnabled(); m_dDnDiameter = dDia; m_bUpdateLinkedDim = true; // cet 2015.3.11 add 更新关联标注 } //2009-12-28 sr 添加管道壁厚 double GetPipeThick() const { const EntityFields &fd = GetFields(); double dPipeThick = 0; fd.GFD(_T("PIPE_THICK"), dPipeThick); return dPipeThick; } void SetPipeThick(double dPipeThick) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("PIPE_THICK"), dPipeThick); m_bUpdateLinkedDim = true; // cet 2015.3.11 add 更新关联标注 } //2010-1-15 sr 添加管道保温层厚 double GetInsulateThick() const { const EntityFields &fd = GetFields(); double dInsulateThick = 0; fd.GFD(_T("INSULATE_THICK"), dInsulateThick); return dInsulateThick; } void SetInsulateThick(double dInsulateThick) { assertWriteEnabled(); EntityFields &fd = Fields(); fd.SFD(_T("INSULATE_THICK"), dInsulateThick); } // cet 2013.2.5 add 是否标注标高(注意:当标注管径时,才可标注标高) bool IsDimEle() const; // cet 2013.2.5 add 设置是否标注标高(注意:当标注管径时,才可标注标高) void SetDimEle(bool bDim); //注(管线文字和管径标注是两种不同的标注) // cet 2014.5.29 add 与管线关联的管径标注(TDbPipeLabel,TDbPiPeText)有关操作 void SetLinkedPipeDnDimText(const CString &sDimText); // 设置关联管径标注文字 CString GetLinkedPipeDnDimText();// 关联管径标注文字 bool IsLinkedPipeDnDimText(); // 是否存在关联管径标注文字 // cet 2014.6.3 add 与管线关联的管线文字(TDbPiPeText)有关操作 bool IsLinkedPipeText(); // 是否存在关联管线文字 CString GetLinkedPipeText(); // 关联管线文字 void SetLinkedPipeText(const CString &sPipeText); // cet 2015.3.6 add // 管线标注中的管径是什么类型管径 // 0 标准管径 1 外径 int DimDnType() const; void SetDimDnType(int nDnType); // cet 2015.3.6 add 外径(更新管径时需要同时更新标准管径 外径 壁厚数据) double OuterDn() const; void SetOuterDn(double dDn); // cet 2015.8.20 add 新版中绘制的管线保存管道系统名以此判断管道系统类型 virtual CString GetPipeSystemName() const; // cet 2018.2.1 add 标注文字颜色 void SetTextColor(Adesk::UInt16 color); Adesk::UInt16 GetTextColor() const; public:// Override TDbPipePrototype // 派生类可以加入其他的判断条件(如管径等) virtual BOOL CanMergeWith(const CDbPipePrototype &other, int *iPosThis = NULL, int *iPosOther = NULL) const; // 自动增加节点到当前数据库,ids-该节点自动连接的管线,派生类应当重载 virtual AcDbObjectId AddAutoNodeToDb(const XPoint &ptAt, const DList &ids) const; virtual XExtent GetExtent() const; virtual XExtent GetOldExtent() const; virtual int GetExtend(XPoint &low, XPoint &up) const; virtual void ApplyDnDiameterChangeToLabel(); virtual double GetBreakWidth() const; virtual void ResetDrawSpeed();//重新设置显示加速数据 virtual void ResetDrawSpeed(CDbPipeNode *pNode);//重新设置显示加速数据 cet 2018.7.4 add public: // 考虑遮挡的当前曲线,二维 void GetHideCurve(XCurveSegment& cvHide) const; // 通过管件附件打断的曲线,二维 // void GetBrokenCurves(const XCurveSegment &cv,DList &lstRes) const; void GetBrokenCurves(AcGiDraw &dc, const XCurveSegment &cv, DList &lstRes) const; // 立管遮挡管线的长度 double GetVerPipeHideLength(const CDbPipeNode* pNode) const; XString GetLabelText() const; virtual ads_real GetPlanLength() const; public: // Override TDbEntity virtual void CopyPropertiesFrom(AcDbEntity *pSrc, unsigned gMatchFlag); //virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const; virtual Acad::ErrorStatus Draw2d(AcGiDraw &dc) const; virtual Acad::ErrorStatus Draw3d(AcGiDraw &dc) const; virtual void GetTips(DList &info) const; //取动态属性显示数据 virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const; virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds) const; virtual Acad::ErrorStatus subGetGripPoints(AcDbGripDataPtrArray& grips, const double curViewUnitSize, const int gripSize, const AcGeVector3d& curViewDir, const int bitflags) const; virtual ads_real Length() const; // virtual long GetSubTextNum()const{return 1;}//ok // virtual void SetSubText(long i,CString sText); virtual int GetFirstVersion()const { return 6; } virtual SubText* HitTestText(XPoint pt)const { return NULL; }; // 2008-2-27 sr add 支持裁剪 virtual bool IsModelEntity() const { // if(IsModel()) // 2009.7.21 sr 关闭裁剪,速度很慢 // return false; // else // return true; // change by hh 2011-09-29 支持水管与风管之间的裁剪 仅限暖通 // 暖通标准版id = 6;除尘版id = 5 return true; } virtual bool IsClipMe(const AecXDbEntityBaseEx* pEnt = NULL)const;//ok是否被裁剪 virtual bool IsMeClip()const; virtual Acad::ErrorStatus subClose(); public: // Override AcDbEntity Acad::ErrorStatus subGetOsnapPoints(AcDb::OsnapMode osnapMode, INT_PTR gsSelectionMark, const AcGePoint3d& ptPick, const AcGePoint3d& lastPoint, const AcGeMatrix3d& viewXform, AcGePoint3dArray& snapPoints, AcDbIntArray& geomIds) const; virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler*); virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const; virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler*); virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const; virtual Acad::ErrorStatus subOpen(AcDb::OpenMode mode); virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset); // virtual Acad::ErrorStatus getGeomExtents(AcDbExtents& extents) const; // cet 2010.12.30 add virtual Acad::ErrorStatus GetExtents(ADSGePoint3d &ptLow, ADSGePoint3d &ptUp) const; // cet 2011.1.20 add protected: Acad::ErrorStatus DrawVerPipe2d(AcGiDraw &dc) const; Acad::ErrorStatus DrawHorPipe2d(AcGiDraw &dc, BOOL bIsWeight) const; Acad::ErrorStatus DrawLabelText(AcGiDraw &dc) const; protected: virtual void DisposeBreak(const XCurveSegment &cv, AcGePoint3dArray &arPoint, const XPoint &ptLoc, double dWidth, double dDistance, const AcGeVector3d &vtDir, DList &lstBreakCurve) const; private: void GetDimPipeLen(CString &sDimPipeLen, int iType, const CString& sLen) const; // cet 2011.5.20 add Acad::ErrorStatus Draw3dArcPipe(AcGiDraw &dc) const; // cet 2011.5.23 add BOOL GetVerOpenedType(XVector3D &vtDir, int &nOpenType) const;// zxl 2012.10.24 add // zxl 2012.12.13 add CString GetNewPipeDimStr() const; // 获取管线标注字符 zxl 2012.12.17 add double GetOldDimType() const; // 用新标注类型 获取老式标注类型 zxl 2012.12.25 add // cet 2014.5.30 add 当管线管径或标注符号, 壁厚变化时,可以根据需要 // 调用此函数更新与管线关联的的标注显示信息 void UpdateLinkedPipeDnDimText(); };