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

📄 keypathview.h

📁 利用Visual c++编程思想方法实现基于交通网络关键路径算法
💻 H
字号:
// KeyPathView.h : interface of the CKeyPathView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_KEYPATHVIEW_H__17D647EE_89FE_4329_A382_9363D05FBB78__INCLUDED_)
#define AFX_KEYPATHVIEW_H__17D647EE_89FE_4329_A382_9363D05FBB78__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PointDlg.h"
#include "EdgeDlg.h"
#include "ProjectNameDlg.h"
#include "ProjectSelDlg.h"
#include "EdgeDlg.h"

#define IDC_PROGRAM_LIST 5001
#define IDC_RESULT_LIST 5002
#define IDC_VAR_NUM_LIST 5003
#define IDC_DRAW_STC 5004

/************************************************************************/
/* 顶点信息类                                                           */
/************************************************************************/
class CPointInfo
{
public:
	CPointInfo()
	{
		xAxis = 0;
		yAxis = 0;
		id = -1;
		name =_T("");
		memo =_T("");
		radius = 15;
		color = RGB(0,0,0);
		isKey = 0;
	};
	
public:
	//显示X坐标
	int xAxis;
	//显示Y坐标
	int yAxis;
	//编号
	int id;
	//名称
	CString name;
	//备注信息
	CString memo;
	//显示半径
	int radius;
	//显示颜色
	COLORREF color;
	//是否为关键路径
	int isKey;
	//保存在纪录中的ID
	int pointID;
};

/************************************************************************/
/* 顶点信息类                                                           */
/************************************************************************/
class CEdgeInfo
{
public:
	CEdgeInfo()
	{
		prevPoint = NULL;
		nextPoint = NULL;
		duttem = 0;
		isKey = 0;
	};
	
public:
	//前一顶点
	CPointInfo * prevPoint;
	//后一顶点
	CPointInfo * nextPoint;
	//权值
	int duttem;
	//是否为关键路径
	int isKey;
};


typedef struct node
{
	int adjvex;
	int dut;
	struct node *next;
} edgenode;

typedef struct 
{
	int  trafficnetname;
	int  id;
	edgenode *link;
} vexnode;


class CKeyPathView : public CFormView
{
protected: // create from serialization only
	CKeyPathView();
	DECLARE_DYNCREATE(CKeyPathView)

public:
	//{{AFX_DATA(CKeyPathView)
	enum { IDD = IDD_KEYPATH_FORM };
	CStatic	m_keyPathStc;
	CListBox	m_varList;
	CListBox	m_resultList;
	CListBox	m_programList;
	//}}AFX_DATA

// Attributes
public:
	CKeyPathDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CKeyPathView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	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);
	virtual void OnDraw(CDC* pDC);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CKeyPathView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CKeyPathView)
	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnButtonAddLine();
	afx_msg void OnButtonAddPoint();
	afx_msg void OnButtonCalResult();
	afx_msg void OnButtonMovePoint();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnFileNew();
	afx_msg void OnFileOpen();
	afx_msg void OnFileSave();
	afx_msg void OnFileSaveAs();
	afx_msg void OnButtonSelCalResult();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()


private:
	int drawType; //绘图类型
	CDC *pDC; //屏幕绘图设备
	CDC memDC; //内存绘图设备

	vector<CPointInfo> pointVec;  //顶点列表
	vector<CEdgeInfo> edgeVec;  //边界列表

	vector<CPointInfo> selPointVec;  //顶点列表
	vector<CEdgeInfo> selEdgeVec;  //边界列表

	COLORREF pointColor; //顶点颜色
	COLORREF selPointColor; //顶点被选中颜色
	COLORREF keyPointColor; //关键顶点颜色
	COLORREF pathColor; //边界颜色
	COLORREF selPathColor; //边界被选中颜色
	COLORREF keyPathColor; //关键路径颜色

	//前一顶点
	CPointInfo * prevPoint;
	int prev;
	//后一顶点
	CPointInfo * nextPoint;
	int next;
	int curPath;

	BOOL movePic;

	int startCalPoint;

	int endCalPoint;

	//重新绘制图形
	void ReDrawAll();
	//获取被选择的顶点
	void GetSelPoint(int & num, CPoint point);
	int SearchKeyPath(vexnode* graphicmap,int citynumber,int activenumber,int& total);

	void GetJionPointCoor(int x1, int y1, int x2, int y2, int cx1, int cy1, int radio, int & jx, int & jy, int dt);
	void ShowProgram();
	void StepRun(int num);
	void StepSlowRun(int num);
	void CalKeyPath();
	BOOL step;
	int stepTime;
};

#ifndef _DEBUG  // debug version in KeyPathView.cpp
inline CKeyPathDoc* CKeyPathView::GetDocument()
   { return (CKeyPathDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_KEYPATHVIEW_H__17D647EE_89FE_4329_A382_9363D05FBB78__INCLUDED_)

⌨️ 快捷键说明

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