63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGraphArc.h
|
|
// = Version : ver2.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: 类的声明 图边
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#ifndef _TGRAPHARC_H_
|
|
#define _TGRAPHARC_H_
|
|
|
|
#ifndef _TWFLAG_H_
|
|
#include "TWFlag.h"
|
|
#endif
|
|
|
|
class TGraphNode;
|
|
class TGraphPath;
|
|
|
|
class GEOAPI TGraphArc : public TWFlag
|
|
{
|
|
public:
|
|
TGraphArc(TGraphNode* pNode0=NULL,TGraphNode*pNode1=NULL);
|
|
|
|
//删除时自动断开连接
|
|
virtual ~TGraphArc();
|
|
virtual int CmpArc(const TGraphArc&a) const;
|
|
|
|
//子类派生函数返回0时,要保证节点相同!(注意:对于无向边节点无序!)
|
|
bool operator==(const TGraphArc&a) const;
|
|
bool operator!=(const TGraphArc&a) const;
|
|
bool operator> (const TGraphArc&a) const;
|
|
bool operator< (const TGraphArc&a) const;
|
|
|
|
//TNode
|
|
//支持端点相同情况(封闭Arc)
|
|
TGraphNode* GetNode(long i);
|
|
|
|
//取另一个节点(如果封闭边可能返回原节点)
|
|
TGraphNode* GetOtherNode(TGraphNode* pNode) const;
|
|
|
|
//限制使用
|
|
void SetNode(long i,TGraphNode*pNode);
|
|
bool IsValid() const;
|
|
bool IsClosed() const;
|
|
|
|
//Connect
|
|
//在两端结点中记录此连接边,建立真正连接
|
|
void Connect();
|
|
|
|
//断开连接
|
|
void UnConnect();
|
|
|
|
//Path
|
|
//type=0从起点出发,type=1从终点出发
|
|
TGraphPath * FindMesh(int type=0);
|
|
|
|
protected:
|
|
TGraphNode *m_pNode0,*m_pNode1;//两端点(对于有向边分别代表起点、终点)
|
|
};
|
|
|
|
#endif |