Files
envi-code/SourceCode/Code2026/tg_shs/inc/subgeo/TGraphNode.h
T
2026-09-28 15:28:50 +08:00

82 lines
1.8 KiB
C++

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