📄 shortestpathview.h
字号:
// ShortestPathView.h : interface of the CShortestPathView class
//
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INCLUDES()
#include "map.h"
//}}AFX_INCLUDES
#include "afxtempl.h"
#if !defined(AFX_SHORTESTPATHVIEW_H__D02044C6_25A6_4DBF_908E_73272F9D85B2__INCLUDED_)
#define AFX_SHORTESTPATHVIEW_H__D02044C6_25A6_4DBF_908E_73272F9D85B2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define NODENUM 129
class CShortestPathView : public CFormView
{
protected: // create from serialization only
CShortestPathView();
DECLARE_DYNCREATE(CShortestPathView)
public:
//{{AFX_DATA(CShortestPathView)
enum { IDD = IDD_SHORTESTPATH_FORM };
CMap1 m_map;
//}}AFX_DATA
// Attributes
public:
CShortestPathDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShortestPathView)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CShortestPathView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CShortestPathView)
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMouseDownMap1(short Button, short Shift, long X, long Y);
afx_msg void OnAfterLayerDrawMap1(short index, BOOL canceled, long hDC);
afx_msg void OnMapTool(UINT nID);
afx_msg void OnUpdateMapTool(CCmdUI* pCmdUI);
afx_msg void OnMapFullextent();
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
UINT m_curTool; //当前选中的工具ID
void MatrixInit(); //初始化 costMatrix 和 arcIdMatrix
void Dijkstra(); //最短路算法 根据startPointID,destinationPointID,costMatrix 和 arcIdMatrix 给shortestPathNodeId 赋值
//状态控制参数
int selectState; // 0: 初始状态 1:已选中起点 2:已找到或准备开始新一次的查询
//最短路算法必要参数
int startPointID; //起点ID
int destinationPointID; //终点ID
double costMatrix[NODENUM][NODENUM]; //costMatrix[i][j] 表示从i号节点到j号节点的权重(距离),值为时-1表示不可直接到达
int arcIdMatrix[NODENUM][NODENUM]; //arcIdMatrix[i][j] 表示以i,j号节点为两端点的弧段号,值为时-1表示没有此端点
//查询结果参数
CArray<int,int> shortestPathNodeId;//储存最后的查询结果:从起点到终点所经过的节点号,但没有包括终点的节点号
//显示参数
CMoPoint startPoint; //起点 为了便于显示
CMoPoint destinationPoint;//终点 为了便于显示
};
#ifndef _DEBUG // debug version in ShortestPathView.cpp
inline CShortestPathDoc* CShortestPathView::GetDocument()
{ return (CShortestPathDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SHORTESTPATHVIEW_H__D02044C6_25A6_4DBF_908E_73272F9D85B2__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -