-
Notifications
You must be signed in to change notification settings - Fork 2
/
airlinepath.h
54 lines (47 loc) · 1.33 KB
/
airlinepath.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
#ifndef AIRLINEPATH_H
#define AIRLINEPATH_H
#include <QtCore/QCoreApplication>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <QtXml>
#include <QDomDocument>
#include <stack>
#include <cfloat>
#include "vertex.h"
class airlinePath
{
public:
airlinePath();
~airlinePath();
void openXML(const QString &filename);
void run();
private:
QDomDocument finalXML;
QString filePath;
std::map<int, vertex*> table; // <airport ID, airport>
std::string beginCode, endCode; // IATA
int beginID, endID; // airport IDs
std::vector<int> path; // <airport IDs>
double distance; // initially in meters
float totalCost;
int err;
std::string errMsg[7];
// File and data structure handling
void readFromXML(QDomDocument &doc, const QString &filename);
void loadMap();
void clear();
// Input/Output
void getInput();
void getIATA();
bool doAgain();
void trimAndUpper(std::string &line);
bool validInput();
void display();
void displayError();
// Dijkstra's algorithm
void findInitialPath();
void findShortestPath();
};
#endif // AIRLINEPATH_H