230 lines
7.1 KiB
C++
230 lines
7.1 KiB
C++
// 钢筋对象
|
|
#ifdef TASD
|
|
#ifndef _TDBSTRUREINBAR_H_
|
|
#define _TDBSTRUREINBAR_H_
|
|
|
|
#ifndef _TDBSTRUENTITYBASE_H_
|
|
#include "TDbStruEntityBase.h"
|
|
#endif
|
|
|
|
// TStruHookInfo
|
|
struct TARCH_EXP TStruHookInfo
|
|
{
|
|
enum EType
|
|
{
|
|
kNone = 0, // 无钩
|
|
kStraight, // 直钩
|
|
kBent, // 弯钩
|
|
kOblique // 斜钩
|
|
};
|
|
TStruHookInfo(){}
|
|
TStruHookInfo(AcGePoint3d pos, EType type, int quadant)
|
|
{
|
|
ptPos = pos;
|
|
eType = type;
|
|
nQuadrant = quadant;
|
|
}
|
|
AcGePoint3d ptPos; // 位置
|
|
EType eType; // 无钩,直钩,弯钩,斜钩
|
|
int nQuadrant; // 象限位置
|
|
};
|
|
|
|
// TDbStruReinBar
|
|
class TARCH_EXP TDbStruReinBar : public TDbStruEntityBase
|
|
{
|
|
public:
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(TDbStruReinBar);
|
|
|
|
enum EType
|
|
{
|
|
kNormal = 0,
|
|
kDot
|
|
};
|
|
|
|
public:
|
|
TDbStruReinBar();
|
|
virtual ~TDbStruReinBar();
|
|
|
|
// Overriden function from AcDbEntity
|
|
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
|
|
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
|
|
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
|
|
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
|
|
|
|
// Overriden function from TEntityBase
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(TGGiExplodeDrawBase &dc) const;
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(TGGiExplodeDrawBase &dc) const;
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
|
virtual Acad::ErrorStatus subGetGripPoints(
|
|
AcGePoint3dArray& gripPoints,
|
|
AcDbIntArray& osnapModes,
|
|
AcDbIntArray& geomIds) const;
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(
|
|
const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset);
|
|
virtual Acad::ErrorStatus subGetStretchPoints(AcGePoint3dArray& stretchPoints) const;
|
|
virtual Acad::ErrorStatus subMoveStretchPointsAt(
|
|
const AcDbIntArray& indices,
|
|
const AcGeVector3d& offset);
|
|
|
|
virtual AcDbCurve* GetBaseCurve()const;//临时对象,外部析构//ok
|
|
virtual Acad::ErrorStatus SetBaseCurve(AcDbCurve*pCurve); //用于trim/extent时修改对象
|
|
|
|
// 夹点提示
|
|
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
|
|
|
virtual Acad::ErrorStatus subGetOsnapPoints(
|
|
AcDb::OsnapMode osnapMode,
|
|
INT_PTR gsSelectionMark,
|
|
const AcGePoint3d& pickPoint,
|
|
const AcGePoint3d& lastPoint,
|
|
const AcGeMatrix3d& viewXform,
|
|
AcGePoint3dArray& snapPoints,
|
|
AcDbIntArray& geomIds) const;
|
|
virtual Acad::ErrorStatus subGetTransformedCopy(
|
|
const AcGeMatrix3d& xform,
|
|
AcDbEntity*& pEnt) const;
|
|
virtual Acad::ErrorStatus copyFrom(const AcRxObject* pSrc);
|
|
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
|
|
virtual Acad::ErrorStatus subWblockClone(
|
|
AcRxObject* pOwner,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const;
|
|
virtual Acad::ErrorStatus subDeepClone(AcDbObject* pOwner,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const;
|
|
|
|
// 获得二维包围盒
|
|
virtual Acad::ErrorStatus GetExtents2d(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
// 获得三维包围盒
|
|
virtual Acad::ErrorStatus GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
//取动态属性显示数据
|
|
virtual void GetTips(TDPtrList<TObjInfoUnit>& lstInfo) const;
|
|
|
|
virtual const TCHAR *GetDefaultLayer() const;
|
|
|
|
virtual BOOL IsValid() const;
|
|
|
|
// 支持夹点ctrl功能切换
|
|
virtual int GetCtrlToggleIndex()const;
|
|
|
|
// 属性匹配
|
|
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
|
// 获得标准三维面
|
|
virtual bool GetStandardFaceBody(AcDbVoidPtrArray& arFacePtrs) const;
|
|
// 获得安全保护区
|
|
virtual bool GetSafeProtectedSpace(AcDbVoidPtrArray& arFacePtrs) const;
|
|
// 获得剖面
|
|
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d& vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecords,
|
|
AcDbVoidPtrArray& arFillPtrs) const;
|
|
// 获得XML
|
|
virtual CString GetXml(const AcGeMatrix3d& mat) const;
|
|
virtual int GetFirstVersion()const;
|
|
virtual bool IsModelEntity() const;
|
|
|
|
virtual BOOL SetAt(LPCTSTR pszKey, const TStruHookInfo& hook);
|
|
virtual BOOL GetAt(LPCTSTR pszKey, TStruHookInfo& hook) const;
|
|
virtual BOOL SetAt(LPCTSTR pszKey, const CArray<TStruHookInfo, TStruHookInfo&>& hooks);
|
|
virtual BOOL GetAt(LPCTSTR pszKey, CArray<TStruHookInfo, TStruHookInfo&>& hooks) const;
|
|
|
|
// 设置/获取线宽
|
|
void SetWidth(double dWidth);
|
|
double GetWidth() const;
|
|
|
|
// 设置钢筋路径
|
|
BOOL SetOutline(const TGGePoly2D& outline);
|
|
TGGePoly2D GetOutline();
|
|
|
|
// 设置起始/终止钩子
|
|
BOOL SetStartHook(TStruHookInfo::EType eType = TStruHookInfo::kStraight,
|
|
int nQuadrant = 1);
|
|
BOOL SetEndHook(TStruHookInfo::EType eType = TStruHookInfo::kStraight,
|
|
int nQuadrant = 2);
|
|
BOOL SetStartHook(TStruHookInfo hook);
|
|
BOOL SetEndHook(TStruHookInfo hook);
|
|
|
|
BOOL GetStartHook(TStruHookInfo& hookS);
|
|
BOOL GetEndHook(TStruHookInfo& hookE);
|
|
|
|
double GetLenS() const;
|
|
void SetLenS(double dVal);
|
|
double GetLenO() const;
|
|
void SetLenO(double dVal);
|
|
double GetLenB() const;
|
|
void SetLenB(double dVal);
|
|
double GetDiaB() const;
|
|
void SetDiaB(double dVal);
|
|
|
|
// 点钢筋,设置点钢筋的位置
|
|
BOOL SetDotPos(AcGePoint3d ptPos);
|
|
|
|
// 添加一个中间钩子
|
|
BOOL AddMidHook(const TStruHookInfo& hook);
|
|
|
|
// 判断是否是起始或终止端钩子
|
|
BOOL IsStartOrEndHook(AcGePoint3d ptPos) const;
|
|
BOOL IsStartHook(AcGePoint3d ptPos) const;
|
|
BOOL IsEndHook(AcGePoint3d ptPos) const;
|
|
|
|
// 获取钩子的轮廓线
|
|
BOOL GetHookOutLine(const TStruHookInfo& hook, AcDbPolyline& plOutline) const;
|
|
// 获取夹点位置
|
|
AcGePoint3d GetGripPoint(const TStruHookInfo& hook) const;
|
|
// 获取用于确定象限的局部坐标系x轴
|
|
void GetAxisX(const TStruHookInfo& hook, AcGeVector3d& vtAxis1, AcGeVector3d& vtAxis2) const;
|
|
// 获取路径点处的切线
|
|
void GetAxisX(int nIndex, AcGeVector3d& vtAxis1, AcGeVector3d& vtAxis2) const;
|
|
// 颠倒钢筋路径点的顺序
|
|
void ReverseOutline();
|
|
// 清除所有中间钩子
|
|
void ClearAllMidHook();
|
|
|
|
public:
|
|
struct SHook
|
|
{
|
|
TStruHookInfo hook;
|
|
BOOL bIsStartOrEnd; // >0 起始端钩子, <0 终止端, ==0 中间钩子
|
|
int nIndex; // 中间钩子的索引
|
|
};
|
|
void GetStraightOutline(
|
|
const TStruHookInfo& hook,
|
|
AcGeVector3d vtAxistX,
|
|
AcDbPolyline& plOutline) const;
|
|
void GetBentOutline(
|
|
const TStruHookInfo& hook,
|
|
AcGeVector3d vtAxistX,
|
|
AcDbPolyline& plOutline) const;
|
|
void GetObliqueOutline(
|
|
const TStruHookInfo& hook,
|
|
AcGeVector3d vtAxistX,
|
|
AcDbPolyline& plOutline) const;
|
|
TStruHookInfo GetHookFromGripPt(int index);
|
|
void UpdateHookFromGripPt(int index, TStruHookInfo hook);
|
|
void GetHooksOrderByGrip(CArray<SHook, SHook&>& arHooks);
|
|
int GetNewQuadrant(TStruHookInfo hook, AcGePoint3d ptMoved,
|
|
AcGeVector3d vtAxis1, AcGeVector3d vtAxis2);
|
|
int GetNewQuadrant(TStruHookInfo hook, AcGePoint3d ptMoved, AcGeVector3d vtAxis);
|
|
// 获取指定线段上的钩子个数
|
|
int GetNumsOfHooksAt(int nIndex);
|
|
// 重新设置起点和终点的钩子位置,使其始终和路径的起点和终点保持一致
|
|
void ReCalcPointHook();
|
|
|
|
private:
|
|
TGGePoly2D m_polyOutline; // 钢筋路径
|
|
double m_dWidth; // 线宽
|
|
double m_dLengthS; // 直钩平直长度
|
|
double m_dLengthO; // 斜钩平直长度
|
|
double m_dLengthB; // 弯钩平直长度
|
|
double m_dDiaB; // 弯钩直径
|
|
|
|
static const Adesk::UInt8 g_nVersion;
|
|
};
|
|
|
|
#endif // _TDBSTRUREINBAR_H_
|
|
#endif |