Files
envi-code/SourceCode/Code2026/tg_shs/inc/subgeo/TGraphNode.h
T

82 lines
1.9 KiB
C++
Raw Normal View History

2026-10-04 00:04:20 +08:00
//-----------------------------------------------------------------------------+
2026-09-28 15:28:50 +08:00
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
// = FileName : TGraphNode.h
// = Version : ver2.0
// = Author : xlc
// = CreateDate : 2002-09-09
2026-10-04 00:04:20 +08:00
// = Description: 类的声明
2026-09-28 15:28:50 +08:00
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#ifndef _TGRAPHNODE_H_
#define _TGRAPHNODE_H_
#ifndef _TWFLAG_H_
#include "TWFlag.h"
#endif
#ifndef _TTABLE_H_
#include "TTable.h"
#endif
#ifndef _TGRAPHARC_H_
#include "TGraphArc.h"
#endif
#ifndef _TPDLIST_H_
#include "TPDList.h"
#endif
2026-10-04 00:04:20 +08:00
//图节点
2026-09-28 15:28:50 +08:00
class GEOAPI TGraphNode:public TWFlag
{
public:
2026-10-04 00:04:20 +08:00
//删除时自动断开连接
2026-09-28 15:28:50 +08:00
virtual ~TGraphNode();
virtual int CmpNode(const TGraphNode&n) const;
//pArc->IsValid()!!!
bool AppendArc(TGraphArc*pArc);
bool RemoveArc(TGraphArc*pArc);
void ClearArc();
2026-10-04 00:04:20 +08:00
//断开连接
2026-09-28 15:28:50 +08:00
void UnConnect();
2026-10-04 00:04:20 +08:00
//最后pNode被ClearArc
2026-09-28 15:28:50 +08:00
void Conbine(TGraphNode*pNode);
//ARC
2026-10-04 00:04:20 +08:00
//是否孤点
2026-09-28 15:28:50 +08:00
bool IsAloneNode() const;
2026-10-04 00:04:20 +08:00
//是否端点(只有一条边)
2026-09-28 15:28:50 +08:00
bool IsEndNode() const;
long GetArcNum() const;
TGraphArc* GetArc(long i) const;
long FindArc(TGraphArc*pArc) const;
2026-10-04 00:04:20 +08:00
//如果只有一条边或未找到pArc返回NULL
2026-09-28 15:28:50 +08:00
TGraphArc* FindNextArc(TGraphArc*pArc);
2026-10-04 00:04:20 +08:00
//如果只有一条边或未找到pArc返回NULL
2026-09-28 15:28:50 +08:00
TGraphArc* FindPreArc(TGraphArc*pArc);
void GetArcOut(TTable<TGraphArc*> &lstArc);
void GetArcIn(TTable<TGraphArc*> &lstArc);
//Compare
bool operator==(const TGraphNode&n) const;
bool operator!=(const TGraphNode&n) const;
bool operator> (const TGraphNode&n) const;
bool operator< (const TGraphNode&n) const;
protected:
2026-10-04 00:04:20 +08:00
//此结点连接的所有边(实质是引用),始终保持有序
2026-09-28 15:28:50 +08:00
TPDList<TGraphArc> m_allArc;
2026-10-04 00:04:20 +08:00
//节点内排序时使用,其它情况为NULL
2026-09-28 15:28:50 +08:00
static TGraphNode* s_pStartNode;
};
#endif