Files
envi-code/SourceCode/Code2026/tg_shs/inc/pipewire/DbGouge.h
T
2026-09-28 15:28:50 +08:00

166 lines
6.9 KiB
C++

#ifndef AFX_DBGOUGE_H__
#define AFX_DBGOUGE_H__
#if _MSC_VER > 1000
#pragma once
#endif
#include "DbPipeCanal.h"
#define MINDIST 500
class PS_EXP TDbCableTrench : public TDbPipeCanal
{
DECLARE_TENTBASE();
ACRX_DECLARE_MEMBERS(TDbCableTrench);
public:
TDbCableTrench();
~TDbCableTrench();
enum GougeStyle
{
eGNull = 0, // 空
eGCover = 1, // 盖板
eGLSide = 2, // 靠左边
eGRSide = 3, // 靠右边
eGOrder = 4, // 两边对齐
eGInter = 5 // 两边交错
};
//宽度
void SetGougeWidth(double dWidth);
//电缆沟沟深
void SetGougeHeight(double dHeight);
//电缆沟线宽
void SetGougeLineWidth(double dLineW);
//电缆沟支架形式
void SetGougeMode(Adesk::UInt16 nType);
//支架长度
void SetBracketLen(double dLen);
//支架间距
void SetBracketDis(double dDis);
//支架线宽
void SetBracketLineWidth(double dLineW);
//拐角类别
void SetCornerType(Adesk::UInt16 nType);
//倒角半径
void SetCornerRadius(double dRadius);
//电缆编号
void SetTrenchNo(LPCTSTR lpNo);
//宽度
double GetGougeWidth();
//电缆沟沟深
double GetGougeHeight();
//电缆沟线宽
double GetGougeLineWidth();
//电缆沟支架形式
Adesk::UInt16 GetGougeMode();
//支架长度
double GetBracketLen();
//支架间距
double GetBracketDis();
//支架线宽
double GetBracketLineWidth();
//拐角类别
Adesk::UInt16 GetCornerType();
//倒角半径
double GetCornerRadius() const;
//得到电缆编号
void GetTrenchNo(CString &sNo);
virtual CString GetXml(const AcGeMatrix3d& mat) const;
public: // Override TDbEntity
Acad::ErrorStatus subGetOsnapPoints(AcDb::OsnapMode osnapMode, INT_PTR gsSelectionMark, const AcGePoint3d& ptPick, const AcGePoint3d& lastPoint, const AcGeMatrix3d& viewXform, AcGePoint3dArray& snapPoints, AcDbIntArray& geomIds) const;
virtual void CopyPropertiesFrom(AcDbEntity *pSrc, unsigned gMatchFlag);
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
virtual Acad::ErrorStatus ExplodeOrDraw3d(XExplodeDraw &dc) const;
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
virtual BOOL CanMergeWith(const TDbPipePrototype &other, int *iPosThis=NULL,
int *iPosOther=NULL) const;
// 自动增加节点到当前数据库,ids-该节点自动连接的管线,派生类应当重载
virtual AcDbObjectId AddAutoNodeToDb(const XPoint &ptAt, const DList<AcDbObjectId> &ids) const;
virtual int GetFirstVersion()const{return 8;}
// 绘制电缆沟支架
// add by 2011.02.21 剖切功能 注意 GetSection内不应将std::vector<TObjSectionRecord>参数清空
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
std::vector<TObjSectionRecord> &sectionRecord, AcDbVoidPtrArray& arFillPtrs) const;
// 剖切用,返回Z坐标最高、最低点
virtual Acad::ErrorStatus GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
virtual int GetBodyBox(AcDbExtents& ext);
protected:
void ExplodeOrDrawPipeCanal(XExplodeDraw &dc) const;
void ExplodeOrDrawCanalType1(XExplodeDraw &dc) const;
void ExplodeOrDrawCanalType2(XExplodeDraw &dc) const;
//////////////////////////////////////////////////////////////////////////
//add liaoy 170627 当拐角半径不同时显示效果不好的问题
//基于TDbPipeCanal::SortPipeCanal()
void SortPipeCanalTrench(const AcGePoint3d &ptOr,const AcDbObjectIdArray &arIds,AcArray<std::pair<AcDbObjectId,XCurveSegment>>& arPairSeg) const;
//基于TDbPipeCanal::GetCorner2InterPts()
void GetCorner2InterPtsTrench(const std::pair<AcDbObjectId,XCurveSegment> &seg1,const const std::pair<AcDbObjectId,XCurveSegment> &seg2,const AcGePoint3d &pt,int nSegCount,AcGePoint3dArray &arPts,AcArray<CornerLine> &map) const;
void GetCorner2InterPtsTrench(const XCurveSegment &seg1,const XCurveSegment &seg2,const AcGePoint3d &pt,int nSegCount,double dSpare,AcGePoint3dArray &arPts,AcArray<CornerLine> &map) const;
//基于TDbPipeCanal::GetInterPts()
void GetInterPtsTrench(const AcArray<std::pair<AcDbObjectId,XCurveSegment>> &arPairSeg,AcArray<AcGePoint3d> &arPts,AcArray<CornerLine> &map) const;
//基于TDbPipeCanal::GetCannalPts()
void GetCannalPtsTrench(const AcDbObjectId &id,AcGePoint3d &pt1,AcGePoint3d &pt2,AcArray<CornerLine> &map) const;
//add end
//////////////////////////////////////////////////////////////////////////
private:
// 绘制支架
Acad::ErrorStatus DrawBrackets(XExplodeDraw &dc,XCurveSegment& cenSeg) const;
// 单边
BOOL MakeCurvesOfCableGougeSide(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
// 对立
BOOL MakeCurvesOfCableGougeOrder(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
// 交错
BOOL MakeCurvesOfCableGougeInter(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
// 判断端口是否需要绘制连接线
BOOL IsHasMorePipes(const AcDbObjectId& idNode) const;
// 节点连接的管子个数
int GetNodeCntPipeNumber(const AcDbObjectId& idNode) const;
// 绘制支架
void DrawBracketsFun(const AcGeVector3d& vtHor,const AcGeVector3d& vtVer,const AcGePoint3d& ptStart,const AcGePoint3d& ptEnd,AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket) const;
void DrawBracketsFun(const AcGeVector3d& vtHor,const AcGeVector3d& vtVer,const AcGePoint3d& ptStart,double dLen,AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket) const;
// 绘制拐角处支架
void DrawBracketOfCorner(const AcGePoint3d& ptRef,AcArray<CornerLine>& mapPt,AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,const AcDbObjectId& idNode) const;
// 得到指定连接点的拐角点组
BOOL GetCornerPtMap(const AcGePoint3d& ptRef,AcArray<CornerLine>& mapPt,CornerLine& temOut) const;
// 重新构建绘制支架的线
BOOL ReConstructBracketLine(AcGePoint3d& ptS,AcGePoint3d& ptE,const AcDbObjectId& idNode) const;
// 得到相连的另一条沟的宽度和倒角半径
void GetAnotherTrenchParam(const AcGeVector3d& vtHor,const AcDbObjectId& idNode,double& dWidth,double& dRadius) const;
// 获取垂足点
BOOL GetVerticalFootPoint(const AcGePoint3d& pickPoint,const AcGePoint3d& lastPoint,AcGePoint3d& ptVerFoot) const;
// 获取最近点
BOOL GetNearestPoint(const AcGePoint3d& pickPoint,AcGePoint3d& ptNear) const;
// 释放内存
void FreeBuffer(AcArray<AcDbLine*>& cplCurve) const;
private:
static const Adesk::UInt8 g_nVersion;
double m_dGougeLineW; //电缆沟线宽
Adesk::UInt16 m_nBracketMode; //支架形式
double m_dBracketLen; //支架长度
double m_dBracketDis; //支架间距
double m_dBracketLineW; //支架线宽
Adesk::UInt16 m_nCornerType; //拐角类别
XString m_sTrenchNo; //电缆沟编号
XString m_sSpare; // 备用
double m_dSpare; // 备用
Adesk::UInt16 m_nSpare; // 备用
};
#endif // !defined(AFX_DBGOUGE_H__61B791DA_199E_45EC_B50D_C6CC518EFCE0__INCLUDED_)