-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapLoader.h
70 lines (51 loc) · 1.38 KB
/
MapLoader.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef MAPLOADER_H
#define MAPLOADER_H
#include "ArgManager.h"
/***************************************
* Node Structure
**************************************/
struct Node
{
friend std::istream& operator>>(std::istream&, Node&);
friend std::ostream& operator<<(std::ostream&, const Node&);
Node(): nodeID(0), cateID (0), longitude(0.0), latitude(0.0) { }
int nodeID;
int cateID;
double longitude;
double latitude;
};
/***************************************
* Map Structure
**************************************/
struct Edge
{
friend std::istream& operator>>(std::istream&, Edge&);
friend std::ostream& operator<<(std::ostream&, const Edge&);
Edge(): edgeID(0), startNodeID(0), endNodeID(0), length(0.0) { }
int edgeID;
int startNodeID;
int endNodeID;
double length;
};
/***************************************
* Class: DataLoader
**************************************/
typedef pair<int, double> node_dis;
typedef vector<node_dis> adj_node;
class DataLoader
{
public:
DataLoader() {};
static int numNodes;
static int numEdges;
static vector<Node> nodes;
static vector<Edge> edges;
static map<int, adj_node> adj_matrix;
void load();
void constructing();
protected:
private:
void readNodes();
void readEdges();
};
#endif // MAPLOADER_H