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

📄 xpathfinder.cpp

📁 一款改进了的查询系统----北京公交车查询系统
💻 CPP
字号:

#include "StdAfx.h"

#include "XPathfinder.h"

#include <vector>
#include <algorithm>
#include <functional>      // For greater<int>( )
using namespace std;

XPathFinder::XPathFinder ()
{
	lines = XMapCtrl::lines;
	lines.BuildStations(stations);
}

XPathFinder::~XPathFinder ()
{
}

vector<XPath> XPathFinder::Find(CString station1, CString station2, int type)
{
	vector<XPath> paths;

	XStation* pStation1 = stations.Find (station1);
	XStation* pStation2 = stations.Find (station2);

	if (pStation1 && pStation2)
	{
		//1, 找直达线路
		vector<CString> nonstopLines;
		set_intersection (pStation1->lines.begin(), pStation1->lines.end(),
			pStation2->lines.begin(), pStation2->lines.end(), nonstopLines.begin());

		if (nonstopLines.size () > 0 )
		{
		}
		else //2, 经过一个中转站
		{
			vector<CString> stations1, stations2, stations3;

			lines.Merge (pStation1->lines, stations1);
			lines.Merge (pStation2->lines, stations2);

			set_intersection (stations1.begin(), stations1.end(),
				stations2.begin(), stations2.end(), stations3.begin());


		}
	}

	return paths;
}

⌨️ 快捷键说明

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