-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathXmlParser.h
56 lines (51 loc) · 1.53 KB
/
XmlParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __XMLPARSER_H__
#define __XMLPARSER_H__
#include <string>
#include <cstdio>
#include <list>
#include <vector>
#include <tinyxml2.h>
#include "VextexNode.h"
class XmlParser
{
public:
XmlParser();
void ReadXml(const char *FilePath);
int FindBusRoute(std::string &start, std::string &end);
std::list<std::string>& GetMinRoute();
int GetMinDistant();
int GetMinRouteIndex();
bool AddRoute(std::string &newRoute);
bool IsTransitNode(std::string &node);
std::string GetRouteByTwoStopName(std::string &start, std::string &end);
void ShowList();
private:
//这些函数是一些辅助函数。
void clearRouteInfo();
void resetGp();
int GetGpIndexByStopName(std::string &name);
std::string GetStopNameByIndex(int num);
int FindBusRouteByIndex(int start, int end, int distance);
private:
tinyxml2::XMLDocument doc;
std::list<StopNode> AllStopNode;
GraphAdjList Gp;
/*
//每次查找路线完成后要将这几个变量进行清零
bool VisitGp[MAXVEX];
std::list<std::string> AllRouteMap[MAXMAP];
std::list<std::string> RouteMapTmp;
int RouteNum; //路线的数量
int MinDistant; //最小的距离
int IndexRoute; //最小距离路线的index
*/
//记录每次的线路的结点信息,在递归的时候
bool VisitGp[MAXVEX];
std::list<std::string> AllRouteMap[MAXMAP];
int RouteMapStop[MAXVEX];
int RouteMapStopIndex;
int RouteNum; //路线的数量
int MinDistant; //最小的距离
int IndexRoute; //最小距离路线的index
};
#endif