Files
envi-code/SourceCode/Code2026/tg_shs/inc/pipewire/DbGouge.h
T

165 lines
7.2 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
#ifndef AFX_DBGOUGE_H__
2026-09-28 15:28:50 +08:00
#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
{
2026-10-04 00:04:20 +08:00
eGNull = 0, // 空
eGCover = 1, // 盖板
eGLSide = 2, // 靠左边
eGRSide = 3, // 靠右边
eGOrder = 4, // 两边对齐
eGInter = 5 // 两边交错
2026-09-28 15:28:50 +08:00
};
2026-10-04 00:04:20 +08:00
//宽度
2026-09-28 15:28:50 +08:00
void SetGougeWidth(double dWidth);
2026-10-04 00:04:20 +08:00
//电缆沟沟深
2026-09-28 15:28:50 +08:00
void SetGougeHeight(double dHeight);
2026-10-04 00:04:20 +08:00
//电缆沟线宽
2026-09-28 15:28:50 +08:00
void SetGougeLineWidth(double dLineW);
2026-10-04 00:04:20 +08:00
//电缆沟支架形式
2026-09-28 15:28:50 +08:00
void SetGougeMode(Adesk::UInt16 nType);
2026-10-04 00:04:20 +08:00
//支架长度
2026-09-28 15:28:50 +08:00
void SetBracketLen(double dLen);
2026-10-04 00:04:20 +08:00
//支架间距
2026-09-28 15:28:50 +08:00
void SetBracketDis(double dDis);
2026-10-04 00:04:20 +08:00
//支架线宽
2026-09-28 15:28:50 +08:00
void SetBracketLineWidth(double dLineW);
2026-10-04 00:04:20 +08:00
//拐角类别
2026-09-28 15:28:50 +08:00
void SetCornerType(Adesk::UInt16 nType);
2026-10-04 00:04:20 +08:00
//倒角半径
2026-09-28 15:28:50 +08:00
void SetCornerRadius(double dRadius);
2026-10-04 00:04:20 +08:00
//电缆编号
2026-09-28 15:28:50 +08:00
void SetTrenchNo(LPCTSTR lpNo);
2026-10-04 00:04:20 +08:00
//宽度
2026-09-28 15:28:50 +08:00
double GetGougeWidth();
2026-10-04 00:04:20 +08:00
//电缆沟沟深
2026-09-28 15:28:50 +08:00
double GetGougeHeight();
2026-10-04 00:04:20 +08:00
//电缆沟线宽
2026-09-28 15:28:50 +08:00
double GetGougeLineWidth();
2026-10-04 00:04:20 +08:00
//电缆沟支架形式
2026-09-28 15:28:50 +08:00
Adesk::UInt16 GetGougeMode();
2026-10-04 00:04:20 +08:00
//支架长度
2026-09-28 15:28:50 +08:00
double GetBracketLen();
2026-10-04 00:04:20 +08:00
//支架间距
2026-09-28 15:28:50 +08:00
double GetBracketDis();
2026-10-04 00:04:20 +08:00
//支架线宽
2026-09-28 15:28:50 +08:00
double GetBracketLineWidth();
2026-10-04 00:04:20 +08:00
//拐角类别
2026-09-28 15:28:50 +08:00
Adesk::UInt16 GetCornerType();
2026-10-04 00:04:20 +08:00
//倒角半径
2026-09-28 15:28:50 +08:00
double GetCornerRadius() const;
2026-10-04 00:04:20 +08:00
//得到电缆编号
2026-09-28 15:28:50 +08:00
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;
2026-10-04 00:04:20 +08:00
// 自动增加节点到当前数据库,ids-该节点自动连接的管线,派生类应当重载
2026-09-28 15:28:50 +08:00
virtual AcDbObjectId AddAutoNodeToDb(const XPoint &ptAt, const DList<AcDbObjectId> &ids) const;
virtual int GetFirstVersion()const{return 8;}
2026-10-04 00:04:20 +08:00
// 绘制电缆沟支架
2026-09-28 15:28:50 +08:00
2026-10-04 00:04:20 +08:00
// add by 2011.02.21 剖切功能 注意 GetSection内不应将std::vector<TObjSectionRecord>参数清空
2026-09-28 15:28:50 +08:00
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d &vtPlaneSecDir,
std::vector<TObjSectionRecord> &sectionRecord, AcDbVoidPtrArray& arFillPtrs) const;
2026-10-04 00:04:20 +08:00
// 剖切用,返回Z坐标最高、最低点
2026-09-28 15:28:50 +08:00
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;
//////////////////////////////////////////////////////////////////////////
2026-10-04 00:04:20 +08:00
//add liaoy 170627 当拐角半径不同时显示效果不好的问题
//基于TDbPipeCanal::SortPipeCanal()
2026-09-28 15:28:50 +08:00
void SortPipeCanalTrench(const AcGePoint3d &ptOr,const AcDbObjectIdArray &arIds,AcArray<std::pair<AcDbObjectId,XCurveSegment>>& arPairSeg) const;
2026-10-04 00:04:20 +08:00
//基于TDbPipeCanal::GetCorner2InterPts()
2026-09-28 15:28:50 +08:00
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;
2026-10-04 00:04:20 +08:00
//基于TDbPipeCanal::GetInterPts()
2026-09-28 15:28:50 +08:00
void GetInterPtsTrench(const AcArray<std::pair<AcDbObjectId,XCurveSegment>> &arPairSeg,AcArray<AcGePoint3d> &arPts,AcArray<CornerLine> &map) const;
2026-10-04 00:04:20 +08:00
//基于TDbPipeCanal::GetCannalPts()
2026-09-28 15:28:50 +08:00
void GetCannalPtsTrench(const AcDbObjectId &id,AcGePoint3d &pt1,AcGePoint3d &pt2,AcArray<CornerLine> &map) const;
//add end
//////////////////////////////////////////////////////////////////////////
private:
2026-10-04 00:04:20 +08:00
// 绘制支架
2026-09-28 15:28:50 +08:00
Acad::ErrorStatus DrawBrackets(XExplodeDraw &dc,XCurveSegment& cenSeg) const;
2026-10-04 00:04:20 +08:00
// 单边
2026-09-28 15:28:50 +08:00
BOOL MakeCurvesOfCableGougeSide(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
2026-10-04 00:04:20 +08:00
// 对立
2026-09-28 15:28:50 +08:00
BOOL MakeCurvesOfCableGougeOrder(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
2026-10-04 00:04:20 +08:00
// 交错
2026-09-28 15:28:50 +08:00
BOOL MakeCurvesOfCableGougeInter(AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,XCurveSegment& cenSeg) const;
2026-10-04 00:04:20 +08:00
// 判断端口是否需要绘制连接线
2026-09-28 15:28:50 +08:00
BOOL IsHasMorePipes(const AcDbObjectId& idNode) const;
2026-10-04 00:04:20 +08:00
// 节点连接的管子个数
2026-09-28 15:28:50 +08:00
int GetNodeCntPipeNumber(const AcDbObjectId& idNode) const;
2026-10-04 00:04:20 +08:00
// 绘制支架
2026-09-28 15:28:50 +08:00
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;
2026-10-04 00:04:20 +08:00
// 绘制拐角处支架
2026-09-28 15:28:50 +08:00
void DrawBracketOfCorner(const AcGePoint3d& ptRef,AcArray<CornerLine>& mapPt,AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> >& arBracket,const AcDbObjectId& idNode) const;
2026-10-04 00:04:20 +08:00
// 得到指定连接点的拐角点组
2026-09-28 15:28:50 +08:00
BOOL GetCornerPtMap(const AcGePoint3d& ptRef,AcArray<CornerLine>& mapPt,CornerLine& temOut) const;
2026-10-04 00:04:20 +08:00
// 重新构建绘制支架的线
2026-09-28 15:28:50 +08:00
BOOL ReConstructBracketLine(AcGePoint3d& ptS,AcGePoint3d& ptE,const AcDbObjectId& idNode) const;
2026-10-04 00:04:20 +08:00
// 得到相连的另一条沟的宽度和倒角半径
2026-09-28 15:28:50 +08:00
void GetAnotherTrenchParam(const AcGeVector3d& vtHor,const AcDbObjectId& idNode,double& dWidth,double& dRadius) const;
2026-10-04 00:04:20 +08:00
// 获取垂足点
2026-09-28 15:28:50 +08:00
BOOL GetVerticalFootPoint(const AcGePoint3d& pickPoint,const AcGePoint3d& lastPoint,AcGePoint3d& ptVerFoot) const;
2026-10-04 00:04:20 +08:00
// 获取最近点
2026-09-28 15:28:50 +08:00
BOOL GetNearestPoint(const AcGePoint3d& pickPoint,AcGePoint3d& ptNear) const;
2026-10-04 00:04:20 +08:00
// 释放内存
2026-09-28 15:28:50 +08:00
void FreeBuffer(AcArray<AcDbLine*>& cplCurve) const;
private:
static const Adesk::UInt8 g_nVersion;
2026-10-04 00:04:20 +08:00
double m_dGougeLineW; //电缆沟线宽
Adesk::UInt16 m_nBracketMode; //支架形式
double m_dBracketLen; //支架长度
double m_dBracketDis; //支架间距
double m_dBracketLineW; //支架线宽
Adesk::UInt16 m_nCornerType; //拐角类别
XString m_sTrenchNo; //电缆沟编号
2026-09-28 15:28:50 +08:00
2026-10-04 00:04:20 +08:00
XString m_sSpare; // 备用
double m_dSpare; // 备用
Adesk::UInt16 m_nSpare; // 备用
2026-09-28 15:28:50 +08:00
};
#endif // !defined(AFX_DBGOUGE_H__61B791DA_199E_45EC_B50D_C6CC518EFCE0__INCLUDED_)