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

📄 functiondialog.cpp

📁 全国交通咨询系统源代码
💻 CPP
字号:
// FunctionDialog.cpp : implementation file
//

#include "stdafx.h"
#include "map.h"
#include "FunctionDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFunctionDialog dialog


CFunctionDialog::CFunctionDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CFunctionDialog::IDD, pParent)
{
	m_graph=NULL;
	//{{AFX_DATA_INIT(CFunctionDialog)
	m_cityone = _T("");
	m_citytow = _T("");
	//}}AFX_DATA_INIT
}


void CFunctionDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFunctionDialog)
	DDX_Text(pDX, IDC_CITYONE_EDIT, m_cityone);
	DDV_MaxChars(pDX, m_cityone, 15);
	DDX_Text(pDX, IDC_CITYTOW_EDIT, m_citytow);
	DDV_MaxChars(pDX, m_citytow, 15);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFunctionDialog, CDialog)
	//{{AFX_MSG_MAP(CFunctionDialog)
	ON_BN_CLICKED(IDC_RADIO, OnRadio)
	ON_BN_CLICKED(IDC_CARFEE, OnCarfee)
	ON_BN_CLICKED(IDC_CARCON, OnCarcon)
	ON_BN_CLICKED(IDC_PLAINCON, OnPlaincon)
	ON_BN_CLICKED(IDC_PLAINFEE, OnPlainfee)
	ON_BN_CLICKED(IDC_TRAINCON, OnTraincon)
	ON_BN_CLICKED(IDC_TRAINFEE, OnTrainfee)
	ON_BN_CLICKED(IDC_YES, OnYes)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFunctionDialog message handlers

void CFunctionDialog::OnOK() 
{
	// TODO: Add extra validation here
	NextDlgCtrl();	
}

void CFunctionDialog::OnRadio() 
{
	// TODO: Add your control notification handler code here
	m_kind=1;
}

void CFunctionDialog::OnCarfee() 
{
	// TODO: Add your control notification handler code here
	m_kind=2;
}

void CFunctionDialog::OnCarcon() 
{
	// TODO: Add your control notification handler code here
	m_kind=3;	
}

void CFunctionDialog::OnPlaincon() 
{
	// TODO: Add your control notification handler code here
	m_kind=6;	
}

void CFunctionDialog::OnPlainfee() 
{
	// TODO: Add your control notification handler code here
	m_kind=5;
}

void CFunctionDialog::OnTraincon() 
{
	// TODO: Add your control notification handler code here
	m_kind=9;	
}

void CFunctionDialog::OnTrainfee() 
{
	// TODO: Add your control notification handler code here
	m_kind=8;	
}

void CFunctionDialog::OnYes() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	int cityone=-1,citytow=-1;
	if(m_kind==-1) 
	{
		AfxMessageBox("你必须选择一项");
		return;
	}
	if(!m_graph->CityLocal(m_cityone,cityone)||!m_graph->CityLocal(m_citytow,citytow))
	{
		AfxMessageBox("你输入的第一个城市\n有误");
		return;
	}
	CString result;
	if(!m_graph->SeekShort(m_cityone,m_citytow,result,m_kind))
	{
		AfxMessageBox("城市间无通路!");
		EndDialog(IDCANCEL);
	}
	else
	{
		CResultDialog m_resultdialog;
		m_resultdialog.SetTopic(m_kind);
		m_resultdialog.SetText(result);
		m_resultdialog.DoModal();
	}
}

void CFunctionDialog::SetGraph(ALGraph * temp)
{
	m_graph=temp;
}

⌨️ 快捷键说明

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