Files
envi-code/SourceCode/Code2026/tg_shs/inc/TArch/wallgraph.h
T

93 lines
2.6 KiB
C++
Raw Normal View History

2026-09-28 15:28:50 +08:00
#ifndef WALL_GRAPH_H
#define WALL_GRAPH_H
class TWallEdge;
class TWallGraph;
extern TARCH_IMPEXP double g_nDistPrec;
class TUTIL_IMPEXP TWallNode:public XPoint,public WFlag
{
friend class TWallEdge;
friend class TWallGraph;
protected:
DualList<TWallEdge*> m_allEdge;
public:
TWallNode(XPoint pt):XPoint(pt){}
void AppendEdge(TWallEdge*p){m_allEdge<<p;}//ok
void SetPoint(XPoint pt){XPoint::operator =(pt);}//ok
void Move(Quene<TWallNode*> &lstNodeEnd);
bool operator ==(const TWallNode&n)const{return Distance2d(n)<_AS_SYS_UNIT(g_nDistPrec);}//ok
bool operator >(const TWallNode&pt)const
{
double dx=x-pt.x;
if(dx>_AS_SYS_UNIT(g_nDistPrec))
return true;
else if(dx<-_AS_SYS_UNIT(g_nDistPrec))
return false;
else
{
double dy=y-pt.y;
return dy>_AS_SYS_UNIT(g_nDistPrec);
}
}
void Draw(int count)
{
TDbText *pText=new TDbText;
XString s(_T("^C%d^C"),count);
pText->SetText(s);
pText->SetLocation(XPoint(x,y));
pText->setColorIndex(3);
pText->SetHeight(5);
pText->SetStyleId(InitTextStyle(TS_AXIS));
pText->SetAlignment(XExplodeDraw::kMiddleCenter);
pText->AddToMSpace(Adesk::kTrue);
}
void GetMidNode(TWallNode*pOtherNode,Table<TWallNode*>&lstNode,Table<TWallEdge*> &lstEdge1,Table<TWallEdge*> &lstEdge2);
bool GetSegOther(XCurveSegment seg1,XCurveSegment &seg2,bool bFirst=true);
bool operator <(const TWallNode&pt)const{return pt>(*this);}//ok
};
class TUTIL_IMPEXP TWallEdge:public WFlag
{
friend class TWallNode;
friend class TWallGraph;
protected:
TWallNode *m_pNode0,*m_pNode1;//Æðµã£¬ÖÕµã
AcDbObjectId m_idWall;//ǽ
double m_fBulge;//°üÂç½Ç
public:
TWallEdge(AcDbObjectId idWall,TWallNode*pNode0,TWallNode*pNode1,double ang);
AcDbObjectId GetWallId()const{return m_idWall;}//ok
XCurveSegment GetCurve()const
{
TDbWall *pWall=NULL;
acdbOpenObject(pWall,m_idWall,AcDb::kForRead);
if(pWall!=NULL)
{
XCurveSegment cv=*pWall;
pWall->close();
cv.SetLineFlag(LS_INFINITE);
return cv;
}
else
return XCurveSegment(*m_pNode0,*m_pNode1,m_fBulge,LS_INFINITE);
}//ok
bool operator ==(const TWallEdge&e)const{return m_idWall==e.GetWallId();}//ok
bool operator >(const TWallEdge&e)const{return m_idWall>e.m_idWall;}//ok
bool operator <(const TWallEdge&e)const{return m_idWall<e.m_idWall;}//ok
};
class TUTIL_IMPEXP TWallGraph
{
public:
PDList<TWallNode> m_allNode;
PDList<TWallEdge> m_allEdge;
public:
TWallGraph(AcDbObjectId idWall);
TWallNode* FindOrAddNode(XPoint pt);
bool AppendWall(AcDbObjectId idWall);
void MoveNode(AcDbObjectId idWall,XPoint ptNewBase);
void ConbineNode(TWallNode* pNode0,TWallNode* pNode1);
};
#endif