⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mstscr.h

📁 运筹学最小支撑树的求解方法。该程序共有两种计算方法
💻 H
字号:
#if !defined(AFX_MSTSCR_H__71E2C2A1_0312_11D7_B24E_00606E0046CA__INCLUDED_)
#define AFX_MSTSCR_H__71E2C2A1_0312_11D7_B24E_00606E0046CA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MSTScr.h : header file
//
#include <afxtempl.h>
#include <afxcoll.h>

/////////////////////////////////////////////////////////////////////////////
// CMSTScr window
#define MAXVALUE 0x7FFFFFFF

class CMSTProDlg;

typedef struct _border
{
	_border(){	isTree=FALSE; }
	int index;	//从当前顶点出发的边的另一个顶点的索引号。
	int value;	//边的权重。
	BOOL isTree; 
}border;

class CStruct_C
{
public:
	CStruct_C()
	{
		MinPot = MAXVALUE; 
		Shortest = -1; 
		UniteSort= TRUE;
	}
	void SetMin(){ 
		MinPot = MAXVALUE; 
		UniteSort = TRUE;
	}
	int FindPot(int pot);
	void AddShortest(CPtrArray & ptrArray);
	BOOL UniteSet(CStruct_C & val);
	BOOL UniteSet1(CStruct_C & val);

	CArray <int,int> PotArray;
	CArray <int,int> BorderArray;
	int MinPot;
	int Shortest;
	BOOL UniteSort;
};

class CPointCouple
{
public:
	CPointCouple(int point1, int point2, int val)
	{
		indexpoint1=point1;
		indexpoint2=point2;
		value=val;
		isTree=FALSE;
	};
	BOOL operator == (CPointCouple val)
	{
		if( ( val.indexpoint1 == indexpoint1 && val.indexpoint2 == indexpoint2 ) ||
			( val.indexpoint1 == indexpoint2 && val.indexpoint2 == indexpoint1 ) )
		{
			if( value == val.value )
				return TRUE;
			else return FALSE;
		}
		else return FALSE;
	};
	int Compare(CPointCouple val)
	{
		if( ( val.indexpoint1 == indexpoint1 && val.indexpoint2 == indexpoint2 ) ||
			( val.indexpoint1 == indexpoint2 && val.indexpoint2 == indexpoint1 ) )
		return value;
		else return -1;
	};
	int indexpoint1;
	int indexpoint2;
	int value;
	BOOL isTree;
};

typedef struct _structPot
{
	CPoint point;	//当前顶点的位置。
	int tag;		//当前顶点的索引号。
	BOOL G_R;		//当前顶点的图形显示类型。
	CArray<border,border> neighborhood;	//当前顶点的相邻点。
} structPot;

typedef struct _Pot
{
	_Pot(int ind, int val)
	{
		index=ind;
		NearDistance=val;
	};
	int index;
	int NearDistance;
}Pot;

class CMSTScr : public CStatic
{
// Construction
public:
	CMSTScr();
	CPtrArray PointArray;
	CMSTProDlg * ptr_View;
// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMSTScr)
	//}}AFX_VIRTUAL

// Implementation
public:
	void WorkMST1();
	void WorkMST2();
	void WorkStep1();
	void WorkStep2();
	BOOL ReDraw;
	void ClearPanel();
	void UndoTree();
	int  ComparePointCouple(CPtrArray &,CPointCouple &,int &);
	void DrawGrid(CDC *pDC);
	void SetParent(CMSTProDlg * );
	void DrawGraph(CDC *pDC);
	virtual ~CMSTScr();

	CDC	MemDC_Pot;
	CDC	MemDC_PotRed;
	BOOL FirstChoose;
	int First_Index;
	int DirectionOrNot;
	// Generated message map functions
protected:
	//{{AFX_MSG(CMSTScr)
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MSTSCR_H__71E2C2A1_0312_11D7_B24E_00606E0046CA__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -