237 lines
10 KiB
C++
237 lines
10 KiB
C++
// TDbPipeCanal.h: interface for the TDbPipeCanal class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_TDBPIPECANAL_H__0CDE5701_7334_420A_AA7E_19F92E280C73__INCLUDED_)
|
|
#define AFX_TDBPIPECANAL_H__0CDE5701_7334_420A_AA7E_19F92E280C73__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
/*============================================================================*
|
|
* Copyright(c), 1994-2007, Beijing Tangent Engineering Software Co.Ltd.
|
|
* 作 者: 沈睿
|
|
* 创建时间: 2009-2-26
|
|
* 描 述: 方沟
|
|
* 归属项目: 给排水
|
|
* 历史记录:
|
|
=============================================================================*/
|
|
|
|
#include "DbPipe.h"
|
|
#include "map"
|
|
|
|
#define Canal_Corner1 0
|
|
#define Canal_Corner2 1
|
|
#define Canal_Corner3 2
|
|
#define Canal_Corner4 3
|
|
#define Canal_Corner5 4
|
|
|
|
class TDbPipeFitting;
|
|
class PS_EXP TDbPipeCanal : public TDbPipe
|
|
{
|
|
friend class TDbCanalFitting;
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(TDbPipeCanal);
|
|
private:
|
|
static const Adesk::UInt8 g_nVersion;
|
|
public:
|
|
TDbPipeCanal();
|
|
virtual ~TDbPipeCanal();
|
|
protected:
|
|
double m_nWidth; // 方沟宽度
|
|
double m_nHeight; // 方沟高度 或者 电缆沟沟深
|
|
double m_nSpare; // 倒角半径
|
|
double m_dRate;
|
|
Adesk::UInt16 m_nCanalType; //倒角类型
|
|
Adesk::UInt16 m_nEntType; //多个实体可以使用
|
|
XString m_sSpare;
|
|
AcDbHardPointerId m_idDoteLayer;
|
|
|
|
public:
|
|
|
|
double GetWidth() const {
|
|
return m_nWidth;
|
|
}
|
|
void SetWidth(double nWidth) {
|
|
assertWriteEnabled();
|
|
m_nWidth = nWidth;
|
|
// m_nSpare = nWidth;
|
|
}
|
|
double GetHeight() const {
|
|
return m_nHeight;
|
|
}
|
|
void SetHeight(double nHeight) {
|
|
assertWriteEnabled();
|
|
m_nHeight = nHeight;
|
|
// cet 2016.8.25 add 起始点方沟高度相同
|
|
SetStartHeight(nHeight);
|
|
SetEndHeight(nHeight);
|
|
}
|
|
double GetSpare() const {
|
|
return m_nSpare;
|
|
}
|
|
void SetSpare(double nSpare) {
|
|
assertWriteEnabled();
|
|
m_nSpare = nSpare;
|
|
}
|
|
void SetDoteLayer(const AcDbObjectId& id) {
|
|
assertWriteEnabled();
|
|
m_idDoteLayer=id;
|
|
}
|
|
void SetCanalType(Adesk::UInt16 nType){
|
|
assertWriteEnabled();
|
|
m_nCanalType = nType;
|
|
}
|
|
int GetCanalType(){
|
|
return m_nCanalType;
|
|
}
|
|
void SetEntType(Adesk::UInt16 nType){
|
|
assertWriteEnabled();
|
|
m_nEntType = nType;
|
|
}
|
|
int GetEntType(){
|
|
return m_nCanalType;
|
|
}
|
|
AcDbObjectId GetDoteLayer() const {
|
|
return m_idDoteLayer;
|
|
}
|
|
// cet 2016.8.15 add 盖板线宽
|
|
void SetCoverLineWidth(double dLineWidth);
|
|
double GetCoverLineWidth() const;
|
|
// cet 2016.8.15 add 是否为暗沟
|
|
void SetBlindDrain(bool bVal);
|
|
bool IsBlineDrain() const;
|
|
// cet 2016.8.15 add 盖板样式
|
|
void SetCoverType(int nType);
|
|
int GetCoverType() const;
|
|
// cet 2016.8.15 add 盖板横向间距
|
|
void SetCoverHorDist(double dDist);
|
|
double GetCoverHorDist() const;
|
|
// cet 2016.8.15 add 盖板纵向间距
|
|
void SetCoverVerDist(double dDist);
|
|
double GetCoverVerDist() const;
|
|
// cet 2016.8.25 add 起点方沟高度
|
|
double GetStartHeight() const;
|
|
void SetStartHeight(double dHeight);
|
|
// cet 2016.8.25 add 终点方沟高度
|
|
double GetEndHeight() const;
|
|
void SetEndHeight(double dHeight);
|
|
// cet 2016.9.5 add 方沟坡度
|
|
double GetGradient() const;
|
|
void SetGradient(double dGradient);
|
|
|
|
void GetBrokenCurves(const XCurveSegment &cv,DList<XCurveSegment> &lstRes) const;
|
|
|
|
public: // Override TDbEntity
|
|
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 void GetTips(DList<TObjInfoUnit> &info) const; //取动态属性显示数据
|
|
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
|
virtual int GetFirstVersion()const{return 8;}
|
|
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 subGetGripPoints(AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, 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 subTransformBy(const AcGeMatrix3d& xform);
|
|
virtual Acad::ErrorStatus subWblockClone(AcRxObject* pOwner,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const;
|
|
// 获取指定端坐标
|
|
XPoint GetVertexPt(const TPipeSys::PtLoction nSide) const;
|
|
// virtual Acad::ErrorStatus subClose();
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset);
|
|
|
|
public:// Override TDbPipePrototype
|
|
// 派生类可以加入其他的判断条件(如管径等)
|
|
// 自动增加节点到当前数据库,ids-该节点自动连接的管线,派生类应当重载
|
|
// virtual AcDbObjectId AddAutoNodeToDb(const XPoint &ptAt,const DList<AcDbObjectId> &ids) const;
|
|
virtual void ResetDrawSpeed();//重新设置显示加速数据
|
|
// 考虑遮挡的当前曲线,二维
|
|
void GetHideCurve(XCurveSegment& cvHide) const;
|
|
|
|
typedef struct CornerLine
|
|
{
|
|
std::pair<AcGePoint3d,AcGePoint3d> pair;
|
|
double dAng;
|
|
}CornerLine;
|
|
|
|
protected:
|
|
Acad::ErrorStatus MoveGSPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset,BOOL bGrip);
|
|
//绘制方沟
|
|
void ExplodeOrDrawPipeCanal(XExplodeDraw &dc) const;
|
|
void ExplodeOrDrawPipeCanalCenLine(XExplodeDraw &dc) const;
|
|
void ExplodeOrDrawCanalType1(XExplodeDraw &dc) const;
|
|
void ExplodeOrDrawCanalType2(XExplodeDraw &dc) const;
|
|
//对方沟按逆时针排序
|
|
void SortPipeCanal(const AcGePoint3d &ptOr,const AcDbObjectIdArray &arIds,AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> > &arSeg) const;
|
|
//求排序后方沟的交点
|
|
void GetInterPts(const AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> > &arSeg,AcArray<AcGePoint3d> &arPts,AcArray<CornerLine> &map) const;
|
|
void GetInterPts(const AcArray<XCurveSegment, AcArrayObjectCopyReallocator<XCurveSegment> > &arSeg,AcArray<AcGePoint3d> &arPts) const;
|
|
//调整方沟位置
|
|
void ChangePipeCanalPosition(const AcArray<AcGePoint3d> &arPts,const AcGePoint3d &ptCen,int nSegLen,AcGePoint3d &pt1,AcGePoint3d &pt2) const;
|
|
void ChangePipeCanalPositionNor(const AcArray<AcGePoint3d> &arPts,const AcGePoint3d &ptCen,int nSegLen,AcGePoint3d &pt1,AcGePoint3d &pt2) const;
|
|
//得到NODE方向方沟两点
|
|
void GetCannalPts(const AcDbObjectId &id,AcGePoint3d &pt1,AcGePoint3d &pt2,AcArray<CornerLine> &map) const;
|
|
void GetCannalPts(const AcDbObjectId &id,AcGePoint3d &pt1,AcGePoint3d &pt2) const;
|
|
//过滤掉无用的方沟
|
|
BOOL FilterCannal(AcDbObjectIdArray &arIds) const;
|
|
//得到类型2的交点
|
|
void GetCorner2InterPts(const XCurveSegment &seg1,const XCurveSegment &seg2,const AcGePoint3d &pt,int nSegCount,AcGePoint3dArray &arPts,AcArray<CornerLine> &map) const;
|
|
//设置方沟类型
|
|
void SetCannalSameType(const AcDbObjectIdArray &arIds) const;
|
|
//是否创建变径
|
|
BOOL MakesureCreateReducer(const AcDbObjectIdArray& arId,double& dTotal) const;
|
|
void ChangePipeCanalPosition(const AcDbObjectIdArray& arId,const AcDbObjectId& idNode,const AcGePoint3d& ptNodeLoc,double dLen,AcGePoint3d& pt1,AcGePoint3d& pt2,AcArray<CornerLine> &map) const;
|
|
//得到另一个管子的宽度
|
|
BOOL GetAnotherCanalWidth(const AcGePoint3d& pt1,const AcGePoint3d& pt2,const AcDbObjectIdArray& arId,double& dWidth) const;
|
|
//添加映射
|
|
void AppendMap(const AcGePoint3d& ptBase,const AcGePoint3d& pt1,const AcGePoint3d& pt2,AcArray<CornerLine> &map) const;
|
|
//用于move时得到自身id
|
|
AcDbObjectId GetSelfObjectId() const;
|
|
void GetOffsetMatrix(const AcDbObjectId& id, AcGeMatrix3d& matOffset) const;
|
|
Acad::ErrorStatus subSubWblockClone(const AcDbObjectId& idCloning,
|
|
AcRxObject* pOwner,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const;
|
|
virtual Acad::ErrorStatus subGetTransformedCopy(const AcGeMatrix3d& xform, // cet 2011.5.4 add 添加原因拖动实体时,动态预览有误
|
|
AcDbEntity*& pEnt) const;
|
|
|
|
private:
|
|
|
|
BOOL IsHasMorePipes(const AcDbObjectId& idNode) const; // cet 2011.6.27 add
|
|
|
|
int GetNodeCntPipeNumber(const AcDbObjectId& idNode) const; // cet 2011.6.27 add
|
|
|
|
BOOL GetVerticalFootPoint(const AcGePoint3d& pickPoint,const AcGePoint3d& lastPoint,AcGePoint3d& ptVerFoot) const; // cet 2011.6.27 add
|
|
|
|
BOOL GetNearestPoint(const AcGePoint3d& pickPoint,AcGePoint3d& ptNear) const; // cet 2011.6.27 add
|
|
|
|
void FreeBuffer(AcArray<AcDbLine*>& cplCurve) const; // cet 2011.6.27 add
|
|
// cet 2016.8.16 add 绘制盖板
|
|
void DrawCover(XExplodeDraw &dc, XCurveSegment &segUp, XCurveSegment &segDown) const;
|
|
// cet 2016.8.16 add 判断端点是否连接着实体
|
|
bool IsLinkedEntity(int nPos) const;
|
|
bool IsLinkedEntity(XPoint pt) const;
|
|
// cet 2016.8.18 add 端点是连接着方沟
|
|
int LinkedPipeCanalNum(int nPos) const;
|
|
// cet 2016.8.18 add 判断方沟端点只与一个方沟相连构成弯头连接时,在样式2、3中是否需要调整边线端点(与另一个方沟一条边的交点)位置
|
|
// 0 两条都需要调整 1 不需要调整左侧点 2 不需要调整右侧点
|
|
int NeedModifyInt(int nPos, const TDbPipeFitting *pFitting) const;
|
|
// cet 2016.8.25 add 绘制三维
|
|
void Draw3dType(XExplodeDraw &dc) const;
|
|
// cet 2016.8.25 add 求pt点在直线line上z轴方向的投影点(pt点在z轴方向所在直线必须与ling有交点)
|
|
XPoint ProjectAlongZAxis(XLine &line, const XPoint &pt) const;
|
|
// cet 2016.8.25 add 求pt点在弧线arc上z轴方向的投影点(pt点在z轴方向所在直线必须与arc有交点)
|
|
AcGePoint3d ProjectAlongZAxis(AcGeCircArc3d &cir, const XPoint &pt) const;
|
|
};
|
|
|
|
#endif // !defined(AFX_TDBPIPECANAL_H__0CDE5701_7334_420A_AA7E_19F92E280C73__INCLUDED_)
|