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

📄 dijkstra_taview.h

📁 数据结构的经典实验程序。以全国主要城市为图的顶点, 铁路连接为图的边, 距离作为加权, 设计完成一个最短路径自动查找系统;输入为出发城市和目标城市, 输出为最短路径和距离。
💻 H
字号:
// Dijkstra_TAView.h : interface of the CDijkstra_TAView class
//
/////////////////////////////////////////////////////////////////////////////

#include "citymap.h"
#if !defined(AFX_DIJKSTRA_TAVIEW_H__BE945A9F_B9C6_4E22_8CF0_1029497E8585__INCLUDED_)
#define AFX_DIJKSTRA_TAVIEW_H__BE945A9F_B9C6_4E22_8CF0_1029497E8585__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////	
	/*0	北京
	1	哈尔滨
	2	呼和浩特
	3	乌鲁木齐
	4	上海
	5	郑州
	6	长沙
	7	广州
	8	福州
	9	南京
	10	西安
	11	兰州
///	12	重庆*/
//////////////////////////////////////
//#define beijing 


class CDijkstra_TAView : public CView
{
protected: // create from serialization only
	CDijkstra_TAView();
	DECLARE_DYNCREATE(CDijkstra_TAView)

// Attributes
public:
	CDijkstra_TADoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDijkstra_TAView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	int m_travel[15];
	void DrawCityName(CClientDC *pdc);
//	int m_kay[15][15];
//	int m_road[15][15];
	bool isshowmap;
//	void OnShow();
	virtual ~CDijkstra_TAView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDijkstra_TAView)
	afx_msg void OnMenuShowmap();
	afx_msg void OnMenuDijkstra();
	afx_msg void OnMenuShowrtrain();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	// 显示最短路径的控制变量
	bool isshowtravel;
public:
	// //显示最短路径函数
	void Showtravel(CClientDC * pdc);
public:
	// //主要城市地图
	CCitymap m_citymap;
public:
	void DrawCityRoad(CClientDC* pdc);
	bool isshowtrainroad;
	CString ChangeIndexToName(int index);
	CString m_cityname;
	int m_goalcityindex;
	int m_startcityindex;
	int ChangeNameToIndex(CString cityname);
	// 显示城市的位置,采用重新描绘的方式
	void DrawCityPosition(CClientDC* pdc);
};

#ifndef _DEBUG  // debug version in Dijkstra_TAView.cpp
inline CDijkstra_TADoc* CDijkstra_TAView::GetDocument()
   { return (CDijkstra_TADoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_DIJKSTRA_TAVIEW_H__BE945A9F_B9C6_4E22_8CF0_1029497E8585__INCLUDED_)

⌨️ 快捷键说明

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