279 lines
8.8 KiB
C++
279 lines
8.8 KiB
C++
#ifndef _TDBSECTIONPATH_H_
|
|
#define _TDBSECTIONPATH_H_
|
|
|
|
#include "TDbCurveEntity.h"
|
|
#include "SectionStructDef.h"
|
|
#include "TArchMatchProp.h"
|
|
#include "TGGiWorldViewportDraw.h"
|
|
#include "list"
|
|
#include <dbfiler.h>
|
|
|
|
#define LINE_WIDTH .5
|
|
#define WORD_HEIGHT 3.5
|
|
#define PT3DTOPT2D(pt) AcGePoint2d(pt.x, pt.y)
|
|
|
|
class GEOAPI TDbSectionPathSign : public TDbCurveEntity
|
|
{
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(TDbSectionPathSign);
|
|
|
|
public:
|
|
enum Style {kStyle1 = 0, kStyle2, kStyle3};
|
|
|
|
public:
|
|
|
|
TDbSectionPathSign(const AcGePoint3d &ptStart, const AcGePoint3d &ptEnd, const AcGeVector3d &vtDir,
|
|
const double &length, const CString sNum = _T("1"), const bool bShowSlid = true);
|
|
|
|
TDbSectionPathSign()
|
|
: m_ptStart(0., 0., 0.), m_ptEnd(0., 0., 0.),m_ptStartSide(0., 0., 0.),
|
|
m_ptEndSide(0., 0., 0.), m_bShowSide(true), m_vtDirection(0., 0., 0.),
|
|
m_sSectionNum(_T("1")), m_arIdsOnSection(0), m_dDirLength(0.),
|
|
m_SectionHeight(0., 0.), m_style(kStyle1){}
|
|
|
|
~TDbSectionPathSign(){};
|
|
|
|
public:
|
|
|
|
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;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
|
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray&gripPoints,AcDbIntArray&,AcDbIntArray&)const;
|
|
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset);
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, const AcGePlane &projPlane,
|
|
AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual void erased(const AcDbObject* dbObj, Adesk::Boolean pErasing = true);
|
|
|
|
virtual Acad::ErrorStatus subDeepClone(AcDbObject* pOwner,
|
|
AcDbObject*& pClonedObject,
|
|
AcDbIdMapping& idMap,
|
|
Adesk::Boolean isPrimary) const;
|
|
|
|
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
|
|
|
public:
|
|
|
|
AcGePoint3d GetStartPt() const {return m_ptStart;}
|
|
|
|
AcGePoint3d GetEndPt() const {return m_ptEnd;}
|
|
|
|
void SetStartPt(const AcGePoint3d &pt) {m_ptStart = pt;}
|
|
|
|
void SetEndPt(const AcGePoint3d &pt) {m_ptEnd = pt;}
|
|
|
|
void GetIdOnSection(std::vector<AcDbObjectId> &ar) const {ar.assign(m_arIdsOnSection.begin(), m_arIdsOnSection.end());}
|
|
|
|
void SetIdOnSection(TPickEntSet &ssSel);
|
|
|
|
void SetIdOnSection(const std::vector<AcDbObjectId> &ar){m_arIdsOnSection.assign(ar.begin(), ar.end());}
|
|
|
|
void SetDirLength(const double &len){m_dDirLength = len;}
|
|
|
|
double GetDirLength() const {return m_dDirLength;}
|
|
|
|
void UpdateSection(); // 重新得到参加剖面运算的实体ID
|
|
|
|
void SetStyle(Style style){m_style = style;}
|
|
|
|
Style GetStyle() const {return m_style;}
|
|
|
|
AcGePoint2d GetSectionHeight(){return m_SectionHeight;}
|
|
|
|
void CalcSectionHeight(); // 计算剖面真实高度
|
|
|
|
TGGeSectionPlane GetSectionPlane(); // 得到剖面
|
|
|
|
AcGeVector3d GetDirection() const {return m_vtDirection;} // 得到剖面方向
|
|
|
|
void SetDirection(const AcGeVector3d &vec){m_vtDirection = vec;}
|
|
|
|
void RegisterSection(const AcDbObjectId &id); // 注册 TDbSection 类
|
|
|
|
void UnRegisterSection(const AcDbObjectId &id); // 取消 注册
|
|
|
|
bool GetSectionInfo(SectionInfo &info, const bool bUpdate = false); // 得到 section path 的几何信息等元素,供TDbSection更新使用
|
|
// bUpdate 为真,则重新得到数据,否则将现有数据给出
|
|
|
|
void DrawSectionPathType(TGGiExplodeDrawBase &dc) const;
|
|
|
|
// 此函数,初始化投影区域的另两个点
|
|
// 两个点的置: 投影方向同侧,距投影面三倍"方向标识长度"的地方
|
|
/*
|
|
ptS _ _ pt1
|
|
| |
|
|
|
|
|
|
|
|
ptE |_ _| pt2
|
|
*/
|
|
void InitSectionSidePoints();
|
|
|
|
void SetShowSide(const bool bShow);
|
|
|
|
void SetSectionNum(const CString& sNum){m_sSectionNum = sNum;}
|
|
CString GetSectionNum(){return m_sSectionNum;}
|
|
|
|
private:
|
|
Style m_style; // 剖面标识的显示方式
|
|
|
|
AcGePoint3d m_ptStart, m_ptEnd; // 投影面的端点
|
|
|
|
AcGeVector3d m_vtDirection; // 投影面的方向
|
|
|
|
std::vector<AcDbObjectId> m_arIdsOnSection; // 参加剖面运算的实体集
|
|
|
|
double m_dDirLength; // 方向标识的长度
|
|
|
|
std::list<AcDbSoftPointerId> m_arRegisterIds; // 保存注册到这个类的 TDbSection类的ID,方便更新TDbSection的显示
|
|
|
|
AcGePoint3d m_ptStartSide, m_ptEndSide; // 在投影方向同侧,与投影面起点/终点一起 标识投影范围的点 由InitSectionSidePoints()函数初始化
|
|
|
|
bool m_bShowSide; // 是否显示投影区域的边界
|
|
|
|
AcGePoint2d m_SectionHeight;
|
|
|
|
CString m_sSectionNum; // 剖面的序号
|
|
};
|
|
|
|
class GEOAPI CCTestSectionPlane : public TDbCurveEntity
|
|
{
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(CCTestSectionPlane);
|
|
|
|
public:
|
|
CCTestSectionPlane(){};
|
|
CCTestSectionPlane(const AcGePoint3d &pt0, const AcGePoint3d &pt1, const AcGePoint3d &pt2, const AcGePoint3d &pt3)
|
|
: m_pt0(pt0), m_pt1(pt1), m_pt2(pt2), m_pt3(pt3){}
|
|
|
|
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;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
|
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray&gripPoints,AcDbIntArray&,AcDbIntArray&)const;
|
|
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset);
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, const AcGePlane &projPlane,
|
|
AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d& vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecords,
|
|
AcDbVoidPtrArray& arFillPtrs) const;
|
|
|
|
virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const;
|
|
|
|
virtual Acad::ErrorStatus GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
|
|
public:
|
|
AcGePoint3d Get(const int i);
|
|
private:
|
|
AcGePoint3d m_pt0, m_pt1, m_pt2, m_pt3;
|
|
};
|
|
|
|
class GEOAPI CCTestSectionLine : public TDbCurveEntity
|
|
{
|
|
DECLARE_TENTBASE();
|
|
ACRX_DECLARE_MEMBERS(CCTestSectionLine);
|
|
|
|
public:
|
|
CCTestSectionLine(){};
|
|
CCTestSectionLine(const AcGePoint3d &ptS, const AcGePoint3d &ptE)
|
|
: m_ptStart(ptS), m_ptEnd(ptE){}
|
|
|
|
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;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw3d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(TGGiExplodeDrawBase &dc) const;
|
|
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
|
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray&gripPoints,AcDbIntArray&,AcDbIntArray&)const;
|
|
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices, const AcGeVector3d& offset);
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity *ent, AcDb::Intersect intType, const AcGePlane &projPlane,
|
|
AcGePoint3dArray &points,
|
|
INT_PTR thisGsMarker = 0,
|
|
INT_PTR otherGsMarker = 0) const;
|
|
|
|
virtual bool GetSection(const AcDbFace &face, const AcGeVector3d& vtPlaneSecDir,
|
|
std::vector<TObjSectionRecord> §ionRecords,
|
|
AcDbVoidPtrArray& arFillPtrs) const;
|
|
|
|
virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const;
|
|
|
|
virtual Acad::ErrorStatus GetExtents(TADSGePoint3d &ptLow, TADSGePoint3d &ptUp) const;
|
|
|
|
public:
|
|
void SetStartPt(const AcGePoint3d &pt){m_ptStart = pt;}
|
|
void SetEndPt(const AcGePoint3d &pt){m_ptEnd = pt;}
|
|
AcGePoint3d GetStartPt() const {return m_ptStart;}
|
|
AcGePoint3d GetEndPt() const {return m_ptEnd;}
|
|
private:
|
|
AcGePoint3d m_ptStart, m_ptEnd;
|
|
};
|
|
|
|
class GEOAPI TSectionPathJig : public AcEdJig
|
|
{
|
|
public:
|
|
TSectionPathJig(TDbSectionPathSign * pPath);
|
|
bool start();
|
|
AcDbEntity* entity() const;
|
|
DragStatus sampler();
|
|
Adesk::Boolean update();
|
|
|
|
private:
|
|
TDbSectionPathSign *m_pPath;
|
|
AcGePoint3d m_ptS, m_ptE;
|
|
AcGeVector3d m_vDir;
|
|
double m_dLength;
|
|
};
|
|
|
|
#endif |