-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.h
50 lines (43 loc) · 1.34 KB
/
Map.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
#pragma once
#include<iostream>
#include<iomanip>
#include<vector>
#include<istream>
#include<ostream>
#include<sstream>
#include<fstream>
#include<string>
#include<queue>
#include<functional> //for greater<> in priority queue defintion
using namespace std;
typedef long double ld;
class Map
{
//graph
int n; //number of nodes
int m; //number of edges
vector<pair<ld, ld>> nodes; //node[id] {X, Y}
vector<vector<pair<int, pair<ld, ld>>>> g; // g[id1] {id2, {Length, Time}}
vector<pair<int, ld>> starts; //ids of possible start positions + walking distance to them
vector<pair<int, ld>> ends; //ids of possible end positions + walking distance from them
deque<int>nodes_path; // path of one destination node per query
ld walkingToStartDist;
ld walkingToEndDist;
ld time; //final time from source to all other vertices after performing Dijkstra
ld distance; //final distance from source to all other vertices after performing Dijkstra
ld vehicleDist;
public:
//query related data
pair<ld, ld> source, destination;
ld maximumWalkingDist;
Map(string fileName); //read input + create graph
void viewMap();
void solveQuery(pair<ld, ld>, pair<ld, ld>, ld);
void editMap();
void restoreMap();
void dijkstra(int, int);
void build_path(vector<int>, int);
void writeOutput(); //view output on console
void writeOutputFile(ofstream&);
~Map();
};